Hang Calling function after Document Class' Event.ADDED
i trying load external swf (that contains below code in document class) loader class keep on receiving error #1009: cannot access property or method of null object reference. tried use event listener event.added in mydocumentclass constructor of external swf let document class part of display list before invoke createrandomgraph. when place createrandomgraph( ) inside onstageready, compilation process hangs. when leave createrandomgraph( ) inside constructor, works stand alone produce error 1009 if loaded within loader swf. ideas?
public function mydocumentclass( )
{
this.addeventlistener(event.added, onstageready);
createrandomgraph( )
}
private function onstageready(oevent:event):void
{
this.removeeventlistener(event.added, onstageready);
}
private function createrandomgraph( ):void
{
var crandomgraph:randomgraph = new randomgraph();
crandomgraph.x = 10;
crandomgraph.y = stage.stageheight - nh - 25;
crandomgraph.setdimensions(nw,nh);
crandomgraph.creategraphbackground();
this.addchild(crandomgraph);
}
use:
public function mydocumentclass( )
{
this.addeventlistener(event.added_to_stage, onstageready);
}
private function onstageready(oevent:event):void
{
this.removeeventlistener(event.added, onstageready);
createrandomgraph();
}
private function createrandomgraph( ):void
{
var crandomgraph:randomgraph = new randomgraph();
crandomgraph.x = 10;
crandomgraph.y = stage.stageheight - nh - 25;
crandomgraph.setdimensions(nw,nh);
crandomgraph.creategraphbackground();
this.addchild(crandomgraph);
}
More discussions in ActionScript 3
adobe
Comments
Post a Comment