Here’s a quick illustration, hope it is helpful.

 

Command ->

public function result(re:*):void {

            ModelLocatorgetInstance().myviewmodel.myXMLParser( re.result );

}

 

ModelObject ->

[Binadble]

class MyViewModel {

            public function myXMLParser(val:XML):void {

                        // parser logic

                        view_xml = parsedData;

            }

            public var view_xml:*;

}

 

View ->

<view:MyComponent dataProvider="{model.myviewmodel.view_xml}" />

 

Regards,

 

Bjorn Schultheiss

Senior Flash Developer

QDC Technologies

 

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Jamie O
Sent: Wednesday, 8 November 2006 11:20 AM
To: [email protected]
Subject: [flexcoders] Re: cairngorm: calling a function in a view

 

I'm sorry, I think you might have just broke my brain :( Or maybe my
grasp on Cairngorm isn't quite as strong as I thought it. The root of
my understanding is based on Jesse (JesterXL)'s example with quite a
few modifications.

I built the parse() method inside the component as it would get into
nested arrays and storing a lot of variables in the global program
that don't have value to do it the other way. Plus, from an OO
perspective I think that is more sound, I can give the SWC to another
developer along with sample XML format to provide to it. Make sense no?

Part of this may be the 'many ways to skin a cat' challenge that
Cairngorm is more a frame on which to hang your code rather than
something that forces you to program in a particular manner.

Any samples of methods on the model and calling components / their
getters / setters from views would be valuable.

Thx,
Jamie

--- In [email protected], "Bjorn Schultheiss"
<[EMAIL PROTECTED]> wrote:
>
> Ideally your pase() method should be on the model, with the view
only used
> to render passed data via databinding the parsed value from the
model to the
> dataprovider of the view.
>
>
>
> Regards,
>
>
>
> Bjorn Schultheiss
>
> Senior Flash Developer
>
> QDC Technologies
>
>
>
> From: [email protected] [mailto:[email protected]] On
> Behalf Of Jamie O
> Sent: Wednesday, 8 November 2006 9:57 AM
> To: [email protected]
> Subject: [flexcoders] Re: cairngorm: calling a function in a view
>
>
>
> I believe Observe / Value is what I want to use for a current
> challenge, but try as I might, I just cannot seem to wrap my head
> around it. Hoping someone could take another kick at the cat to
> explain it in context of the following situation:
>
> My component (SWC) is defined inside a view and has a public property
> that is databound to my modelLocator for it's XML source. When the
> right data conditions are met internally it broadcasts an addressEvent
> with all user selected data.
> <pcall:pcall id="PointofCall" left="10" top="50"
> postcodeXML="{ModelLocator.getInstance().PointOfCall.postcodeXML}"
> AddressEvent="AddressEventHandler(event)" />
>
> When the user provides input data, I broadcast a search event and
> receive the updated XML from the services / delegator. There is a
> public method - currently titled Update() - in the component to parse
> the XML and build up it's display accordingly. Within the view I can
> bind a button to that Update() function and the parsing goes smooth.
>
> <mx:Button x="333" y="10" label="Button"
click="{PointofCall.Update()}"/>
>
> But the problem is that I only know when the data is updated in the
> onResult method of my command that sent the data off in the first place.
>
> How do I - in a command - trigger the method of a component on a view?
>
> Thanks,
> Jamie
>
> --- In [email protected]
<mailto:flexcoders%40yahoogroups.com> ,
> "Tim Hoff" <TimHoff@> wrote:
> > > Hi Alex,
> > >
> > > Thank you very much for addressing this topic in your blog. Using
> > > observe and ObserveValue seems much cleaner than
> > > viewLocator/viewHelper; more direct and less classes. Your
> > examples
> > > illustrate a very useful technique for manipulating local view
> > > states through binding. I wasn't however, able to view the source
> > > for Iteration6. It shows a partial listing of the application mxml
> > > class, but no other classes and download options.
> > >
> > > Kudos,
> > > -TH
>

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to