RE: [flexcoders] Accessing a Flex Model via JavaScript (FABridge)

2007-02-19 Thread Ely Greenfield
 
 
 
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: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Private Romeo
Sent: Monday, February 19, 2007 7:17 AM
To: flexcoders@yahoogroups.com
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

MonthJanuary/Month

Sales1000/Sales

People3/People

  /item

  item

MonthFebruary/Month

Sales1200/Sales

People5/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.

 



RE: [flexcoders] Accessing a Flex Model via JavaScript (FABridge)

2007-02-19 Thread Private Romeo
Ely,

 

Thanks for clarification. Maybe we are contemplating the wrong approach here
and you can be of some more general help.

 

We want to manipulate data bound to a Flex Charting Column Control from
outside the Flash movie. Therefore we consider calling a method in the Flash
movie via the FABridge and pass along the changed data. This is, where we
run into problems as we do not seem to get the right data types.

 

Could a multi-dimensional JavaScript Array do? What would be your advice to
reach our above described objective?

 

Best regards

Ralf

 

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Ely Greenfield
Sent: Montag, 19. Februar 2007 18:02
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Accessing a Flex Model via JavaScript (FABridge)

 

 

 

 

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: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Private Romeo
Sent: Monday, February 19, 2007 7:17 AM
To: flexcoders@yahoogroups.com
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

MonthJanuary/Month

Sales1000/Sales

People3/People

  /item

  item

MonthFebruary/Month

Sales1200/Sales

People5/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.