Hi all,
my base class loads xml data and then creates the navigation etc in the handler method. In the handler tracing ‘this’ still returns the base class but can I cannot use this.addChild(something) to add a new MovieClip to the stage. but if I paste the same code in to the constructor or init methods then it works?? it also works if I use this.someMoveClip.addChild(something) just not directly on this? This is really confusing me, code below
package
{
import flash.display.MovieClip;
import flash.events.Event;
public class Application extends MovieClip
{
public var xmlData:XmlData;
private var _navigation:Navigation;
private var _home:HomePage;
public function Application()
{
trace('New Application');
init();
}
private function init()
{
// load the xml data
xmlData = new XmlData();
xmlData.addEventListener("onLoad", initPages);
xmlData.load('work.xml');
}
private function initPages(e:Event)
{
trace('handleXmlLoaded')
var s:Square = new Square();
s.x = 0;
s.y = 0;
this.addChild(s);
// build navigation
_navigation = new Navigation(this.navigation_mc);
}
}
}