Skip to main content
GameDev.net gamedev.net
🔒 Locked

Flash UI integration

Started by encom Apr 11, 2007 at 2:14 AM 3 replies 6.1k views
Original Post
encom
encom
Hi, I would like to integrate a flash UI in a c++ program. I use flash.ocx component in vc++ 6, but where can I find doc/references on CShockwaveFlash class (autogenerated) ? My goal is to call from c++ a ActionScript function, and from ActionScript call a c++ function. Thanks :)
Byron
Byron
I once looked into this and this link was something I found but I never progressed with it since I decided to write my own flash player in the end:

http://www.bytescout.com/display_flash_in_visualc.html

Good luck!
ByronBoxes
encom
encom
Hi,

I have found this website too ;)

Do you know how to use the function
CShockwaveFlash.CallFunction() ?

Does it call a ActionScript function ?
Byron
Byron
I don't know too much about your generated class but the player itself does contain an 'external API' which should enable you to do what you are looking for.

You can find more information here:

http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/js/html/wwhelp.htm?href=00002200.html
ByronBoxes
encom
encom

Resolved :)



#### c++ to flash calls:

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 ActionScript now :

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


#### flash to c++ calls:

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 ActionScript :

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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.