怎么把ShockWaveFlash控件上发生的鼠标右键捕获,并替换成鼠标左键事件

来源:互联网 发布:音乐剪切合成软件 编辑:程序博客网 时间:2024/04/30 16:13

forest_wawa (大坏蛋007)
http://search.csdn.net/expert/topic/50/5003/2003/2/16/1432958.htm
描述:我在程序里面使用ShockWaveFlash的控件,我需要实现的功能是∶
1) 在FLAHS动画的一个按钮上面压下鼠标左键后,执行flash的左键消息响应函数OnFsCommand();
2) 在这个按钮上压下鼠标右键后还是要执行OnFsCommand(),并且还需要弹出一个popup菜单
回复人: masterz()
BOOL CuseflashDlg::PreTranslateMessage(MSG* pMsg)
{
// change right button message to left button message by masterz
POINT pt;
pt.x = LOWORD(pMsg->lParam);
pt.y= HIWORD(pMsg->lParam);
CString msg;
CRect rc;
m_flash.GetWindowRect(&rc);
ScreenToClient(&rc);
msg.Format("mouse (%d,%d),flash (%d,%d,%d,%d)",pt.x,pt.y,rc.left,rc.top,rc.right,rc.bottom);
if(pMsg->message==WM_RBUTTONDOWN||pMsg->message==WM_RBUTTONUP||pMsg->message==WM_RBUTTONDBLCLK)
OutputDebugString(msg);
if(rc.PtInRect(pt)||::GetFocus()==m_flash.m_hWnd||pMsg->hwnd==m_flash.m_hWnd)
//if(::GetFocus()==m_flash.m_hWnd)
{
if(pMsg->message==WM_RBUTTONDOWN)
pMsg->message=WM_LBUTTONDOWN;
if(WM_RBUTTONUP==pMsg->message)
pMsg->message = WM_LBUTTONUP;
if(WM_RBUTTONDBLCLK==pMsg->message)
pMsg->message=WM_LBUTTONDBLCLK; if(pMsg->message==WM_RBUTTONDOWN||pMsg->message==WM_RBUTTONUP||pMsg->message==WM_RBUTTONDBLCLK)
OutputDebugString("point in rect");
}
return CDialog::PreTranslateMessage(pMsg);
}
回复人: masterz()
m_flash.LoadMovie(0,"C://Downloads//icons.swf");
m_flash.Play();
版主点评:
MFC中消息替换功能一般都要在PreTranslateMessage函数中实现。

 

 

 

[转]VC,VB,C#与flash8结合开发中callfunction的运用

flash8.ocx中对象的callfunction怎样运用,注意swf文件要用flash8.0版本制作,flash控件要flash8.ocx版本
VB描述(传多个参数)
VB端
Private Sub Command1_Click()
       Flash1.CallFunction "<invoke name=""show""  returntype=""xml""><arguments><string>hello</string><string>world</string></arguments></invoke>"    '篇幅关系,与上面同行
End Sub
Private Sub Form_Load()
    ShockwaveFlash1.LoadMovie 0, App.Path & "/showstring.swf"
End Sub
flash端
①添加一个文本框text_txt以显示效果
②ActionScript代码为
function show(str1:String,str2:String):Void{
      test_txt.text=str1+" : "+str2;
}
flash.external.ExternalInterface.addCallback("show",this,show);
C++或C#描述(只传一个参数,用)

主程序端:
flash1.LoadMovie(0,Application.StartPath+"
/showstring.swf");
flash1.CallFunction("<invoke name=/"test/" returntype=/"xml/"><arguments><string>Helloworld</string></arguments></invoke>");
flash端:
①添加一个文本框text_txt以显示效果或用trace("call: "+result+"")
②ActionScript代码为,其中result只是参数,而主程序端使用AS的函数时不需要关心参数名,只有知道有参数个数,或参数位置
function test(result:Object):Void{
   test_txt.text=result;
}
flash.external.ExternalInterface.addCallback("test", this, test);

原创粉丝点击