Flash 与 VC 通讯

来源:互联网 发布:2017年网络新词 编辑:程序博客网 时间:2024/05/16 19:16
//Flash AS3.0
创建动态文本框 实例名称:textvcmsg
创建按钮控件 实例名称:button1
图层1帧1脚本
//VC发送到Flash方法m_flash.CallFunction("<invoke name=\"MsgBox\"><arguments><string>这是C++调用flash的响应</string></arguments> </invoke>"); 
import flash.external.*;    
ExternalInterface.addCallback("MsgBox", this. MsgBox);    
function MsgBox(msg:String)    
{    
    textvcmsg.text = msg;
}
//flash发送到VC
// movie clip button control
button1.addEventListener(MouseEvent.CLICK, clickHandler);
function clickHandler(event:MouseEvent):void {
fscommand("MsgBox", "这是flash调用c++的响应");//flash发送方法
}

//VC 2008
添加Flash控件
添加Flash控件事件处理函数FSCommandShockwaveflash1
OnInitDialog函数添加
m_flash.MoveWindow(570,0, 600, 800);//(0,0,600,768);//       //FLASH位置大小
m_flash.LoadMovie(0, exePath + "test.swf");
m_flash.Play();

void CWinSockServerDlg::FSCommandShockwaveflash1(LPCTSTR command, LPCTSTR args)   
{
if( 0 == _tcscmp(command,_T("MsgBox")))
{
AfxMessageBox(args);//弹出Flash发来的消息
}
}
0 0
原创粉丝点击