Total Pageviews

Wednesday 15 June 2011

Load a single Image into an Empty MovieClip via XML

package 
{
    import flash.display.*;
    import flash.events.*;
    import flash.net.*;
    import flash.xml.*;
   
    public class MyClass extends MovieClip
    {
        public function MyClass()
        {
            init();
        }
       
        public function  init():void
        {
            var myXML:XML;
            var myLoader:URLLoader = new URLLoader();
            myLoader.load(new URLRequest("Image.xml"));    // Load a XML

            myLoader.addEventListener(Event.COMPLETE, processXML);           
        }

      
        Public function processXML(e:Event):void
        {
            myXML = new XML(e.target.data);
         
            var ldr:Loader = new Loader();
            ldr.load(new URLRequest(myXML.IMAGE[0]));
            mc.addChild(ldr);
        }
    }   
}

No comments:

Post a Comment

Microsoft Logo using flexbox and Reactjs

 <!DOCTYPE html> <html> <head>     <script src="https://unpkg.com/react@18/umd/react.development.js" crossori...