View Full Version : Loop script problem
jpb_black
December 18th, 2004, 05:45 PM
I was wondering if any one could give me a hand with this loop script that I have. It works in MX but not in MX2004.
if (loopCount++ == 1) stop();
else gotoAndPlay(Scene1);
Thanks
glkngs
December 19th, 2004, 04:10 AM
if you are publishing for AS 2, be sure to declare loopCount as a number:
var loopCount:Number;
AS 1 would automaticly "assume" that loopCount is a number (since you incrementing it with the ++ operator), but they changed that in AS 2
Greets
Voetsjoeba
December 19th, 2004, 12:25 PM
It's actually about the default value - you haven't given loopCount a value yet, therefore you're increasing nothing and therefore it doesn't work. AS1 assumes the value 0 if you try to do this, but AS2 doesn't (as it should). So declare loopCount being a number with value.
Also, gotoAndPlay(Scene1) is invalid, it should be:
gotoAndPlay("Scene1").
Though I strongly advise not to use Scenes, because gotoAndPlay does not work well with Scenes.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.