flex鼠标右键事件_第1页
flex鼠标右键事件_第2页
flex鼠标右键事件_第3页
flex鼠标右键事件_第4页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、flex鼠标右键事件.txt结婚就像是给自由穿件棉衣,活动起来不方便,但会很温暖。谈恋爱就像剥洋葱,总有一层让你泪流。 1. 如果你是 Desktop Application 监听事件的 MouseEvent.RIGHT_CLICK 事件比如对某个控件a 进行监控右键点击事件a.addEventListener(MouseEvent.RIGHT_CLICK,func);鼠标的其他事件也可以监听,具体见http:/ 如果是 Web Appliction (麻烦了!)其基本思路为 :1, 在 FLEX 中利用外部接口注册一个函数, 作为接收外部 (HTML)右键事件的入口2, 在 FLEX 应用所

2、在的HTML 中拦截鼠标右键事件 , 调用 FLEX 外部函数 , 并取消事件的广播, 以阻止事件到达FLEX 应用 .3, 在 FLEX 应用程序上监听mouseOver 事件 , 并记录当前鼠标所在对象4, 当入口函数接收到HTML 发送的右键事件后, 模拟生成一个鼠标右键事件(buttonDown =false),并发送到当前对象5, 在对象的 mouseDown 处理函数中 , 根据 buttonDown 的标志 , 分别处理鼠标左右键事件这个思路比较清晰可行,鼠标右键事件的流程为:HTML 鼠标右键事件-FLEX外部函数-模拟的鼠标右键事件-相应的处理函数具体的实现为:1,在 FLE

3、X 所在的HTML 增加function onNsRightClick(e)if(e.which = 3)FlexTest.openRightClick();e.stopPropagation();return false;function onIeRightClick(e)if(event.button 1)FlexTest.openRightClick();parent.frames.location.replace(javascript: parent.falseframe);return false;if(navigator.appName =Netscape) document.ca

4、ptureEvents(Event.MOUSEDOWN);document.addEventListener(mousedown, onNsRightClick, true);elsedocument.onmousedown=onIeRightClick;2,修改 FLEX 的 MXMLprivate var mouseTarget:DisplayObject;function init()ExternalInterface.addCallback(openRightClick, openRightClick);function getMouseTarget(event:MenuEvent):

5、voidmouseTarget = DisplayObject(event.target);function openRightClick():voidvare:MouseEvent=newMouseEvent(MouseEvent.MOUSE_DOWN,true,false,mouseTarget.mouseX, mouseTarget.mouseY);mouseTarget.dispatchEvent(e);function showMouseEvent(event)if(event.buttonDown = true)Alert.show(Left);elseAlert.show(Rig

6、ht);在修改完后 , 满怀信心的进行测试 , 结果右键菜单还能够出现 ! 试了很多办法也不行 , 幸亏我的同事赵辉发现了解决方法 , 在这里向他表示感谢 !具体的方法就是修改wmode 参数 , 将 wmode 设置为 opaque 或 transparent都可以达到这个效果AC_FL_RunContent(src, playerProductInstall,FlashVars,MMredirectURL=+MMredirectURL+&MMplayerType=+MMPlayerType+&MMdoctitle=+MMdoctitle+,width, 100%,heigh

7、t, 100%,align, middle,id, FlexTest,wmode, opaque, /注意 : 这里是关键quality, high,bgcolor, #869ca7,name, FlexTest,allowScriptAccess,sameDomain,type, application/x-shockwave-flash,pluginspage, http:/ 文档中对wmode 的解释 :Sets the WindowMode propertyoftheSWF filefortransparency,layering,andpositioningin the browse

8、r.Validvalues of wmodeare window, opaque, and transparent.Set to window to play the SWF in its own rectangular window on a web page.Set to opaque to hide everything on the page behind it.Set to transparent so that the background of the HTML page shows through all transparent portionsof the SWF file. This can slow animation performance.To make sections of your SWF file transparent, you must set the alpha property to0. To make your applications background transparent, set the alpha property

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论