03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

In Flash Player 8, or later, this listener can return an HTTP status code. If Flash Player cannot<br />

get the status code from the server, or if Flash Player cannot communicate with the server, the<br />

default value of 0 is passed to your <strong>ActionScript</strong> code. A value of 0 can be generated in any<br />

player (for example, if a malformed URL is requested), <strong>and</strong> a value of 0 is always generated by<br />

the Flash Player plug-in when run in the following browsers, which cannot pass HTTP status<br />

codes from the server to Flash Player: Netscape, Mozilla, Safari, Opera, <strong>and</strong> Internet Explorer<br />

for the Macintosh.<br />

It's important to underst<strong>and</strong> the difference between MovieClipLoader.onLoadComplete<br />

<strong>and</strong> MovieClipLoader.onLoadInit. The onLoadComplete event is called after the SWF,<br />

JPEG, GIF, or PNG file loads, but before the application is initialized. At this point, it is<br />

impossible to access the loaded movie clip's methods <strong>and</strong> properties, <strong>and</strong> therefore you cannot<br />

call a function, move to a specific frame, <strong>and</strong> so on. In most situations, it's better to use the<br />

onLoadInit event instead, which is called after the content is loaded <strong>and</strong> fully initialized.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 7 - <strong>Support</strong> for unanimated GIF files, PNG files,<br />

<strong>and</strong> progressive JPEG files is available as of Flash Player 8.<br />

Parameters<br />

target_mc:MovieClip [optional] - A movie clip loaded by the<br />

MovieClipLoader.loadClip() method.<br />

httpStatus:Number [optional] - (Flash Player 8 or later, only) The HTTP status code<br />

returned by the server. For example, a status code of 404 indicates that the server has not<br />

found anything matching the requested URI. For more information about HTTP status<br />

codes, see sections 10.4 <strong>and</strong> 10.5 of the HTTP specification at ftp://ftp.isi.edu/in-notes/<br />

rfc2616.txt.<br />

Example<br />

The following example creates a movie clip, a new MovieClipLoader instance, <strong>and</strong> an<br />

anonymous event listener which listens for the onLoadComplete event but waits for an<br />

onLoadInit event to interact with the loaded element properties.<br />

var loadListener:Object = new Object();<br />

loadListener.onLoadComplete = function(target_mc:MovieClip,<br />

httpStatus:Number):Void {<br />

trace(">> loadListener.onLoadComplete()");<br />

trace(">> =============================");<br />

trace(">> target_mc._width: " + target_mc._width); // 0<br />

trace(">> httpStatus: " + httpStatus);<br />

}<br />

MovieClipLoader 965

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!