You must be logged in to post Login Register
Search 

Loading A Single Image Via XML

User Post

12:53 pm
April 30, 2009


Eldian

New Member

posts 2

1

Post edited 7:57 pm – April 30, 2009 by Eldian
Post edited 7:57 pm – April 30, 2009 by Eldian
Post edited 7:58 pm – April 30, 2009 by Eldian


Hey Smonte can you please help me with this one. I am trying to load a single image to the stage via a XML.

XML file and image file are in the same folder as the fla file.

Here is my XML file



     image1.jpg

Here is my actionscript code.


var urlLoader:URLLoader = new URLLoader();
urlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
var xmlData:XML = new XML();

function xmlLoaded(e:Event):void{
  xmlData = new XML(e.target.data);
 
  var picLoader:Loader = new Loader();
  var picRequest:URLRequest = new URLRequest(xmlData.pictures.pic[0]);
  picLoader.load(picRequest);
  addChild(picLoader);
}

urlLoader.load(new URLRequest(”logo.xml”) );

I keep getting this error.


TypeError: Error #2007: Parameter url must be non-null.
    at flash.display::Loader/_load()
    at flash.display::Loader/load()
    at picture_fla::MainTimeline/xmlLoaded()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()

12:55 am
May 1, 2009


smonte

Admin

posts 27

2

Hey,


Try to modify the URLRequest to this:


var picRequest:URLRequest = new URLRequest(xmlData.pic[0]);

Hope it works!


Regards,

smonte

Regards, smonte

6:43 am
May 1, 2009


Eldian

New Member

posts 2

3

Smonte you are the man. Cool

It works, really appreciate the help!!! Smile

Topic RSS 
Search