flex tree 添加右键菜单
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" fontSize="12">
<mx:Script>
<!--[CDATA[
import mx.controls.Alert;
public var newBuildMenuItem:ContextMenuItem;//菜单项变量
private function init(): void//初始化函数
{
createTreeMenuItem();
tree.contextMenu = getTreeContxtMenu();
}
public function createTreeMenuItem(): void//菜单项创建函数,并添加菜单监听器
{
newBuildMenuItem = new ContextMenuItem("新建");
newBuildMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, newBuildHandler2);
}
private function getTreeContxtMenu(): ContextMenu//将菜单项目添加到菜单中
{
var contextMenu: ContextMenu = new ContextMenu();
contextMenu.hideBuiltInItems();
contextMenu.customItems.push(newBuildMenuItem);
return contextMenu;
}
public function newBuildHandler2(event:Event):void//点击菜单执行函数
{
Alert.show("这是新建的菜单点击后执行的函数");
}
]]-->
</mx:Script>
<mx:Tree id="tree" x="31" y="10" creationComplete="init()"></mx:Tree>
</mx:Application>
为tree添加右键菜单,也可为其他任何控件添加,但暂时没法去除右键自带的菜单项,虽然网上有办法去掉,但是感觉麻烦,大家又好办法提出来啊
相关文档:
中文在线帮助文档:http://livedocs.adobe.com/flex/3_cn/langref/
http://examples.adobe.com/flex3/componentexplorer/explorer.html。
其他网站:
http://bbs.actionscript3.cn
http://www.airia.cn
http://www.anyflex.cn/bbs
http://www.5uflash.com/flex-air
http://www.52ria.com
http:// ......
1.将flex编译后的程序插入到asp.net页面
flex的最终输出就是一张网页+一个flash(.swf文件)
这么说你明白了吧,其实就是用他生成的网页的方式把那个.swf文件插入到你的asp.net页面就可以了。
假如你的flex3项目名字叫TestApp,最简单直接的办法就是,
把"bin-debug"目录下的:
TestApp.html
TestApp.swf
AC_OETags.js ......
制作可用鼠標框選的TileList,因為時間比較匆忙,所以错漏在所难免,请大家不吝赐教。另外小部分代码参考自网上。直接上代码。
package
{
import flash.events.Event;
import flash.events.MouseEvent;
import flash.geom.Point;
import mx.controls.TileList;
import ......