I need a timeline to play only 3 times. I know it involves a counter of some sort. But not sure how to code that. Can someone kindly help out or point me to a resource?
Thanks
I need a timeline to play only 3 times. I know it involves a counter of some sort. But not sure how to code that. Can someone kindly help out or point me to a resource?
Thanks
Wooo what i posted was completly retarded
waits for senocular
Put this at the end of the timeline anim;
dispatchEvent(new Event("TIMELINE_DONE"));
Then just listen to that event.
var cnt:uint = 0;
TIMELINEOBJECT.addEventListener("TIMELINE_DONE", mo);
function mo(e:Event):void {
cnt++;
cnt > 2 ? e.target.stop() : null;
};
above example is with timeline code, so move it in to whatever class you are using. Timeline code is not awesome.
uuuhhh…hmmm…class…um yea…well…do not know how to use classes
This is just a flash ad banner. Is there anyway it can all be self contained in the flash file? Maybe on the timeline.
But thank you for the help thus far.
such a hard, simple question.
Throw this in the last frame of the timeline and it should work
var loopCount:int = 3; // how many times do you want to play?
var counter:int; // used by the if check to see how many times already played
counter++; // we're at the last frame so up the play counter
// now check to see if we need to stop
if (counter >= loopCount) stop();
The one thing to take note is that counter is not given an assigned value. Why not? because if you assign it a value, it will be set to that value every time this frame is entered. Instead we want it to continuously update when this frame is entered. So we’ll rely on the int type declaration to give the variable an initial value of 0 and then ++ it up from there.
There are ways to work around this… but just doing what I’ve done above makes it easy and compact.
yeah dude, you can just use the code I pasted
Here, I’ll attach a quick FLA example
Oh the maaaain timeline… Sorry Thought you meant a timeline inside a child.
You guys are my favs…thanks a bunch. I promise to learn AS by the time they get to AS5
Sen that’s awesome - simple and easy to understand.
[COLOR=“Gray”]
feels brain getting a little bit bigger[/COLOR]