Hi everyone, good day to you. You know, I’ve often wondered how can you make a simple game using flash, or at least how do you make an object move on screen, based on user input. Well, wonder no more, as I’ll show you a simple example of how you can move a teddy bear to different positions on screen using buttons and actions.
1. select Window > Actions, to open Actions panel
2. select symbol instance, in this case its an instance called myTeddy to be moved
3. move symbol instance to the up position, and note the x and y position of the instance, in the Info panel, eg. x is 275 and y is 80
note: if registration point of symbol (shown in library) is at center, then also click the center position registration point for the Info panel
4. select button instance labeled up
5. under Global functions > Movie Clip Control, double-click the ‘on’ action, and double-click press event
note: the script for button instance labeled up should now be:
on(press){
}
6. enter the following script after the opening bracket, so script will look like below:
on(press){
_root.myTeddy._x=275;
_root.myTeddy._y=80;
}
7. repeat steps#3 to 6, for the other positions (down, left and right), and other buttons, and change the value of x and y position accordingly for the different buttons
8. press Ctrl + S, to save file
9. press Ctrl + Enter, to test movie
discuss this topic to forum
