Title: 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




YAHOO! GROUPS LINKS




Reply via email to