-
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!
-
Any Suggestion/help???? i'm new to the whole button playback stuff. mainly just an animator/designer.
-
lemon juice hurts your eyes
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!
-
this is what i get when doing that:
-
lemon juice hurts your eyes
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!
-
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?
-
this is what i get now; i've made the proper instance names; yet it's still causing errors.
-
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.
-
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.
-
lemon juice hurts your eyes
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!
-
THANK YOU THANK YOU THANK YOU!!!!
that fixed the problem!
u r a genious! far superior than i
-
lemon juice hurts your eyes
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!
-
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|