PDA

View Full Version : Won't loop. gotoAndPlay doesn't happen.


GNubie
02-15-2005, 02:49 PM
I am trying to create a virtual tour by loading an image and incrementally shifting its position off the stage by decrementing property _x. The image loads and gets shifted to the left once, but then gets reset back to the original position.

This appears to be caused by continual re-execution of Layer 1/Frame 1 which contains the initialization script. It should not because I do a gotoAndPlay(9) right after decementing property _x in frame 20.

The test program has only 2 layers and 20 frames.

Layer 1/Frame 1 Code:
// Load image file.
this.createEmptyMovieClip("myMovie_mc", 1);
myMovie_mc.loadMovie("ef_mp.jpg");
setProperty(this.myMovie_mc, _y, 0);
setProperty(this.myMovie_mc, _x, 0);

Layer 2/Frame 20 Code:
setProperty(this.myMovie_mc, _x, Number(getProperty(this.myMovie_mc, _x))-10);
myMovie_mc.gotoAndPlay(9);

1. Why does it not loop from frame 20 back to 9? :confused:
2. Why does Layer 1/Frame 1 get continuously re-exectued? I have no looping properties set and Repeat is set to 0. :confused:

Using FlashMXPro 7.

I would welcome pointers specific tuts or documentation. If you know of a better way to create a virtual tour, please suggest it.

Doccie
02-15-2005, 03:07 PM
because you're not on frame 20 of the movieclip but on frame 20 of the mainstage?
You're code isn't very clear to me :(

Also, to stop it from looping you might want to place a stop(); somewhere (unless they stopped using that in Flash MX 2004 which I doubt :) )

GNubie
02-15-2005, 03:25 PM
Thanks. That was the problem. I changed the code to below and it worked fine.

Layer 2/Frame 20 Code:
setProperty(this.myMovie_mc, _x, Number(getProperty(this.myMovie_mc, _x))-2);
gotoAndPlay(19);