General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 1st, 2004, 05:58 AM
Mr. Wizard Mr. Wizard is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 2 Mr. Wizard User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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?

Reply With Quote
  #2  
Old May 31st, 2005, 07:53 AM
BlackLight BlackLight is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 1 BlackLight User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 27 sec
Reputation Power: 0
http://www.devx.com/dotnet/Article/21033/1763/page/3

Hope that helps!

Reply With Quote
  #3  
Old September 26th, 2006, 05:54 AM
Andoni Andoni is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2006
Posts: 1 Andoni User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 17 sec
Reputation Power: 0
Quote:
Originally Posted by Mr. Wizard
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?


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.

Reply With Quote
  #4  
Old November 22nd, 2007, 12:04 AM
Archana Archana is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2007
Posts: 1 Archana User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 55 sec
Reputation Power: 0
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.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Flash 2004 and C++ interactivity


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT