PDA

View Full Version : noob Q


mojito
07-03-2008, 11:38 AM
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script><![CDATA[

import Model;
import Controller;

private var Mo:Model = Model.getInstance();
trace(M);

]]></mx:Script>
</mx:Application>

just trying some real basic stuff...the trace is creating an error here,

Error: Access of undefined property Mo.:confused:

matlevy
07-03-2008, 01:45 PM
your trace function needs wrapping in a function and attaching to a listener in your mxml
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="foo(event)">
<mx:Script><![CDATA[

import Model;
import Controller;

private var Mo:Model = Model.getInstance();

private function foo(e:Event):void
{
trace('whatever')
}

]]></mx:Script>
</mx:Application>