Copy link to clipboard
Copied
i want to play an mc from frame 1 to frame 20 - so far so good - here ist the script
rot_anim.stop();
function rot_animation (evt:MouseEvent) {
rot_anim.gotoAndPlay(1);
rot_anim.addEventListener(Event.ENTER_FRAME,fStop);
}
function fStop(evt:Event)
{
if (rot_anim.currentFrame>19) {
rot_anim.stop();
rot_anim.removeEventListener(Event.ENTER_FRAME,fStop);
}
}
rot_anim.addEventListener(MouseEvent.CLICK, rot_animation);
now i would like to start to play the mc with a click on a button - but that does not work and i do not know what i am doing wrong. can anybody help me?
here is the script for the button calling the function
button1.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);
function fl_MouseClickHandler(event:MouseEvent):void
{
rot_animation.play();
}
Copy link to clipboard
Copied
Why are you trying to tell a function to play?
Copy link to clipboard
Copied
i thougt i have to, because in it there are the comands that rot_anim has, after the comand play, to stop at frame 19 - is that wrong?
if i say rot_anim.play(); it starts playing after i click on the button, but it does not stop animore... it plays over and over and over...
how else do i have to write it then?
Copy link to clipboard
Copied
You understand that functions aren't movieclips, yes? Functions don't have timelines. You don't "play" a function, you just call it.
Copy link to clipboard
Copied
i thought, that i call it with the name and inside is the movieclip...
obviousley this is wrong
the movieclips name is rot_anim
that it stops at the end of the timeline is the function rot_animation
can you please tell me, how i have to write it?
Copy link to clipboard
Copied
You just call the function, like all functions are called in ActionScript.
Not sure why you're using AS3 though. I assume this isn't a project intended for web use.
Copy link to clipboard
Copied
no it is not for web
i have a problem calling the function because i do not know the synthax for it.
several times i asked in this forum, where i could learn as3. i never got an answer on this question. it seems to be some secret knowledge?
maybe you help me to write it properly? that would be nice ;o)