Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

flex air mobile communication with javascript

I have an educational application in which I have three components viz; android communication engine, flex content bridge and flash content. Now I have a task to replace the flash content with HTML content which will communicate with flex bridge via JavaScript. I have been trying this thing for over a week now to a avail no success.
Is it even possible to achieve that in an air mobile project (compiled for android) without any hacks?

like image 352
Harsh Vardhan Avatar asked Apr 28 '26 23:04

Harsh Vardhan


1 Answers

As Pieter suggested, this is a great treat for those looking to communicate with Javascript from Flex. But since links can break, let me explain it a bit here:

In Javascript

document.location = '$' + 'Data#As#String';

In Flex

webview.addEventListener( LocationChangeEvent.LOCATION_CHANGING,
handleLocationChanging );

function handleLocationChanging( event:LocationChangeEvent ):void
{
   event.preventDefault();

   //location parameter will have a absolute path of the .html file as a prefix
   var strParameters:Array = (e.location as String).split("$");

   trace(strParameters[1] + "Is the string received from Javascript");
}
like image 158
Harsh Vardhan Avatar answered May 01 '26 13:05

Harsh Vardhan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!