Any component can retrieve an application parameter as
Application.application.parameter.personid. There is no point in pushing
a parameter like this down into every component. It is stored on the
Application instance and components should access it there instead of
keeping redundant copies of this information.

 

If you really want to pass it down to SiteList, you can simply declare a
public var rather than writing a setter. (BTW, setters without getters
are weird.) And if you do write a setter, the convention is to name it
personID, not setPersonID (and to name its private storage var
_personID).

 

Gordon Smith

Adobe Flex SDK Team

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Luke Vanderfluit
Sent: Tuesday, April 22, 2008 4:57 PM
To: [email protected]
Subject: Re: [flexcoders] passing parameters to components

 

Hi.

In partial answer to my own question (and not seem a complete and utter
idiot) 
here's what Im currently doing:

In my component (SiteList) I have a setter function:

private var personId:String;
public function set setPersonId(p:String):void {
personId = p;
}

In my main component:
<SiteList width="218" height="378" setPersonId="{personId}"/>

Is this the recommended way?
What are the alternatives?

Thanks again.

Kr.
Luke.

Luke Vanderfluit wrote:
> Hi.
> 
> I have a flex application that gets called from an html link and is
passed a 
> parameter. The param is personid.
> 
> I retrieve the parameter in the flex application (BrowserManager).
> So I have access to it in the main application file.
> 
> I have a number of components within the main application, that do
server 
> requests. In some of those requests I need to pass the personid (that
I have 
> retrieved from the browser url).
> 
> My question is:
> 
> What is the accepted method of passing variables (params) between
components, 
> specifically, in this case, from parent to child component?
> 
> Thanks for your responses.
> 
> Kind regards.
> Luke.
> 

-- 
Luke Vanderfluit
Analyst / Web Programmer
e3Learning.com.au
08 8221 6422

 

Reply via email to