Title: Mensagem

Your problem is that the Composition’s initialize and creationComplete events will fire before the Application initialize event.  Most components initiate all of their components in their own init and it is not until they are finished that they will fire the initialize event.

 

You could just remove the initialize method in your application and instead just set the model member.  It will then set it before the Application’s constructor is even called.

 

var model:CompositionModel = new CompositionModel();

 


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Matt Chotin
Sent: Tuesday, October 04, 2005 7:57 PM
To: [email protected]
Subject: RE: [flexcoders] Getting a null object reference

 

Hmm, I don’t have time to dig but generally that should work I’d think.  What if you put a button in Composition.mxml that calls initialize() and see if it’s not null then.  Clearly this is just an ordering problem but I can’t tell why off the top of my head.

 


From: [email protected] [mailto:[email protected]] On Behalf Of Michel Bertrand
Sent: Tuesday, October 04, 2005 11:21 AM
To: [email protected]
Subject: RES: [flexcoders] Getting a null object reference

 

Thank you for your suggestion ... I changed to creationComplete, but still not working ...

-----Mensagem original-----
De: [email protected] [mailto:[email protected]] Em nome de Matt Chotin
Enviada em: terça-feira, 4 de outubro de 2005 01:32
Para: [email protected]
Assunto: RE: [flexcoders] Getting a null object reference

Try using creationComplete in your Composition.mxml instead of initialize and see if that works.

 

Matt

 


From: [email protected] [mailto:[email protected]] On Behalf Of Michel Bertrand
Sent: Monday, October 03, 2005 11:45 AM
To: [email protected]
Subject: [flexcoders] Getting a null object reference

 

Hi !

I'm trying to do the following:

<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
                                xmlns:framework="com.datasul.framework.ui.template.view.*"
                                width="100%" height="100%"
                                initialize="initialize()">
       
        <mx:Script>
        <![CDATA[
                import com.datasul.framework.ui.template.model.CompositionModel;
               
                var model:CompositionModel;
       
                function initialize() : Void {
                        model = new CompositionModel();
                }
        ]]>
        </mx:Script>

        <framework:Composition width="100%" height="100%">
                <framework:model>{this.model}</framework:model>
        </framework:Composition>

</mx:Application>

I would like to bind the value of "model" with the "model" property of the Composition component. Like:

"Composition.mxml"
<mx:Canvas xmlns:mx="http://www.macromedia.com/2003/mxml" initialize="initialize()" width="100%" height="100%">
        <mx:Panel id="mainPanel">
                <mx:Script>
                <![CDATA[
                        import com.datasul.framework.ui.template.model.CompositionModel;

                        var model:CompositionModel;

                        function initialize(): Void {
                                if ( model == undefined ) {
                                        mx.controls.Alert.show("MODEL = NULL");
                                }
                        }
                ]]>
                </mx:Script>

         ..................

        </mx:Panel>
</mx:Canvas>

Everytime I run the code I get a message saying "MODEL = NULL". Why I don't have an
object instance since model has been already instantiated ?

Any help or suggestion will be very appreciated.

Thanks in advance !
Michel.

 





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to