|
I don't think that bindings works on singleton instance
syntax.
TestLocator.as
---------------------
package {
public class TestLocator { private static var testLocator:TestLocator; public var someProperty:String; public static function getInstance():TestLocator { if(testLocator == null) testLocator = new TestLocator(); return testLocator; } public function TestLocator() { this.someProperty = "Some value"; } } } Test.mxml
-----------------
<?xml version="1.0" ?>
<mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml" xmlns="*"> <mx:Script>
<![CDATA[ import TestLocator; private function onChangeClick():Void { TestLocator.getInstance().someProperty = 'Some other value'; } ]]> </mx:Script> <mx:Label
text="{TestLocator.getInstance().someProperty}" />
<mx:Button label="Change value" click="onChangeClick()"
/>
</mx:Application>
Anyway, I'll wait for the release of Cairngorm for Flex2.0
to see how Steven and Allistair did this part of their
framework.
Thanks.
Benoit Hediard De : [email protected] [mailto:[EMAIL PROTECTED] De la part de Matt Chotin Envoyé : lundi 24 octobre 2005 19:39 À : [email protected] Objet : RE: [flexcoders] Implementing ModelLocator pattern in AS3/Flex2 I havent investigated
this for real but you may need to turn ModelLocator into a singleton so that
theres an instance of an object to watch. Because were doing code-gen
and not prototype hacking its impossible to make a Class object an
EventDispatcher. The singleton approach would allow us to use the code-gen
and then youd simply bind to ModelLocator.getInstance().myModel instead of
ModelLocator.myModel. Matt From:
Make the objects in the Model Locator
typed.... by importing the classes you need to ref. On 10/21/05, Benoit Hediard <[EMAIL PROTECTED]>
wrote: Since it is not possible to create
bindings to static properties, how do you implement the ModelLocator pattern in
AS3? Benoit
Hediard PS: by the way, any information on
an alpha release of Cairngorm for Flex2.0?
YAHOO! GROUPS
LINKS
-- 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
|
- RE: [flexcoders] Implementing ModelLocator pattern in AS... Benoit Hediard
- Re: [flexcoders] Implementing ModelLocator pattern ... Clint Modien
- RE: Re: [flexcoders] Implementing ModelLocator ... Benoit Hediard
- RE: [flexcoders] Implementing ModelLocator pattern ... Battershall, Jeff
- RE: [flexcoders] Implementing ModelLocator pattern ... Battershall, Jeff
- RE: [flexcoders] Implementing ModelLocator pattern ... Battershall, Jeff
- RE: [flexcoders] Implementing ModelLocator pattern ... Jeff Tapper
- Re: [flexcoders] Implementing ModelLocator pattern ... Weyert de Boer

