Communicating with C++/CLI to ActionScript
March 1, 2009 Leave a comment
Inspired by Gabe Wishnie
As a matter of fact, i was tried to implement C# and the Flash Player 8 External API with my C++/CLI project. However, i was using Visual Studio 2005.
My main goal of this post is to aware what is the most basic part to implement this kind of staff in project.
Troubleshooting
1. To begin porting over the FLVPlayer it will be batter to use the most updated flash player.
2. Most of the time people ask about the problem with CallFunction method as it said this method is not a member.
3. If this kind of ambiguous problem faced then re-check your Flash Virsion. Flash 6,7 will the main cause of this error. Upgrade it into 8, 9 or 10
4. In ActionScript you must add these lines first
import flash.external.ExternalInterface;
ExternalInterface.addCallback("YourMethod", null, YourMethod);
function YourMethod(uri:String):Void
{
if(uri == "TANVEER")
{
// something my logic will be applicable;
}
}
5. In C++/CLI
private: AxShockwaveFlashObjects::AxShockwaveFlash^ mpAxShockwaveFlashBee;
private: System::Void mpButtonClick_Click(System::Object^ sender, System::EventArgs^ e)
{
mpAxShockwaveFlashBee->CallFunction(“<invoke” + ” name=\”loadAndPlayVideo\” returntype=\”xml\”><arguments><string>TANVEER</string></arguments></invoke>”);
}
6. Done! It is now that easy to pass data back ActionScript and C++/CLI.
My Source code:needbee.rar.pdf
rename it as needbee.rar