Re: [flexcoders] Re: How to call container's method into component file

2011-08-28 Thread Tandon, Rishi
That's true Tim, even we use MVC framework and 
Event propagation to achieve such kind of mechanism.
But for novice user, they can try that too.
Although not the best way.



From: turbo_vb 
To: flexcoders@yahoogroups.com
Sent: Sunday, August 28, 2011 10:20 PM
Subject: [flexcoders] Re: How to call container's method into component file


  
That's bad advice Rishi; that leads to tight coupling and "parent abuse".  It's 
ok to have a parent call a method on a child ( data binding is preferred 
though).  But, children shouldn't call methods directly on their parents.  
Instead, have the child component dispatch an event to initiate the save method 
on the parent.

-TH

--- In flexcoders@yahoogroups.com, Rishi Tandon  wrote:
>
> Use object oriented best practice.
> Mxml I'd nothing but a actionscript class.
> If u r initializing  the custom component inside the other component, then u 
> can directly access the method or else use the 
> Application.application.componentiD.methodName if u are 
> Where are u initializing globally.
> 
> Sent from my iPhone
> 
> On Aug 28, 2011, at 2:21 AM, "shail"  wrote:
> 
> > Hi Group,
> > 
> > I have a customize container component in which i am using one 
> > sub-component. The customize container has one overriden method save(), i 
> > want to call this method in subcomponent. Can this be possible?
> > 
> > my code looks like this -
> > 
> > GraphDex.mxml
> > 
> > 
> > overrides public void save(){
> > //plz ignore syntex
> > }
> > 
> > 
> > 
> > 
> > 
> > Here I want to call mentioned save() method in Dex component that contain 
> > some graphs, so on click event of Dex graphs i want to call save 
> > functionality.
> > 
> > As being new bee,Please suggest if my approach is wrong.
> > 
> >
>


 

[flexcoders] Re: How to call container's method into component file

2011-08-28 Thread turbo_vb
That's bad advice Rishi; that leads to tight coupling and "parent abuse".  It's 
ok to have a parent call a method on a child ( data binding is preferred 
though).  But, children shouldn't call methods directly on their parents.  
Instead, have the child component dispatch an event to initiate the save method 
on the parent.

-TH

--- In flexcoders@yahoogroups.com, Rishi Tandon  wrote:
>
> Use object oriented best practice.
> Mxml I'd nothing but a actionscript class.
> If u r initializing  the custom component inside the other component, then u 
> can directly access the method or else use the 
> Application.application.componentiD.methodName if u are 
> Where are u initializing globally.
> 
> Sent from my iPhone
> 
> On Aug 28, 2011, at 2:21 AM, "shail"  wrote:
> 
> > Hi Group,
> > 
> > I have a customize container component in which i am using one 
> > sub-component. The customize container has one overriden method save(), i 
> > want to call this method in subcomponent. Can this be possible?
> > 
> > my code looks like this -
> > 
> > GraphDex.mxml
> > 
> > 
> > overrides public void save(){
> > //plz ignore syntex
> > }
> > 
> > 
> > 
> > 
> > 
> > Here I want to call mentioned save() method in Dex component that contain 
> > some graphs, so on click event of Dex graphs i want to call save 
> > functionality.
> > 
> > As being new bee,Please suggest if my approach is wrong.
> > 
> >
>