A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: Basic Actions

  1. #1
    Junior Member
    Join Date
    Apr 2002
    Posts
    19
    Can someone explane me step by step how to set a basic action? For example I want when I click a thing with the mouse then go to an another frame. I know that I set it from actions and I know that I change frame with "Go to" but I don't know how give the comment that if something happens then happen something else.

  2. #2
    Senior Member
    Join Date
    Jul 2000
    Posts
    323
    Well, first of all, you need a button to catch the mouse click... So draw your button and hit F8 (Or Insert > Convert to Symbol), and pick Button from the choices there.

    Then, in the code for the button (Not the frame), you want:

    on ( release ) {
    gotoAndPlay(2);
    }

    The on() statement watches for a particular event, then runs the commands inside the curly braces... In this case, the event you want is "release", which means the user clicked and released the mouse button. When that happens, it'll run the gotoAndPlay command, which, as it says, will go to and start playing a frame... In this case, I just put frame 2, but you can put any frame number or any frame label.

  3. #3
    Junior Member
    Join Date
    Apr 2002
    Posts
    19
    How I go the to code for the button since when I right-click Up and then Actions I can't select anything.

  4. #4
    Senior Member
    Join Date
    Jul 2000
    Posts
    323
    Either pick the command to add from the list on the left, or switch to advanced mode (Button on the top-right) and paste that code in.

  5. #5
    Junior Member
    Join Date
    Apr 2002
    Posts
    19
    I know that but I mean from where I go to the Actions becuse when I right-click the frame which is under "Up" at the layer for the button and then Actions the program dasn't let me to pick anything.

  6. #6
    Senior Member
    Join Date
    Jul 2000
    Posts
    323
    The actionscript doesn't go INSIDE the button... Go to the main timeline, right-click on the button, and pick Actions...

  7. #7
    Junior Member
    Join Date
    Apr 2002
    Posts
    19
    Thanks but when the movie starts it goes to frame 2 without me to press the button. How I stop it at frame 1 at the start? And for what is usfull the "Hit" frame at a button?

  8. #8
    Junior Member
    Join Date
    Apr 2002
    Posts
    19
    Can someone tell me? It's not usfull to use buttons if the movie plays all the frames from the start.

  9. #9
    Senior Member
    Join Date
    Jul 2000
    Posts
    323
    Simple... In the code for frame 1, put a stop() action.

    As for the "Hit" frame, that basically tells flash what part of the button the user can click on...

  10. #10
    Junior Member
    Join Date
    Apr 2002
    Posts
    19
    Thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center