ViewLocator allows you to get an instance of a viewHelper from another
file within your app.
Ex:
Lets say I have a view named Contacts.mxml and have registered a
viewHelper like this:
<view:ContactsViewHelper id="contactsViewHelper" />
I can then get a reference to my viewHelper from any file (command, etc):
var contactsViewHelper:ContactsViewHelper =
ContactsViewHelper(ViewLocator.getInstance().getViewHelper("contactsViewHelper"));
You can see more of this in on of my older samples at:
http://www.everythingflex.com/blog/1/2005/06/20.Cairngorm-99--Hibernate-3.cfm
Rich
On 12/21/05, JesterXL <[EMAIL PROTECTED]> wrote:
> I can answer the ModelLocator one.
>
> ModelLocator is basically a class that holds all of your data. It acts like
> a Singleton, and "Singleton is the new _global!"
>
> So, where you are used to putting data on _global:
>
> _global.my_array = [];
>
> You instead put it on ModelLocator:
>
> ModelLocator.my_array = [];
>
> Secondly, since it's a static class instance, you can use it in any class
> file:
>
> import ModelLocator;
>
> <mx:TextArea text="{ModelLocator.myText}" />
>
> The key point, however, is that Flex supports binding better than Flash
> does, and it's easy. If you notice in the above line, I use "{}" brackets
> around the variable. This is shorthand binding. The TextArea will show the
> value of ModelLocator.myText, and anytime ModelLocator.myText's value
> changes, the TextArea will update.
>
> Since you can pretty much bind to any datatype, this is a wondeful way to
> bind your View's to data vs. calling set methods, etc.
>
>
> ----- Original Message -----
> From: "Antoine" <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Wednesday, December 21, 2005 10:13 AM
> Subject: [flexcoders] Newbie Question.
>
>
> Hi,
> Flash Developer since about 3 years now, i'm currently working on a
> classical Flex Store prototype, integrating it with ATG Dynamo 6.4.
> We are trying to use the Cairngorm Framework, and i've read the
> "ActionScript Design Patterns for Rich Internet application
> development" PDF iteration::two provides on its website and the 0.99
> release notes.
>
> The fact is that i have some problems understanding the new concept
> that appeared in Cairngorm 0.99 : ModelLocator and ViewLocator (its
> not really explained in the previous documents :/) and how to use them.
>
> Is there any documentation, crystal-clear explainations and cool uml
> schemas i can work on so i can become a killer-flex-developper in 2
> days?:)
>
> more seriously, i'm really in need of some explainations on this (and
> sorry if the question has been posed hundred of times).
>
> Thanks to anyone who can give me a clue,
>
> Antoine
>
>
>
>
>
>
>
>
>
>
>
> --
> 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
>
>
>
>
>
>
>
>
> --
> 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
>
>
>
>
>
>
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
Most low income homes are not online. Make a difference this holiday season!
http://us.click.yahoo.com/5UeCyC/BWHMAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~->
--
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
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/