• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Simple loop on the main timeline

Enthusiast ,
Jul 22, 2009 Jul 22, 2009

Copy link to clipboard

Copied

Hello,

I am very very new to actionscripting, so please bear with me.

I have a very simple banner that I would like to play 3 times and stop.

How can I do that in Actionscrip 3.0?

Thanks

babs

TOPICS
ActionScript

Views

920

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jul 22, 2009 Jul 22, 2009

Assuming you have a timelinme animation, one way of doing this is to keep a count of the number of times the timeline plays and to stop it when it reaches the end of the last run.  To do this you can add the following code to an actions layer in the first frame...

var count:uint;

if(!count){
count = 0;
}

and add this code in the last frame at the end of that same layer...

count += 1;
if(count == 3){
stop();
}

Votes

Translate

Translate
LEGEND ,
Jul 22, 2009 Jul 22, 2009

Copy link to clipboard

Copied

Assuming you have a timelinme animation, one way of doing this is to keep a count of the number of times the timeline plays and to stop it when it reaches the end of the last run.  To do this you can add the following code to an actions layer in the first frame...

var count:uint;

if(!count){
count = 0;
}

and add this code in the last frame at the end of that same layer...

count += 1;
if(count == 3){
stop();
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 22, 2009 Jul 22, 2009

Copy link to clipboard

Copied

HI Ned,

It worked great!!!!

It is over my head...but it did work!!!

I actually understood the second keyframe at the end, after looking up the == stuff and learning about that count variable name you gave it, however the first part of it, is out my league for now...but as always, I will keep plugging at it.

Thank you so much for your help!!!

babs

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 22, 2009 Jul 22, 2009

Copy link to clipboard

Copied

You're welcome babs.  For the first part of it, I am doing something to prevent you from having to add a frame that you don't visit again.  I declare the var count, but don't assign it a value unless it has none, which it will not have when the animation first starts. If I had started it out in frame 1 with..

var count:uint = 0;

then everytime it looped back to frame 1 it would reset count to 0... which would mean you'd have to loop back to frame 2 instead of frame 1.

So I have it test if count has no value assigned and assign it a zero in that case only.  That way, when it loops back to frame 1, the value of count is not reset because it has a value by that time.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 22, 2009 Jul 22, 2009

Copy link to clipboard

Copied

LATEST

Hi Ned,

Thanks so much, that makes a little more sense.......every little bit helps......
I know I will never be great at this, but every time I get into something, I just keep learning more and more.

People like you, really help...so thanks so much!

babs

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines