| Author |
Message |
davidgue first grade
Joined: 14 Mar 2007 Posts: 22
|
|
| Back to top |
|
 |
guitarman fourth grade
Joined: 04 Nov 2005 Posts: 726
|
Posted: Fri May 18, 2007 2:56 pm Post subject: |
|
|
Good point, Here is what i come up with:
At the last frame, put this script:
this.onEnterFrame = function() {
gotoAndPlay("stage2");
stop();
trace("enter new stage");
}
Becareful when using this as it will basically point you to the stage2 all the times when the movie is played (this, refer to the stage itself, i guess )
Another one idea is to create a movie clip (invisible one) place it in the last frame and give it a name, aMovie, for instance. And then add this script to the last frame:
aMovie.onEnterFrame = function() {
gotoAndPlay("stage2");
stop();
trace("enter new stage");
}
___________________
You may wanna test out both method for your own understanding.
|
|
| Back to top |
|
 |
davidgue first grade
Joined: 14 Mar 2007 Posts: 22
|
Posted: Wed May 23, 2007 5:48 am Post subject: |
|
|
Guitarman,
Thanks for the suggestion. I was thinking along the same lines. I tried both the codes, unfortunately neither worked! It seems straightforward but I guess am doing something wrong. I created a test file in which I am pretty much trying to do the same thing. This is the link:
http://www.speedyshare.com/403410536.html
Please take a look at it and let me know what you think. As you can see Scene 3 is not loading. I tried the invisible movie clip idea too..but I was doing something wrong with that and it didnt work. Thanks a lot!
|
|
| Back to top |
|
 |
guitarman fourth grade
Joined: 04 Nov 2005 Posts: 726
|
Posted: Sat May 26, 2007 12:16 am Post subject: |
|
|
david, I was busy with my assignment and now i'm ready to look into ur issue.
Please follow this instruction based on the file you sent to me:
1- On scene 2, add another keyframe next to the first keyframe. On that keyframe, add the following code:
| Code: |
| gotoAndPlay("Scene 3", 1); |
2- Open up the movie clip exist on scene 2, then on the last frame of the movie clip i.e. frame 65, remove the old codes and add this:
this.onEnterFrame = function() {
| Code: |
_parent.gotoAndPlay(2);
stop();
trace("enter new stage");
delete this.onEnterFrame;
} |
It should work very well now.
Discussion
The idea behind this is that the gotoAndPlay is a little stupid when using with MovieClip, so we have to trick it to use the main timeline instead of the movieclip itself.
Source: http://iat.ubalt.edu/courses/old/pbds668.185_Sp02/gotoProblem.shtml
|
|
| Back to top |
|
 |
davidgue first grade
Joined: 14 Mar 2007 Posts: 22
|
Posted: Sun May 27, 2007 11:37 pm Post subject: |
|
|
Guitarman,
Thanks so much for taking time off to help me out. This code worked great!!!! I can't tell you how helpful this has been.. And the link is really useful too - i haven't read it fully, but I see the problem with gotoAndPlay(). I had a doubt though- what is the significance of using the this.onEnterFrame here. I typed in just these lines on the last frame of the movie clip (as opposed to entering it as a function):
_parent.gotoAndPlay(2);
stop();
trace("enter new stage");
And it seems to work fine. Your thoughts?
Thanks again mate!
|
|
| Back to top |
|
 |
guitarman fourth grade
Joined: 04 Nov 2005 Posts: 726
|
Posted: Mon May 28, 2007 2:45 pm Post subject: |
|
|
good to hear that david.
well, the onEnterFrame is just based on my taste, nothing important 
|
|
| Back to top |
|
 |
|