The FABridge relies on the ability to introspect actionscript types and
create proxies in javascript for classes, methods. and properties on the
fly. Since Model is dynamic it can't be introspected by the current
bridge behavior, so you can't manipulate it directly through the Bridge.
 
You have three options:
 
1) the bridge has low level APIs for setting and getting properties, and
calling methods, on an arbitrary object reference.  You can see if using
these to access members of the model fixes your problem.
 
2) if you know in advance what type of manipulations you want to do to
your model, you can write methods in your application to do them, and
call those (with parameters) from your javascript.
 
3) use a strongly typed class based model rather than the generic model
tag.
 
Ely.
 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Private Romeo
Sent: Monday, February 19, 2007 7:17 AM
To: [email protected]
Subject: [flexcoders] Accessing a Flex Model via JavaScript (FABridge)



I've got the following model in my MXML app (bound to a column chart
control):

 

<mx:Model id="sampleData">

<items>

              <item>

                    <Month>January</Month>

                    <Sales>1000</Sales>

                    <People>3</People>

              </item>

              <item>

                    <Month>February</Month>

                    <Sales>1200</Sales>

                    <People>5</People>

              </item>

       </items>

</mx:Model>

 

and by using the FABridge I want to change the data within JavaScript:

 

flexApp.getMyLabel().setText("Updated via JavaScript!");

var sampleData = flexApp.getSampleData();

sampleData[1].Sales=50;

 

however the last line seems to not work. How do I make it work?

 

Your help is greatly appreciated.

 

R.

 

Reply via email to