PDA

View Full Version : Controlling Flash from a BHO.


FrankRizzo
07-30-2009, 01:51 AM
Hey Guys. I've been tasked with writing an app that passes variables into a flash object via the ExternalInterface "PutVariable" methods.

I can GET the variable, and see the value, and then I PUT back the new value, and GET it again to verify, and it looks like the PUT has failed.

This is from my C++/ATL code for a Browser Helper Object. (No, it's not a trojan, or anything malicious).

Am I crazy to assume that if I can read the value, and the return from the "Put" function says it's OK, that it IS OK?

Does anything special have to be done on the Flash side to enable me to write to the variable?

I could post the snippet of code that I use, but I see that it's mostly Javascript, and a little C# here. I can tell you this though, I'm passing the proper types as required by ATL to the Flash Object. (Variants).

Does anyone have ANY idea what I'm talking about? :D

Frank

FrankRizzo
07-30-2009, 03:21 AM
GOT IT!


error checking omitted for brevity.

// This goes past the ATL includes
#import "C:/WINDOWS/system32/Macromed/Flash/Flash9e.ocx" named_guids, rename_namespace("Flash")

Flash::IShockwaveFlash * flash = NULL;
hr = spDispatch->QueryInterface(__uuidof(Flash::IShockwaveFlash), (void **) &flash);

flash->GetVariable("VariableName");
flash->SetVariable("VariableName", "String Value");
etc..