1. Click on the rectangle located on the bar on the right.
2. Click on it again (Double Click) and select Oval tool.
3. On the white rectangle box in the middle of the program, click and drag the mouse while holding down SHIFT.
You have created a circle. DONE!
2. Turn it into a symbol.
1. Click on the circle.
2. Click on Window > Convert to Symbol.
3. Name your symbol Button.
DONE! Now your circle is a "symbol" that is called Button!
3. Give it a insurance name of "button".
1. Click on the "Properties" tab located on the top-right.
2. Click on the Button (The Circle).
3. On the space that says, "Insurance name", put "Button".
DONE!
4. Give it actionscript.
1. On the "Layer" on the bottom of the screen, right-click and click on "Insert New Layer".
2. Click on the small WHITE box. (Not Gray.)
2. Click on the box above the "Layers" that says Actions - Frame. (If you don't see it, make sure Window > Actions is checked.)
3. On the box given, put this in:
Button.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); function mouseDownHandler(event:MouseEvent):void { navigateToURL(new URLRequest("http://www.Armorgames.com/"); }
You just made your first flash game. Congrats. Click on Control > Test Movie to play your game. If everything went right, when you click on Button, it will open ArmorGames.com.
Questions, comments, something went wrong? Post here.
Its not really the hyperlink that matters. Its now this can be expanded really easyly. If you replace it with stop() Button.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); function mouseDownHandler(event:MouseEvent):void { nextFrame(); }
You can make a game from there. The hyperlink is just a example of what you can do.
Yeah but there is really little you can do with that if you don't know more code. It basically a button that could be created without actionscript. If I were you I would of explained and did more with event listeners and functions.
Also if you want your code to be betterish then you should make your event listeners to be more garbage collection friendly.
I think that I made a decent game for download. I left out things like score and weapons and damage, but that is because it took me a decent time to program it in myself. Nothing huge in life comes for free, unless you stole it.
http://3dmitchell.com/freeDL/gametutFLASH8.swf
The FLA is in flash 8 format. http://3dmitchell.com/freeDL/gametutFLASH8.fla
If you want the button to move with the arrow keys, heres the code, Kingryan:
//these booleans will check which keys are down var leftDown:Boolean = false; var upDown:Boolean = false; var rightDown:Boolean = false; var downDown:Boolean = false; //how fast the character will be able to go var mainSpeed:int = 5; //adding a listener to Button that will move the character Button.addEventListener(Event.ENTER_FRAME, moveChar); function moveChar(event:Event):void{ //seeing if the arrow keys are down, then moving the char //if they are if(leftDown){ mcMain.x -= mainSpeed; } if(upDown){ mcMain.y -= mainSpeed; } if(rightDown){ mcMain.x += mainSpeed; } if(downDown){ mcMain.y += mainSpeed; } //keeping the main character within the playing field if(mcMain.x <= 0){ mcMain.x += mainSpeed; } if(mcMain.y <= 0){ mcMain.y += mainSpeed; } if(mcMain.x >= stage.stageWidth - mcMain.width){ mcMain.x -= mainSpeed; } if(mcMain.y >= stage.stageHeight - mcMain.height){ mcMain.y -= mainSpeed; } } //this listener will listen for down keystrokes stage.addEventListener(KeyboardEvent.KEY_DOWN, checkKeysDown); function checkKeysDown(event:KeyboardEvent):void{ //Also moving with the WASD keys if(event.keyCode == 37 || event.keyCode == 65){ leftDown = true; } if(event.keyCode == 38 || event.keyCode == 87){ upDown = true; } if(event.keyCode == 39 || event.keyCode == 68){ rightDown = true; } if(event.keyCode == 40 || event.keyCode == 83){ downDown = true; } } //this listener will listen for keys being released stage.addEventListener(KeyboardEvent.KEY_UP, checkKeysUp); function checkKeysUp(event:KeyboardEvent):void{ //making the booleans false based on the keycode if(event.keyCode == 37 || event.keyCode == 65){ leftDown = false; } if(event.keyCode == 38 || event.keyCode == 87){ upDown = false; } if(event.keyCode == 39 || event.keyCode == 68){ rightDown = false; } if(event.keyCode == 40 || event.keyCode == 83){ downDown = false; } }
Opps, use this instead, Use this insted, opps... var leftDown:Boolean = false; var upDown:Boolean = false; var rightDown:Boolean = false; var downDown:Boolean = false; var mainSpeed:int = 5;
kingryan, you have to label the object 'Button.' Go to the timeline, click the object once, then type 'Button' in the box in the lower left hand corner