Flexible mobile communication with javascript

I have an educational application in which I have three components: android communication engine, flexible content modem and flash content. Now I have a challenge to replace Flash content with HTML content that will communicate with flex bridge through JavaScript. I have been trying this thing for over a week now to find success.
Is it even possible to achieve this in an aerial mobile project (compiled for android) without any hacks?

+3


source to share


2 answers


As Peter suggested, this is a great treat for anyone looking to communicate with Javascript from within 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");
}

      

+2


source


I solved my (similar) problem using Sockets, now I have a Java server that can call functions in my Air app (for automated testing purposes) I guess you could solve your problem too. If necessary, I can post a small example



0


source







All Articles