Ben,

 

Your variables inside your TestModel souldn’t be static except for your modelLocator holder.

When you do myModelLocator.getInstance() this function returns an unique instance  of your modelLocator.

 

João Fernandes
Dep. Informática - Área de Desenvolvimento
Cofina media

Avenida João Crisóstomo, Nº 72 . 1069-043 Lisboa PORTUGAL
Tel (+351) 213 185 200 . Fax (+351) 213 540 370
[EMAIL PROTECTED]

 

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of ben.clinkinbeard
Sent: segunda-feira, 3 de Julho de 2006 17:00
To: [email protected]
Subject: [flexcoders] Re: Cairngorm 2 - Data binding will not be able to detect assignments...

 

Whoops. Updated code, which now produces an error concerning "Access
of a possibly undefined property 'name' through a reference with
static type TestModel. My label tag now looks like this:

<mx:Label x="130" y="136" text="{TestModel.getInstance().name}"
id="testLabel"/>

And the TestModel class is updated to look like the sample in the
documentation:

package
{
import com.adobe.cairngorm.model.ModelLocator;

[Bindable]
public class TestModel implements ModelLocator
{
public static var name:String;
private static var modelLocator : TestModel;

public static function getInstance() : TestModel
{
if ( modelLocator == null )
modelLocator = new TestModel();

return modelLocator;
}

public static function initialize():void
{
name = "Some text";
}
}
}

__._,_.___

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