03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - 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.

Example<br />

The following example creates a new movie clip called pic_mc <strong>and</strong> loads an image into that<br />

clip. It is loaded using the MovieClipLoader class. When you click the image, the movie clip<br />

unloads from the SWF file:<br />

var pic_mcl:MovieClipLoader = new MovieClipLoader();<br />

pic_mcl.loadClip("http://www.helpexamples.com/flash/images/image1.jpg",<br />

this.createEmptyMovieClip("pic_mc", this.getNextHighestDepth()));<br />

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

listenerObject.onLoadInit = function(target_mc) {<br />

target_mc.onRelease = function() {<br />

unloadMovie(pic_mc);<br />

/* or you could use the following, which refers to the movie clip<br />

referenced by 'target_mc'. */<br />

//unloadMovie(this);<br />

};<br />

};<br />

pic_mcl.addListener(listenerObject);<br />

See also<br />

loadMovie (MovieClip.loadMovie method), unloadClip<br />

(MovieClipLoader.unloadClip method)<br />

unloadMovieNum function<br />

unloadMovieNum(level:Number) : Void<br />

Removes a SWF or image that was loaded by means of loadMovieNum() from Flash Player.<br />

To unload a SWF or image that was loaded with MovieClip.loadMovie(), use<br />

unloadMovie() instead of unloadMovieNum().<br />

Parameters<br />

level:Number - The level (_level N ) of a loaded movie.<br />

Example<br />

The following example loads an image into a SWF file. When you click unload_btn, the<br />

loaded content is removed.<br />

loadMovieNum("yourimage.jpg", 1);<br />

unload_btn.onRelease = function() {<br />

unloadMovieNum(1);<br />

}<br />

86 ActionScript language elements

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

Saved successfully!

Ooh no, something went wrong!