0
votes

I am not sure why this is not working. For some reason when I implement the following code it does not jump to the correct scene or frame. I also tried using labels and frame numbers within the same scene.

When implemented the trace shows as it should "skip" but the movie does not jump correctly it actually jumps to the middle of animation and stops. I want the animation to be skipped the 2nd time the user comes to the site.

I am truly at a loss because I really think this should work. Here is the code:

var visit:SharedObject = SharedObject.getLocal("beenHere");
stop();

//visit.clear();


if(visit.data.visits == "skip"){

    trace(visit.data.visits);
    gotoAndStop(1,"Scene 2")
    //nextScene();
    }


else{
    play();
    visit.data.visits = "skip";
    visit.flush();

    }

Here is a file to download (34mb)---sorry for the size http://www.corporatereport.com/SampleSites/bottle&vinesfla2.zip

**EDIT!!! If this can't be solved does anyone have an idea on how I can accomplish this a different way? (Skip to Scene 2 on the 2nd visit to the site)? Maybe a JS solution.

2
When placed into a new project this works for me as expected. Because your trace comes out correctly I suggest that you make sure that you scene name is exactly correct, it is case sensitive. Otherwise, I think there must be more to your issue that is not clear from the code you have posted.shanethehat
I made sure and double checked everything several times. No matter what I do it always goes to a specific frame and stops. Even nextScene() makes it so that the movie skips to the next scene and starts playing. but it should not based on me script. I have uploaded the file here for anyone that might want to take a look: www.corporatereport.com/SampleSites/bottle&vinesfla2.zipmitch
There is an easy solution - delete all the layers from scene 1 except for actions :) Seriously, I'm not sure what's going on with this, no one layer seems to be at fault, but removing the animations definitely makes it work as expected.shanethehat
For the record, this isn't restricted to scenes, or the SharedObject code. A simple gotoAndPlay(415) on the first frame doesn't work in the same way.shanethehat
Does anyone have another idea on how to accomplish this? So that on the 2nd visit I can skip to scene 2?mitch

2 Answers

0
votes

Move stop() to the bottom of the page.

0
votes

I had the same symptom. The gotoAndStop(1, "sceneName") would just blow through the stop() in in the destination scene.

The problem was that I had a stage.addListener in scene 1 that would nextFrame if the currentFrame ==1. So, the button click in scene 1 that initiated the gotoAndStop to scene 2, frame 1 went to scene 2, frame 1. But then, the stage event saw that the currentFrame == 1 and did nextFrame.

It was doing exactly what I told it to do, but it looked like an error.