[flexcoders] combobox.selectedItem causing component to do 3 runs to the server

2008-06-02 Thread Luke Vanderfluit
Hi.

I have a combobox component that has a list of sites.

When I click on a site in the list, another component is populated with data 
from that site.

This is what the setup looks like in the main file:

mx:VBox id=rm
enabled={orgform.saveOrUpdateOrg == 'Update'}
label=Risk Matrix
horizontalAlign=left horizontalGap=0
SiteList id=sitelist3
siteArr={siteArr}
verticalGap=0/
RiskMatrix id=riskmatrix
site={Site(sitelist3.sites.selectedItem)}/   

/mx:VBox

So when I click on a site in the sitelist3 component, that site is sent to the 
RiskMatrix 
component.

All good.

Now in the RiskMatrix component I have a 'set' function:

[Bindable]
private var _premise:Premise;
public function set premise(p:Premise):void {
_premise = p;
if (_premise != null) {
s2.getTemplateObjects(_premise.premiseId, RM);
}   
}

This sets the premise but does everything 3 times including calling the 
server 
function: s2.getTemplateObjects(_premise.premiseId, RM)

I have a handler 'handleGetTemplateObjects()'. The handler does everything 3 
times.

Any idea why this is happening?
Ive tested other setter functions in my code and they are all calling 3 
times... why?

Thanks for any help. Kind regards.

Luke.





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


RE: [flexcoders] combobox.selectedItem causing component to do 3 runs to the server

2008-06-02 Thread Alex Harui
Maybe the way binding is set up causes a few cycles before settling
down.  If siteArr can be affected by a server access that would be one
way

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Luke Vanderfluit
Sent: Monday, June 02, 2008 6:01 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] combobox.selectedItem causing component to do 3
runs to the server

 

Hi.

I have a combobox component that has a list of sites.

When I click on a site in the list, another component is populated with
data from that site.

This is what the setup looks like in the main file:

mx:VBox id=rm
enabled={orgform.saveOrUpdateOrg == 'Update'}
label=Risk Matrix
horizontalAlign=left horizontalGap=0
SiteList id=sitelist3
siteArr={siteArr}
verticalGap=0/
RiskMatrix id=riskmatrix
site={Site(sitelist3.sites.selectedItem)}/ 
/mx:VBox

So when I click on a site in the sitelist3 component, that site is sent
to the RiskMatrix 
component.

All good.

Now in the RiskMatrix component I have a 'set' function:

[Bindable]
private var _premise:Premise;
public function set premise(p:Premise):void {
_premise = p;
if (_premise != null) {
s2.getTemplateObjects(_premise.premiseId, RM);
} 
}

This sets the premise but does everything 3 times including calling
the server 
function: s2.getTemplateObjects(_premise.premiseId, RM)

I have a handler 'handleGetTemplateObjects()'. The handler does
everything 3 times.

Any idea why this is happening?
Ive tested other setter functions in my code and they are all calling 3
times... why?

Thanks for any help. Kind regards.

Luke.

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

 



Re: [flexcoders] combobox.selectedItem causing component to do 3 runs to the server

2008-06-02 Thread Luke Vanderfluit
Hi Shaun and Alex.

Alex Harui wrote:
 Maybe the way binding is set up causes a few cycles before settling 
 down.  If siteArr can be affected by a server access that would be one way

Thanks. It was a binding prob.
I changed it to:

private var _premise:Premise;

[Bindable]
public function set premise(p:Premise):void {
trace(HOWMANYTIMES...  );
_premise = p;
if (_premise != null) { 
s2.getTemplateObjects(_premise.premiseId, RM);
}   
 }
 public function get premise():Premise {
return _premise;
 }

and now it does one single server trip!
Yes!

Kr.
Luke.

 
  
 
 
 
 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] 
 *On Behalf Of *Luke Vanderfluit
 *Sent:* Monday, June 02, 2008 6:01 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] combobox.selectedItem causing component to do 3 
 runs to the server
 
  
 
 Hi.
 
 I have a combobox component that has a list of sites.
 
 When I click on a site in the list, another component is populated with 
 data from that site.
 
 This is what the setup looks like in the main file:
 
 mx:VBox id=rm
 enabled={orgform.saveOrUpdateOrg == 'Update'}
 label=Risk Matrix
 horizontalAlign=left horizontalGap=0
 SiteList id=sitelist3
 siteArr={siteArr}
 verticalGap=0/
 RiskMatrix id=riskmatrix
 site={Site(sitelist3.sites.selectedItem)}/
 /mx:VBox
 
 So when I click on a site in the sitelist3 component, that site is sent 
 to the RiskMatrix
 component.
 
 All good.
 
 Now in the RiskMatrix component I have a 'set' function:
 
 [Bindable]
 private var _premise:Premise;
 public function set premise(p:Premise):void {
 _premise = p;
 if (_premise != null) {
 s2.getTemplateObjects(_premise.premiseId, RM);
 }
 }
 
 This sets the premise but does everything 3 times including calling 
 the server
 function: s2.getTemplateObjects(_premise.premiseId, RM)
 
 I have a handler 'handleGetTemplateObjects()'. The handler does 
 everything 3 times.
 
 Any idea why this is happening?
 Ive tested other setter functions in my code and they are all calling 3 
 times... why?
 
 Thanks for any help. Kind regards.
 
 Luke.
 
 -- 
 Luke Vanderfluit
 Analyst / Web Programmer
 e3Learning.com.au
 08 8221 6422
 
 


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