actionscript 3 - Is it possible to load a non-Document Class before preloader starts? -
public class framework extends movieclip { var _loadingsystem:loadingsystem; public function framework() { _loadingsystem = new loadingsystem(this); loaderinfo.addeventlistener(progressevent.progress,progresshandler); loaderinfo.addeventlistener(event.complete, completelistener); }
...
public class loadingsystem extends movieclip { public function loadingsystem(parent:displayobjectcontainer) { parent.addchild(this); mylogo.buttonmode = true; mylogo.addeventlistener(mouseevent.click, gotomysite); }
as can see, framework doc class creating _loadingsystem movieclip contains preloader graphics. when debug following error "typeerror: error #1009: cannot access property or method of null object reference." pointing mylogo.buttonmode = true;
from understand due loadingsystem not being loaded before being created in framework. there way me make work? have tried adding listeners event.added didn't work.
additional info: 3-frame fla, first empty stop, second holding assetholder movieclip, third application. have export on 2nd frame set in publishing settings, checkboxes export on 2nd frame unchecked in assets, , worked before changed export on 2nd frame setting except wasn't preloading 50% of file.
i think what's happening this:
a document class loaded in first frame, because represents swf root class , has there in first frame. now, since export other classes frame 2, imagine, loadingsystem existing beginning frame two, try instantiate in constructor of document class framework.
what try out is, create method "initialize" in framework , call timeline in frame 2. , in method stuff, in constructor of framework.
Comments
Post a Comment