Link to home
Start Free TrialLog in
Avatar of chinu1310
chinu1310Flag for United States of America

asked on

Sending a variable from flash to flex

Hi Experts,

I am bit new to Flex. What I am trying to do is I have a flash map that I have made clickble. Now what I want to do is when I click on any state the state name should go to my flex application. Like say if I press NJ state on my flash map it should generate some event flex that flex would know that NJ state has been selected.

I am putting my flash map into the same flex application which has to be notified when any state is selected.

Thanks
CK
Avatar of Gary Benade
Gary Benade
Flag of South Africa image

Use LocalConnection.

inside your flex app init code /////////////////////////////

private var localConn:LocalConnection = new LocalConnection();
var client:Object = new Object();
client.sayHelloTo = function( s:String)
{
     trace("hello " + s);
};
localConn.client = client;
localConn.connect("myFlexConn");

to send a string to flash:
var sendConn:LocalConnection = new LocalConnection();
sendConn.send("myFlashConn", "doSomething", "hello");      


inside flash///////////////////////////////////////

var localConn:LocalConnection = new LocalConnection();
localConn.doSomething = function( s:String)
{
      trace('received ' + s);
};
localConn.connect("myFlashConn");

to send a string to flex:
var sendConn:LocalConnection = new LocalConnection();
sendConn.send("myFlexConn", "sayHelloTo", "gary");

Regards
Gary
Avatar of chinu1310

ASKER

Hi,

I had some idea about this. But the thing is say I have 10 objects in flash every containing different  id. When      a particular item is click I want to notify flex that this item is clicked and accordingly create a pop up window.

It would be better if you provide some code as I am new to flash/flex.

Regards
CK
ASKER CERTIFIED SOLUTION
Avatar of Gary Benade
Gary Benade
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Do you need anymore help with this?
Same with this.  Will try it and let you know soon.

Thanks
Do you need anymore help with this?
Need any more help on this?