loadMovieNum (loadMovie, loadVariables, etc.) is an asynchronous function,
meaning it doesn't return immediately. If it did, it would mean Flash
would have to halt all execution until it received a response from a
server in order to get the SWF either completely loaded or at least get
the header info to know if the file was found. In either case this would
cause the player to hang while it waited for a response.
Flash's load commands are not executed at the point you write them. The
calls are queued and executed at the end of the frame actions. The values
you pass are actually evaluated at that point, but the call to the outside
world doesn't occur then.
You'll need to use another mechanism to see if the call was successful or
not. The MovieClipLoader class, for example, has multiple events,
including onLoadError.
One word of caution though, MovieClipLoader works for the majority of
cases, but I have seen cases where the network connection fails yet
MovieClipLoader calls onLoadComplete - very annoying.
Derek Vadneau
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Peter
Måseide
Sent: Thursday, March 30, 2006 7:10 AM
To: Flashcoders mailing list
Subject: [Flashcoders] what´s the catch?
try {
loadMovieNum(filename, 3);
} catch (error:Error) {
trace(An error!);
}
If filename is a path to a non-existing file i want the code in the
catch to be executed.
I only get an
Error opening URL file:///Macintosh%20HD/... swf
in my Output window, either if I use try-catch or not.
Any suggestions?
Thanks in adwane!
Peter
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com