|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Flash 2004 and C++ interactivity
Within the flash documentation it says it has the ability to communicate with C++ using the fscommand action. It also says that this can be accomplished with the use of ActiveX controls. Say I have a simple button and textarea in flash. I want to be able to pass a value from within the textarea to a C++ dll file when the button is clicked. The button code could be the following:
on (click) { fscommand("messagebox", "This is a message from a box called from within Flash."); } How then do I set up activeX controls to be able to handle this fscommand and what code is also needed in C++ to be able to accept this string? Could this process also work in reverse sending a string from C++ to the Flash document? |
|
#2
|
|||
|
|||
|
http://www.devx.com/dotnet/Article/21033/1763/page/3
Hope that helps! |
|
#3
|
|||
|
|||
|
Quote:
Try this. First of all , you have to add the "Shockwave Flash Object" control in the Toolbox . If you right click on the toolbox and then select "add/remove item" you will be able to add the "Shockwave Flash Object" COM component . After that, create a control in your dialog. Associate it to a member variable. http://www.bytescout.com/display_flash_in_visualc.html void CMYDIALOG: oDataExchange(CDataExchange* pDX){ CDialog: oDataExchange(pDX);...... DDX_Control(pDX, IDC_FLASHID, m_flash); ...... } in CMYDIALOG.h CShockwaveflash2 m_myFlash; if you want to load a swf into the control, you can use this function: CString swfFileName; swfFileName("C:\\myswffile.swf"); m_myFlash.put_Movie((char*)(LPCSTR)swfFileName); if you want to process the fscommand from the flash in the .cpp BEGIN_EVENTSINK_MAP(CMYDIALOG, CDialog) ON_EVENT(CMYDIALOG, IDC_FLASHID, 150, FSCommand, VTS_BSTR VTS_BSTR) END_EVENTSINK_MAP() void CMYDIALOG::FSCommand(LPCTSTR command, LPCTSTR args) { //// fscommand from the flash will be received by this function CString valor,comando; valor.Format(args); valor.MakeLower(); comando.Format(command); comando.MakeLower(); // you can pass them to a CString variable and then use CString Compare method ..... } in the .h DECLARE_EVENTSINK_MAP() void FSCommand(LPCTSTR command, LPCTSTR args); if you want to communicate with the swf from vc++ you can use a variable in the flash as a communication way. You should add a watch function that will be activated when someone writes the variable. For example , in the first frame of the flash you can write: var R; // this will be the variable for the communication function init() { /// assign the watch to the variable R this.watch("R", onRChanges); } function onRChanges(prop,oldval,newVal) { /// this function will be activated when the content of the variable R changes. /// the format of the R variable will be VarName=valor&VarName1=valor1... lvR = new LoadVars(); lvR.decode(newVal); trace(prop); trace(newVal); for(var p in lvR) { trace(p); trace(lvR[p]); } } init(); and to write the R variable from vc++, you can use this: CString valueForR="name=Odiseo&surname=DeItaca&school=athens"; m_myFlash.SetVariable("_root.R",(char*)(LPCSTR)valueForR); well, i hope this helps. sorry for my english. |
|
#4
|
|||
|
|||
|
flashplayer on vc++ dialog
Hi
I have to communicate with the flash file (i.e) .SWF file to my vc++ dialog. I have writen the same code but not working can u give some guide lines. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Flash 2004 and C++ interactivity |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|