Welcome to WebmasterWorld Guest from 54.160.131.144

Forum Moderators: open

Message Too Old, No Replies

Flash Actionscript problem

     

yogi799

8:54 pm on Jul 1, 2004 (gmt 0)

10+ Year Member



I have a simple flash animation which uses the following script:

gotoAndPlay (random ( 3 )*40+1);

Which randomly generates the beginning frame of the movie (1, 41, 81, or 121).

WHen I publish it, it works great as a swf. file but does not work on a web page itself in IE. It keeps on playing the movie from the beginning.

Any clues?

Thanks

benihana

11:43 am on Jul 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



have you tired putting a :

stop();

on the fgirst line of the first frame?

yogi799

6:55 pm on Jul 6, 2004 (gmt 0)

10+ Year Member



I'm afraid I have - what bothers me is that the SWF file itself works great just like it should and the same file embedded in the webpage is not playing right. Anyone had this happen before?

benihana

6:58 pm on Jul 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



when you say " in IE", have you tried other browsers?

trying to narrow it down

yogi799

7:02 pm on Jul 6, 2004 (gmt 0)

10+ Year Member



Nope. But then if I really use IE, will this make any difference for me?

benihana

7:41 pm on Jul 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



probably not really, just eliminating things :)

really dont know whats causing it, but would maybe try putting the script in the first frame (as you have)
but the rest of movie at 2, 42, 82 etc, and adjust the random accordingly. worth a shot.

good luck
ben

yogi799

8:34 pm on Jul 6, 2004 (gmt 0)

10+ Year Member



Thanks for your help! Appreciate it.

jezra

11:32 pm on Jul 6, 2004 (gmt 0)

10+ Year Member



I've had a similar issue in a large swf that was only 6 frames in length. If the function gotoAndPlay(6) was called before frame 6 was loaded into memory, the swf would goto and play frame 2 because it was the highest numbered frame that was loaded at the time. The problem was fixed by adding a preloader that wouldn't call the "gotoAndPlay()" function until all of the frames were loaded.

winstun

12:16 pm on Jul 7, 2004 (gmt 0)

10+ Year Member



Good call, Jezra.

The pre-loader may be worth a shot.
Perhaps you could also try a

this.onLoad = function(){
// insert randomizer function call here
}

in the first frame of the _root timeline.

No guarantees, but couldn't hurt.

Good luck.

yogi799

12:48 pm on Jul 7, 2004 (gmt 0)

10+ Year Member



Unfortunately, I've tried something similar, too. Making sure the last frame was loaded before the function was called. But I will look into it again - maybe my code was faulty. I, too, have a feeling the problem lies in here. THANKS A TON, GUYS!