import flash.net.URLLoader;
import flash.events.Event;
import flash.net.URLRequest;
import flash.display.Sprite;
import flash.display.Loader;
var currentContainer:Sprite;
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
xmlLoader.addEventListener(Event.COMPLETE, loadXML);
xmlLoader.load(new URLRequest('advertimageloader.xml'));
function loadXML(e:Event):void
{
xmlData = new XML(e.target.data);
trace(xmlData);
trace(xmlData.image[0].filename);
imageData = new XML(xmlData.image[0].filename);
trace(imageData);
var url:String = imageData;
trace("URL: "+url);
var urlRequest:URLRequest = new URLRequest(url);
var imag:Loader = new Loader();
imag.load(urlRequest);
addChild(imag);
}
When I add imag.width or imag.height, the area the image should be loaded goes black... I think it has something to do with adding it to the stage as a bitmap but I'm unsure how to implement that from where I am now... Can anybody help?
Edit: Without the imag.width or imag.height, it shows fine but if the image loaded is too big or two small it wont take the full space I'd like it to, as it would.
Added "NEED HELP:" to title to show it as a question and not a tutorial. Added "In AS3" to indicate it's in AS3.