Question
ExternalInterface
Here is a simple Flex sample. It complied fine and display
fine.
When I click the button, It suppose to give me the alert message.
But it give me nothing.
Can anyone help?
Thanks,
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx=" http://www.adobe.com/2006/mxml"
width="300" height="200"
horizontalAlign="center" verticalAlign="middle"
viewSourceURL="src/HandlingEventsEventHandler/index.html"
>
<mx:Script>
<![CDATA[
import flash.events.MouseEvent;
import flash.external.*;
private function clickHandler ( event:MouseEvent ):void
{
myLabel.text = ExternalInterface.call("alert", "TEST FLASH");
}
]]>
</mx:Script>
<mx:Panel
title="My Application" horizontalAlign="center"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"
>
<mx:Label id="myLabel" width="180" fontWeight="bold" fontSize="24"/>
<mx:Button id="myButton" label="Go Get Google!" click="clickHandler(event);" />
</mx:Panel>
</mx:Application>
When I click the button, It suppose to give me the alert message.
But it give me nothing.
Can anyone help?
Thanks,
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx=" http://www.adobe.com/2006/mxml"
width="300" height="200"
horizontalAlign="center" verticalAlign="middle"
viewSourceURL="src/HandlingEventsEventHandler/index.html"
>
<mx:Script>
<![CDATA[
import flash.events.MouseEvent;
import flash.external.*;
private function clickHandler ( event:MouseEvent ):void
{
myLabel.text = ExternalInterface.call("alert", "TEST FLASH");
}
]]>
</mx:Script>
<mx:Panel
title="My Application" horizontalAlign="center"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"
>
<mx:Label id="myLabel" width="180" fontWeight="bold" fontSize="24"/>
<mx:Button id="myButton" label="Go Get Google!" click="clickHandler(event);" />
</mx:Panel>
</mx:Application>