I succeed to display the menu (ContextMenu AS3 class) but associated events (ContextMenuEvent.MENU_SELECT and ContextMenuEvent.MENU_ITEM_SELECT) don't work with IE >= 8 and Chrome >= 12:
AS file :
package
{
import flash.display.*;
import flash.ui.*;
import flash.events.*;
开发者_高级运维public class TestContextMenu extends MovieClip
{
private var _contextMenu : ContextMenu;
public function TestContextMenu()
{
_contextMenu = new ContextMenu();
_contextMenu.addEventListener(ContextMenuEvent.MENU_SELECT, function (event : ContextMenuEvent) : void {
trace('Menu displayed');
});
var menuItem : ContextMenuItem = new ContextMenuItem('Item 1');
menuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, function (event: ContextMenuEvent) : void {
trace('Menu item selected');
});
_contextMenu.customItems.push(menuItem);
contextMenu = _contextMenu;
}
}
}
Embed code :
<object style="height: 390px; width: 640px">
<param name="movie" value="menu.swf">
<param name="allowFullScreen" value="true">
<param name="allowScriptAccess" value="always">
<embed src="menu.swf" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="390">
</object>
Anyone knows why ? And how can I solve it ?
Thanks
The html tags required to embed an swf file are different for some browsers.
Firefox, Chrome, .. use <object>
tags while IE
uses tags.
Try using SWFObject, which will handle cross browser problems for you.
It even comes with a handy generator to assist you with embedding.
Cheers
I finally found the issue :
There was 2 different versions of Flash player embedded with Chrome. I just disabled one of them (chrome://plugins). I kept the '/Library/Internet Plug-Ins/' one.
精彩评论