all groups > flash actionscript > june 2005 >
You're in the

flash actionscript

group:

Screen.load problem


Screen.load problem pswang
6/30/2005 9:51:34 PM
flash actionscript: Hi, I have a question about Screens/Slide in MX 2004.

In the following code example, i have a screen which contains 3 slides.
I was trying to make this file goes to the second slide when initialized, but
it just doesn't work.


http://www.anatomicaltravel.com/temp/gotoslide.flahttp://www.anatomicaltravel.co
m/temp/gotoslide.fla

Can anyone help me? thanks!
Re: Screen.load problem pswang
6/30/2005 10:20:31 PM
Um, i figured out my problem... the code should be modified to:



myListener = new Object();
myListener.handleEvent = function(eventObj) {
trace(_parent.myRoot.slide2);
// GoTo Screen behavior
if ((_parent.myRoot.slide2 != undefined) && (_parent.myRoot.slide2 != null)) {
var screen = null;
var target = _parent.myRoot;
while ((screen == null) && (target != undefined) && (target != null)) {
if (target instanceof mx.screens.Screen) {
screen = target;
} else {
target = target._parent;
}
}
if (screen instanceof mx.screens.Slide) {
screen.gotoSlide(_parent.myRoot.slide2);
}
}
// End GoTo Screen behavior
};
this.addEventListener("load", myListener);
AddThis Social Bookmark Button