views:

456

answers:

3

I'm trying to use CallFunction() to call a function inside a flash file, but no matter what I do it throws a HRESULT E_FAIL error. Any clues why? My flash version is 10 if you need it.

+2  A: 

The HRESULT E_FAIL can be due to passing a wrong XML string to the AxShockwaveFlash.CallFunction's argument, or calling a function that is not registered with the ExternalInterface, but it can also be a result of a runtime-error occuring inside the Flash SWF file.

  1. Make sure your are passing a valid XML string as the argument (details on Flash's XML format can be found here). Keep in mind that ActionScript is case-sensitive.
  2. Make sure the function you're calling actually works well with the supplied arguments, by testing it from inside the Flash Actionscript code.
  3. Make sure your Actionscript function is properly registered with the ExternalInterface. Details of using the ExternalInterface for calling an actionscript function from the SWF's container can be found here.
  4. If you can't find the cause, please supply us with the relevant code of the vb.net method, the Actionscript function and Actionscript ExternalInterface registration.
M.A. Hanin
1: I am2. I know it works3. I cant do that, is there a way around that?
Bubby4j
Wrap the functionality with your own "proxy" functionality, and make sure each external function in your proxy is properly registered with the ExternalInterface.
M.A. Hanin
Uhm. I cant edit the flash fine in any way. Any other way?
Bubby4j
Not that I know of, sorry.
M.A. Hanin
What if I could create a container for the flash file? Could I register the first file's functions with the ExternalInterface then?
Bubby4j
No, because the contained SWF doesn't expose the functions you wish to trigger. The SWF file is like an object, who's public methods are only defined using the ExternalInterface.Since flash SWF is not native code but intermediate code, SWF files can be "imported" back to FLA files, enabling you to edit the source code. But if the original publisher of the SWF file applied the "import protection" you're going to have some trouble...
M.A. Hanin
It's not that I cant edit it, It's that it has to remain on a server I don't own for it to connect to the server.
Bubby4j
A: 

I'm having the same problem...

Pudim
Lots of people do.
Bubby4j
A: 

Is there a way to call the Action Script if you do not have access to SWF file?

In the Adobe example there is an ExternalInterface reference, but do I understand correctly that there also needs to be an extarnal interface reference inside the Action script?

Or is this done by the AxShockwaveFlash control?

Ronald Schutte
It is confusing. :/
Bubby4j