|
-
Animal Flasher
-
Well, really var count will be the equivalent of your ImageNumber, so:
PHP Code:
if (count >= numberOfImages) {
count = 0
}
Just watch where you put that stuff; make sure that count isn't going to change on you when you DON'T want it to.
EDIT: I suggest you put it between the two lines you just showed.
-
Animal Flasher
thanks Multihunter, I was thinking along that line earlier, but it comes up with an error:
1176: Comparison between a value with static type uint and a possibly unrelated type String.
-
numberOfImages should be datatyped to a int or uint.
var numberOfImages:uint;
-
if a number is contained in a string then it will stay a string until you convert it. You can convert it like this: Number(myString). That will change the number in myString to an actual number that you'll be able to use in the comparison.
-
Animal Flasher
Awesome stuff chaps, got it all working now 
Thanks for all your help and enlightenment
Rob
-
Animal Flasher
Just one more thing on this topic....
Is it possible using Math.random() to set the start number between 0 and 'numberOfImages' randomly?
ie. randomize the first image that is shown, then continue as before...
-
Ok, so if I understand correctly, you have:
PHP Code:
var count:uint = count+1
looped?
You're declaring it a new variable every loop. You only need to delcare it once, so at the beginning of your code have:
PHP Code:
var count:uint = Math.ceil(Math.random()*numberOfImages)
then, in the loop have:
Which is the same as:
PHP Code:
count = count + 1
-
Animal Flasher
brilliant MultiHunter to the rescue again!
Thanks for your help buddy
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|