If an instance is state-dependent (includeIn, excludeFrom), then it might not be there at creationComplete, but otherwise it should be. Just as a test, try setTimeout and/or click a button that calls that code to prove it really is a timing issue. It could be something else.
-Alex On 2/18/16, 7:28 AM, "Weber Jan" <[email protected]> wrote: >Hello, > >we have a a project which makes use of the code behind pattern for MXML >and AS files. >The application has an AS class of type s:Window and an MXML file which >is based on that AS class. > >Adding an EventListener "FlexEvent.CREATION_COMPLETE" in the constructor >of the AS Window class and referring from there to elements which are in >the MXML file (which are defined as public vars in the AS class) results >in TypeError #1009 / NullPointer Reference. >I would assume, that when the Window fires its creation complete event, >all children are available for reference. >In the constructor, we have set "creationPolicy" to "all" and also tried >to call "createDeferredContent" and "createChildren" but no luck with >these calls. >Also, no luck with the event "AIREvent.WINDOW_COMPLETE". Elements are >null after the callback is triggered. >Referring elements with CallLater after CreationComplete does also not >work. > >What is the correct way to refer to elements in the MXML from the AS base >class? >I would hardly want to use setTimeout to refer to elements. > >Any suggestions on this? > >Thanks, >Jan > > > > > > >Mit freundlichen Gr??en / Best Regards >i.A. Jan Weber >Software Development > > > > > >Contact: > > >Location: > > >Head & Accounts Office: > > >tel > > >+49 941 8700 326 > > >Bahnhofstr. 16 > > >Cranachweg 1 > > >fax > > > > > >93047 Regensburg > > >93051 Regensburg > > >mail > > >[email protected]<mailto:[email protected]> > > >Germany > > >Germany > > >[banner] ><http://www.dallmeier.com/index.php?id=1054> > > >Subscribe to our Newsletter<http://www.dallmeier.com/index.php?id=322&L=1> > > >www.dallmeier.com<http://www.dallmeier.com/en/home.html> > > >Social Media<http://www.dallmeier.com/index.php?id=292&L=1> > > >Dallmeier electronic GmbH & Co.KG > >CEO: >Registry Court: >VAT ID: >Unlimited Partner: >Registry Court: > > > Dieter Dallmeier > Amtsgericht Regensburg HRA 6827 > DE813790649 > Dallmeier GmbH > Amtsgericht Regensburg HRB 9085 > > > >
