| |||||||||||||||||||||||||||||||
|
underneath the top one (last loaded)? John ----- Original Message ----- From: <flash> To: <flashcoders> Sent: Tuesday, May 06, 2008 5:54 PM Subject: [Flashcoders] AS3 For loop proplem This code should load a MovieClip from the library 5 times, place each on the stage and then load a different image into each one Instead it loads the 5 MovieClips from the library, places them on the stage and then only loads the image into the last (5th) MovieClip, whats going wrong? !!!! this code will not run as its stripped !!!! var itemList:XMLList = locationInfo.item; for (var i = 0; i < itemList.length(); i++) // Loops through 5 times { _summaryElement[i] = loadLibrary(summaryContainer); // Load our MovieClip from the library loadImage("images/" + i + ".jpg", _summaryElement[i].sumImg); // Should load image into _summaryElement[i].sumImg which is a blank placeholder movieclip } function loadImage(filename:String, mcName:MovieClip):void { _mcName = mcName; // Contains MovieClip object (object 1 through 5) var imageLoader:Loader = new Loader(); var imageURL:URLRequest = new URLRequest(filename); imageLoader.load (imageURL); imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imgLoadComplete); } function imgLoadComplete(ev:Event):void { _mcName.addChild(ev.target.content); // This should add the loaded image into the placeholder movieclip for each of the 5 MovieClips } SJM _______________________________________________ Flashcoders mailing list Flashcoders http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list Flashcoders http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
| ||||||||||||||||||||||||||||||
© 2004-2008 readlist.com