A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [F8] Buttons & ActionScript

  1. #1
    Junior Member
    Join Date
    Oct 2006
    Posts
    25

    [F8] Buttons & ActionScript

    I'm creating an interactive flash animation in which there are five buttons (numbered 1 - 5). The idea is that when each button is pressed a corresponding number of incense sticks appears to the left of them, so when 1 is pressed 1 stick of incense appears, when 2 is pressed 2 are supposed to appear, etc. These sticks can be dragged and dropped by whoever's viewing the animation at the feet of a statue/altar, and when each stick of incense is placed in an incense holder there an aura appears around the statue, and it grows bigger as more sticks of incense are placed there.

    I have it set up so that when the first button is pressed it directs the animation to frame 31 (the first 30 frames show nothing happening and have stop actions placed on them) in which the first animated incense stick appears and then the aura appears after a delay (since I haven't figured out how to "trigger" it to appear when the incense stick is placed on the altar yet, I just leave a lapse of time for someone to place the stick in).

    I'm trying to make the rest of the buttons work now, and so for button two I'm using the following code: on (release) {gotoAndPlay(209);

    }

    to try and get the animation to start at frame 209, where I've placed a second incense stick. The thing is that when I click on button 2 only the first stick appears and it loops back the original aura tween without a delay (since 208 is the last frame of the animation button 1 leads to), so I'm not sure if this method really works or if I'm just not doing it correctly. Is there some way I can rig this, like for instance by creating a seperate scene for the button to lead to, to make it work properly?

    I also don't want for the first button's animation to lead into the second one's automatically, but I can't use stop actions at the end of the first button's animation because it stops the aura tween from looping itself, so that creates another problem.

    But I'd also like to create some sort of "trigger", if it's possible, so that when someone places the incense stick in the holder the aura animation starts up from that rather than being on the main timeline with a delay, but I don't know how to accomplish that. I was thinking I could make an invisible button and use a rollover code or something.

    This is only my second flash animation so it's all just kind of confusing for me, so I'm sorry if I couldn't communicate the problem efficiently. I'd like to upload the file here so that there's an example to view but it's too big (1.77 mb), so if someone would like for me to e-mail it to them let me know.

    Any help would be much appreciated,
    Thanks,
    Art

  2. #2
    anyone else hear that? flashpipe1's Avatar
    Join Date
    Jan 2003
    Location
    Upstate NY
    Posts
    1,930
    A few things...I'd put labels on your frames and use those instead of using frame numbers, that way, if you add more frames later, it won't break your animation. Also, you could do this with attachMovie, duplicateMovieClip, etc. but I took the straight-forward route...

    Not sure I'm entirely clear on what you're looking to do, but I worked up a quick mock up of what it might be...let me know if I'm close.

    If not, feel free to pm me and I'll get you my contact info so you can send me the fla...

    Hope that helps!!!
    Last edited by flashpipe1; 09-10-2007 at 01:29 PM.
    Love like you've never been hurt, live like there's no tomorrow and dance like nobody's watching.

  3. #3
    Junior Member
    Join Date
    Oct 2006
    Posts
    25
    I'm pretty inexperienced with Flash, and I've kind of just jumped right into it, done a few help tutorials, skimmed some forums and books, and asked people questions, so there are a lot of simple things (and a lot of complex things, of course) I don't know how to do... Like, for instance, labelling frames.

    Basically what I'm trying to do, at least as far as the incense sticks go, is pretty similar to what you came up with. The format is a little different, but I think if I can figure out how to label frames I could get this to work.

    Thanks for the assistance, man

  4. #4
    anyone else hear that? flashpipe1's Avatar
    Join Date
    Jan 2003
    Location
    Upstate NY
    Posts
    1,930
    If you select the keyframe where you want to add the label, select Insert->Timeline->Keyframe or hit F6, and then type the name you want into the Frame field in the Properties window, you'll have a label!

    Hope that makes sense...if not, let me know and I can send some screenshots...I'm sure there are tutorials out there too...

    Hope that helps!!
    Love like you've never been hurt, live like there's no tomorrow and dance like nobody's watching.

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