TeFa
TeFa

Reputation: 1004

gotoAndPlay() jumps to Frame 2 instead of Frame 3

I am really confused about this issue ...

In the first Frame i wrote the following code:

stop();
var currentInterInfo:IntersectionInfo = null;
var currentInter:Intersection;
gotoAndPlay("Frame3");

and in the 2nd frame (labeled "Frame2") i wrote:

stop();
trace("Frame2");

and in the 3rd frame (labeled "Frame3") i wrote:

stop();
currentInter = new Intersection(.....); // notes that the constructor of the Intersection class is empty
trace("Frame3");

When I run it, i get "Frame 2" in the output although i should get "Frame 3" as a result ... and When I debug, i get "Frame 3" ... no idea whats wrong here ... I uploaded my project in the link below in case u want to check it out ...

BugReproduce.rar

Upvotes: 0

Views: 846

Answers (1)

Jevgenij Dmitrijev
Jevgenij Dmitrijev

Reputation: 2238

Works for me!.

The case in this sutuation is:

When you compiling the SWF inside the flash or loading it, it is loading all of the frames.

So at this point not all of the frames are stacked, so you are beeing sent to the last one available in this case it is 2.

in the 1st frame change your code to:

import flash.utils.setTimeout;
stop();

var currentInterInfo:IntersectionInfo = null;
var currentInter:Intersection;

setTimeout ( init, 100 )

function init ()
{
    gotoAndPlay("Frame3");
}

Or somehow prevent application launch before it is completely loaded.

Upvotes: 1

Related Questions