PDA

View Full Version : flex & javascript


maxy83
04-28-2009, 02:27 PM
sorry for my english but i have a problem. i'm trying to use the external interface like this
private function DevPuP(event:Event):void
{
var UrlD:String = devUrl;
UrlD += Device.selectedItem.ID;
var i:String = ExternalInterface.call("OpenDevice",Device.selectedItem.ID);

}
public function initApp() : void {
ExternalInterface.addCallback("flash",myflash);
}
public function myflash(id:int):void
{
var devId:int = id;
var devAd:String = "http://capdevel.interzen.it/xmlData/dataForGrid.asp?REC_DEVICEID=";
devAd += devId + "&table=ldevice";
}
and the javascript

<script language="JavaScript" type="text/javascript">
function OpenDevice(Id) {
var w = 1024;
var h = 768;
var url = "http://capdevel.interzen.it/cache/d_1_2_0.html?HTML=1&ID=";
url += Id;
var l = Math.floor((screen.width-w)/2);
var t = Math.floor((screen.height-h)/2);
window.open(url,"","width=" + w + ",height=" + h + ",top=" + t + ",left=" + l);
callApp();
}
</script>
<script language="JavaScript" type="text/javascript">
function callApp(){
var name = "${application}";
alert(name);
name.flash(10);
}
</script>

but it does not work and i don't know why someone ca help me please...
Thank's MaX

corbo950
04-29-2009, 12:52 AM
You dont need to use javascript to do this just look up the URLLoader() in the flex documentation