Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What does the 'Load' event really do?

Status
Not open for further replies.

spook007

Programmer
May 22, 2002
259
US
I've put together a form using flash mx 2004 (with update installed). I've completed the first part of the form and it works great, but now that I want to add another screen to my form it will not hide itself when it is loaded. The code attached to the screen is:

on (load){
Trace("event triggered");
this.setVisible(false);
}

I have the same code on the earlier screens I created, but this event doesn't trigger for some reason? Any suggestions am I overlooking something? Thanks.
 
Firing events on 'load' is a bit pointless in MX and beyond if you are placing your script on the main timeline as it will execute there anyway by default when the frame is encountered. If you take the code out of the brackets it should work fine.

It's more useful if you're using Flash 5 style clip events like:

onClipEvent(load){
//do stuff
}

...as the code will fire when the clip itself appears on stage.
 
the code is actually attached to the screen itself. I can't take the code out of the brakets or I get an error, "Statement must appear within on/onClipEvent handler".

I've also tried:

onClipEvent(load){
this.setVisible(false);
}

Still appears on the screen. I've given it an instance name, but still does not trigger when it's supposed to "load".
 
Kay... I've narrowed down the error a little more. The OnClipEvent(load) DOES get triggered, but the "this.setVisible(false)" is not working! This is what I have on the other screens, I don't understand why it doesn't work on this particular one?

What is the difference between the setVisible and using _visible. Thanks.
 
found out what I did wrong... for future reference for anyone with similar problem....

When working in forms mode in Flash mx 2004. When a form screen is added to the movie and modifications are made to the code or code is added, flash sometimes clears the class that the screen belongs to. When this happens, the screen seems to fail to respond to the code. In order to ensure that the page has the correct class check the properties of the screen and make sure the screen class is "mx.screens.Form" this will solve the problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top