There are much simpler ways.

 

If your two canvases are in the same mxml file(class) then they share
the the same scope and you can bind or access values directly.  If they
are implemented in different mxml files, then it is a tiny bit more
complicated.

 

Same scope

Declare an id in any mx tag you want to be able to access.  Then you can
access values by doing something like this:

in AS:

myText1.text = myText2.text; 

myText1.text = myComboBox.selectedItem.myProperty

 

Binding In mxml:

<mx:Text text="{myText2.text}" ...

<mx:Text text="{myComboBox.selectedItem.myProperty}" ...

 

If myText1 and myText2 are in different scope(different mxml files),
post, and I will explain how to do that.

 

Tracy

 

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of stlum9495
Sent: Friday, October 05, 2007 10:21 AM
To: [email protected]
Subject: [flexcoders] Passing ID from master to detail

 

Hi,

I've been programming for awhile, but am new to Flex and was wondering
what the best way of passing values from screen to screen is.

Currently, I have two canvases which have a master detail
relationship. When I click on a button in the master canvas, I want
to pass the record id to the detail canvas so that the detail canvas
can query the server for the details data. simple master detail.

To code this in flex, what I did was when the button was clicked on
the master, I saved the record id into a Local Shared Object, and when
my Detail canvas appears, I grab the id from said Local Shared Object
and make my server side request.

This works fine, but I was wondering -- is this the Best Practice way?
I haven't seen much by way of design patterns etc for flex
pages(I've seen the AS book) so was wondering if I should be doing
this differently.

Thanks

 

Reply via email to