(Zt) interaction between flash and C ++

Source: Internet
Author: User

Original: http://space.flash8.net/space? 592228/viewspace-421363.html

#### C ++ to flash cballs:

TRY{CString ret = m_FlashPlayer.CallFunction("<invoke name=\"FlashFunction\" returntype=\"xml\"><arguments><string> empty ?</string></arguments></invoke>");//AfxMessageBox(ret);}CATCH(COleDispatchException, ex){TCHAR   szCause[255];CString strFormatted;ex->GetErrorMessage(szCause, 255);strFormatted = "The program exited because of this error: ";strFormatted += szCause;AfxMessageBox(strFormatted);}END_CATCH

In actionscr platinum PT now:

import flash.external.*;ExternalInterface.addCallback("FlashFunction", this, InternalFlashFunction);function InternalFlashFunction(str: String): String{play();return "You can return a string...";}

#### Flash to C ++ cballs:

BEGIN_EVENTSINK_MAP(CFlashPlayerDlg, CDialog)//{{AFX_EVENTSINK_MAP(CFlashPlayerDlg)ON_EVENT(CFlashPlayerDlg, IDC_SHOCKWAVEFLASH1, 150 /* FSCommand */, OnFSCommand, VTS_BSTR VTS_BSTR)ON_EVENT(CFlashPlayerDlg, IDC_SHOCKWAVEFLASH1, 197 /* FlashCall */, OnFlashCall, VTS_BSTR)//}}AFX_EVENTSINK_MAPEND_EVENTSINK_MAP()void CFlashPlayerDlg::OnFSCommand(LPCTSTR command, LPCTSTR args){AfxMessageBox(command);}void CFlashPlayerDlg::OnFlashCall(LPCTSTR request){AfxMessageBox(request);}

In actionscr platinum PT:

fscommand("ChangeText", textInput_txt.text); // for fscommand// orflash.external.ExternalInterface.call("GetContacts"); // flash call

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.