• home
  • forum
  • my
  • kt
  • download
  • Flash Actions Moving Objects with Buttons and Actions

    Author: 2009-01-06 08:41:32 From:

    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

    relation tutorial

    No information

    Category

      3D (29)
      Math Physics (17)
      3rd Party (8)
      Navigation (65)
      Actionscripting (181)
      Optimization (17)
      Animation (128)
      Projector (11)
      Audio (52)
      Special Effects (157)
      Backend (26)
      Text Effects (86)
      Drawing (32)
      Tips and Techniques (47)
      Dynamic Content (32)
      Tricks (8)
      Games (101)
      Utilities (23)
      Getting Started (92)
      Video (24)
      Interactivity (43)
      Web Design (29)

    New

    Hot