Question
Need Help With AS3
I'm creating a graphic loader at runtime but I can't set the
height or width of the loader. I can set the x and y but when I put
the code for height and width the graphic doesn't display. I don't
get any errors, it just doesn't display. Here is the code:
var mainXML:XML;
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onComplete);
loader.load(new URLRequest("CBT_Template.xml"));
var smartGraphicLoader:Loader = new Loader();
var smartGraphicFile:String = "tough love";
var smartGraphicFileReq:URLRequest;
function onComplete(evt:Event)
{
mainXML = new XML(loader.data)
tb.htmlText = mainXML.CBT_Template[0].objective;
tl.htmlText = mainXML.CBT_Template[0].objective;
tb1.text = mainXML.CBT_Template[0].header;
tb2.text = mainXML.CBT_Template[0].explanation;
ta.htmlText = mainXML.CBT_Template[0].objective;
LoadSmartGraphic();
}
function LoadSmartGraphic() {
smartGraphicFile = mainXML.CBT_Template[0].graphic;
//OurTextBox.htmlText = lessonInfoXML.lesson[0].segment[0].page[CurrentPage - 1].explanation;
smartGraphicFileReq = new URLRequest(smartGraphicFile);
//smartGraphicLoader.addEventListener(Event.COMPLETE, completeHandler);
smartGraphicLoader.load(smartGraphicFileReq);
addChild(smartGraphicLoader);
//trace(smartGraphicFile);
smartGraphicLoader.x = 0;
smartGraphicLoader.y = 0;
smartGraphicLoader.height = 50; //here is where the code prevents the graphic from loading.
smartGraphicLoader.width = 50; //it works fine without these two lines but i need to set the height and width
var mainXML:XML;
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onComplete);
loader.load(new URLRequest("CBT_Template.xml"));
var smartGraphicLoader:Loader = new Loader();
var smartGraphicFile:String = "tough love";
var smartGraphicFileReq:URLRequest;
function onComplete(evt:Event)
{
mainXML = new XML(loader.data)
tb.htmlText = mainXML.CBT_Template[0].objective;
tl.htmlText = mainXML.CBT_Template[0].objective;
tb1.text = mainXML.CBT_Template[0].header;
tb2.text = mainXML.CBT_Template[0].explanation;
ta.htmlText = mainXML.CBT_Template[0].objective;
LoadSmartGraphic();
}
function LoadSmartGraphic() {
smartGraphicFile = mainXML.CBT_Template[0].graphic;
//OurTextBox.htmlText = lessonInfoXML.lesson[0].segment[0].page[CurrentPage - 1].explanation;
smartGraphicFileReq = new URLRequest(smartGraphicFile);
//smartGraphicLoader.addEventListener(Event.COMPLETE, completeHandler);
smartGraphicLoader.load(smartGraphicFileReq);
addChild(smartGraphicLoader);
//trace(smartGraphicFile);
smartGraphicLoader.x = 0;
smartGraphicLoader.y = 0;
smartGraphicLoader.height = 50; //here is where the code prevents the graphic from loading.
smartGraphicLoader.width = 50; //it works fine without these two lines but i need to set the height and width