From: ooba on 9 Jan 2008 08:54 Using the code below I am loading in an external image. Loads just fine. However everytime I am not aware of how to directly point to the image that is loaded into the MC. How am I to reference the image that is loaded in order to get the width and heigh of the image. // The clip that will hold the loaded external files var container_mc:MovieClip = this.createEmptyMovieClip("container_mc", this.getNextHighestDepth()); // The event loader that will listen for events var myMCL:MovieClipLoader = new MovieClipLoader(); var myListener:Object = new Object(); myMCL.addListener(myListener); myMCL.loadClip("image4.jpg", container_mc); /** * After the external file has loaded */ myListener.onLoadComplete = function(mc:MovieClip) { trace( ' Dynamic MC width = ' + mc._width ); trace( ' Dynamic MC height = ' + mc._height ); } // /* just some keywords for when people search this forum How to get image size How to get image width How to get image height */
From: rritchey on 9 Jan 2008 09:03 you want to use the onLoadInit() function to be able to interact with the loaded image. myListener.onLoadInit = function(mc:MovieClip) { trace( ' Dynamic MC width = ' + mc._width ); trace( ' Dynamic MC height = ' + mc._height ); } See the liveDocs for onLoadComplete here :: http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?c ontext=LiveDocs_Parts&file=00002001.html
From: ooba on 9 Jan 2008 09:10 Thank you rritchey for pointing me to onLoadInit! // All read the following snippet for understanding why to use onLoadInit over onLoadComplete /** Following is help file documented notes. */ It's important to understand the difference between MovieClipLoader.onLoadComplete and MovieClipLoader.onLoadInit. The onLoadComplete event is called after the SWF, JPEG, GIF, or PNG file loads, but before the application is initialized. At this point, it is impossible to access the loaded movie clip's methods and properties, and therefore you cannot call a function, move to a specific frame, and so on. In most situations, it's better to use the onLoadInit event instead, which is called after the content is loaded and fully initialized.
|
Pages: 1 Prev: Unexpected File Format Next: Win projector fullscreen problem |