I am ashamed that I can't seem to figure this out. I just need AS code that sets a variable starting at 1 and then auto increments to 7 then resets back to 1.
I am ashamed that I can't seem to figure this out. I just need AS code that sets a variable starting at 1 and then auto increments to 7 then resets back to 1.
Code:var num:Number = 1; function increaseByOne() { if(num > 7) { num = 1; } else { num++; } }
How do I get the function to loop and then call the variable
e.g.
gotoAndStop(num);
Please advise on why this is not working?
Code:var num:Number = 1; function increaseByOne() { if(num > 7) { num = 1; } else { num++; } } i = num; increaseByOne(i); _root.partners.logos.gotoAndStop(i);
Please explain what you're trying to do in exact terms. I can't make sense of the extra code you've posted.
I have a mc that just has a fade in, pause, then fade out...
Within this mc I have 7 frames, each with a different logo.
I am trying to just direct the mc to that logo and do it sequentially from frame 1 (logo 1).
Alright...try this:
Then, call playNext() wherever/however you're going to the next frame. If you want it on a timer, use setInterval.Code:var frame:Number = 1; function playNext() { if(frame > 7) { gotoAndStop(1); // or gotoAndPlay(), whatever you need } else { frame++; gotoAndStop(frame) } }
This is doing the same thing that I already had? If I place the AS in my mc tween area and then call the function within an onEnterFrame function it doesn't work. If I do the same from the mc itself that contains all my logos it just rapidly cycles through the logos without any sort of fade in/out tween.
You shouldn't be calling this with an onEnterFrame. That calls the function once per frame -- overkill!
Use setInterval to have a continuous loop.
Bookmarks