Event listener not working - proper placement or syntax?
In a Flash object I have an item (called widgit1) that I'm trying to attach an event listener to. I just want Flash to execute a JavaScript a开发者_Go百科lert though no matter where I place it on the time line, regardless of which layer and regardless of what syntax I've found none of the many MANY combinations I have tried have worked.
Here is the ActionScript I have...
widgit1.addEventListener(MouseEvent.mouseOver,ohhai);
function ohhai() {getURL("javascript:alert('oh hai!')");}
Others have mentioned the syntax error. Beyond that however you want to use ExternalInterface for communication between ActionScript and JavaScript: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html
You need to add
function ohhai(e:MouseEvent):void
{
// etc
}
精彩评论