dcsimg
A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: Help with playback buttons please!!!

  1. #1
    Junior Member
    Join Date
    Aug 2008
    Posts
    16

    Exclamation Help with playback buttons please!!!

    Okay, so i have a flash file.
    on my stage i have placed a movie clip; contained within the movieclip (named 'animation_mc') i've placed an actions layer that has the clip stopped upon playing the full file.

    I've placed some playback buttons (start & stop) that i want to have in there that will control the playback of this MC.

    What is the scripting needed that will take this animation_mc from it's stopped position and make it play when i click the play button; and stop it when i hit the stop button. and do i put the actionscript on the button layer itself, or in the main actionscript layer of the MC?

    if need be; i can e-mail the full file structure i'm attempting to create.

    a little background of the project:

    i'm creating a before/after animation that initially is stopped. and the user can click the play button to play it, and stop it as well.

    SEND HELP ASAP!

  2. #2
    Junior Member
    Join Date
    Aug 2008
    Posts
    16
    Any Suggestion/help???? i'm new to the whole button playback stuff. mainly just an animator/designer.

  3. #3
    lemon juice hurts your eyes florianvanthuyn's Avatar
    Join Date
    Jul 2005
    Location
    Merelbeke, Belgium
    Posts
    546
    So I understand that you want to controle 'a movieclip' within a movieclip 'animation_mc'.
    Place this code on the main timeline (and the buttons should be there too!), it should do the trick:
    Code:
    playBtn.addEventListener(MouseEvent.CLICK, playMC);
    playBtn.buttonMode = true;
    
    stopBtn.addEventListener(MouseEvent.CLICK, stopMC);
    stopBtnBtn.buttonMode = true;
    
    function playMC(e:MouseEvent):void
    {
           animation_mc.aMovieClip.play();
    }
    
    function stopMC(e:MouseEvent):void
    {
           animation_mc.aMovieClip.stop();
    }
    Simple as that

    If the animation_mc contains the actual movie to be stopped and played (so not nested in another movieclip), remove te ".aMovieClip"'s!
    Last edited by florianvanthuyn; 09-18-2008 at 04:57 PM.
    Florian Vanthuyne

    WAR AGAINST SOLVED THREADS
    mark yours as Resolved under Thread Tools!

  4. #4
    Junior Member
    Join Date
    Aug 2008
    Posts
    16
    this is what i get when doing that:

  5. #5
    lemon juice hurts your eyes florianvanthuyn's Avatar
    Join Date
    Jul 2005
    Location
    Merelbeke, Belgium
    Posts
    546
    You have to select your play button and in the properties window, give it an instance name "playBtn". Do the same for the stop button, only name it "stopBtn".

    Then, check where your animation is located. You said it is inside a movieclip, and that one is inside of a movieclip calles "animation_mc".
    If so, change the name of the movieclip inside of "animation_mc" to "aMovieClip" (or anything you want, just also change it in the code).

    If your animation is just inside of "animation_mc", change all the "animation_mc.aMovieClip" in the code to "animation_mc".
    Florian Vanthuyne

    WAR AGAINST SOLVED THREADS
    mark yours as Resolved under Thread Tools!

  6. #6
    Junior Member
    Join Date
    Aug 2008
    Posts
    16
    there's only 1 movieclip; it's called animation_mc; it's placed on the main timeline in its own layer. then on another layer i have my buttons. is this correct?

  7. #7
    Junior Member
    Join Date
    Aug 2008
    Posts
    16
    this is what i get now; i've made the proper instance names; yet it's still causing errors.

  8. #8
    Junior Member
    Join Date
    Aug 2008
    Posts
    16
    I just realized that my MC didn't have its instance name either; just disregard the first 2 errors; all that's left are the bottom 2. the 2 1119 errors.

  9. #9
    Junior Member
    Join Date
    Aug 2008
    Posts
    16
    The animation being controlled is the movie clip; which is named animation_mc. that's the only movie clip being used throughout the whole file. so on the main stage; i have an Actions layer; a movieclip layer; which has the movie clip placed in it. a controls layer that has both the start/stop buttons on it; and that's it. both of the start/stop buttons are both button symbols.

    please help.

  10. #10
    lemon juice hurts your eyes florianvanthuyn's Avatar
    Join Date
    Jul 2005
    Location
    Merelbeke, Belgium
    Posts
    546
    If I'm not mistaken, I seem to read on your second image that the last word s visible are "SimpleButton", but they're cut off.

    SimpleButtons don't have a buttonMode property, so change:
    Code:
    stopBtn.buttonMode = true;
    To:
    Code:
    stopBtn.useHandCursor = true;
    And the same for the startBtn lines.
    Florian Vanthuyne

    WAR AGAINST SOLVED THREADS
    mark yours as Resolved under Thread Tools!

  11. #11
    Junior Member
    Join Date
    Aug 2008
    Posts
    16
    THANK YOU THANK YOU THANK YOU!!!!

    that fixed the problem!

    u r a genious! far superior than i

  12. #12
    lemon juice hurts your eyes florianvanthuyn's Avatar
    Join Date
    Jul 2005
    Location
    Merelbeke, Belgium
    Posts
    546
    No problem

    I was getting scared that I had made some kind of stupid mistake, but hey, it worked out all right after all
    Florian Vanthuyne

    WAR AGAINST SOLVED THREADS
    mark yours as Resolved under Thread Tools!

  13. #13
    Member
    Join Date
    Oct 2005
    Location
    Santa Barbara, California, USA
    Posts
    61
    Hey thanks for this guys. I'm struggling to add coding to my design abilities and this kind of thing really helps.

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