Actionscript help needed !


#1

I’ve a little problem with a preloading.

Here is the animation, it’s a work in progress (it’s missing a few things such as music), and it’s quite heavy (1mo) : http://perso.wanadoo.fr/julien.tromeur/skar.html

It’s the character that is quite heavy : it has 11 independant animations, they’re displayed randomly.
What i would like to do is that the character starts playing as soons as the first move is loaded, and then each time a new move is loaded the character integrates it in the random.
What you have to know is that the animations are on the same frame, one after another (frame 66 to 76).

Here is the script in the current state :
gotoAndStop(random(11)+66);
Each time a move is over it comes back to this script and picks up another one (or the same as it’s random).

And here is the script i tried for the “intelligent” loading (but it doesn’t work) :

if (_framesloaded=76) {
randnumber = 11;
} else if (_framesloaded=75) {
randnumber = 10;
} else if (_framesloaded=74) {
randnumber = 9;
} else if (_framesloaded=73) {
randnumber = 8;
} else if (_framesloaded=72) {
randnumber = 7;
} else if (_framesloaded=71) {
randnumber = 6;
} else if (_framesloaded=70) {
randnumber = 5;
} else if (_framesloaded=69) {
randnumber = 4;
} else if (_framesloaded=68) {
randnumber = 3;
} else if (_framesloaded=67) {
randnumber = 2;
} else if (_framesloaded=66) {
randnumber = 1;
}
gotoAndStop(random(randnumber)+56);

Any idea ?


#2

in flash all evaluations have to be done using an ‘==’ operator. ‘=’ is used only for assignments.

for a start all the:

if (_framesloaded=num) {
}

need to be

if (_framesloaded == num) {
}


#3

thanks i give it a try :slight_smile:


#4

Thanks poe, it seems to work fine, no more huge preloading. :beer:

http://perso.wanadoo.fr/julien.tromeur/skar.html


#5

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.