Jump to content

Error number 80020009 when trying to use CallFunction


Recommended Posts

Hi,

I'm taking a stab at using Flash's External Interface and I am able to talk to Autoit from Flash, but visa-versa gives me an error 80020009 when attempting to use CallFunction. Here's the code:

#include <GUIConstants.au3>
#include <_XMLDomWrapper.au3>

Opt("GUIOnEventMode", 1);event capturing mode
Global $busy = True

$swfFile = "myExtTest2.swf"
$oSwf = ObjCreate("ShockwaveFlash.ShockwaveFlash")

$hModWnd = GUICreate("Flash External API Demo", 400, 450, -1, -1, -1)

$GUIActiveX = GUICtrlCreateObj($oSwf, 0, 0, 400, 400)
$SinkObject = ObjEvent($oSwf, "FLA_") 
$oMyError = ObjEvent("AutoIt.Error", "COMErrFunc")
With $oSwf
    .Movie = @ScriptDir & '\' & $swfFile;
    .ScaleMode = 3; 0 showall, 1 noborder, 2 exactFit, 3 noscale
    .bgcolor = "#999999";
    .Loop = False
    .wmode = "Opaque"; Opaque / transparent
    .allowScriptAccess = "Always"
EndWith

GUISetOnEvent($GUI_EVENT_CLOSE, "closeTest");Set close handler for AI GUI

GUISetState()

;=============THE ERROR COMES FROM THIS LINE======================>>>>>>>>
$oSwf.CallFunction('<invoke name="hideMC"><arguments><string></string></arguments></invoke>')
;===========================================================>>>>>>>>

While $busy
    Sleep(10)
WEnd

Func FLA_FlashCall($xml)
    _XMLLoadXML($xml)
    Local $calledFunc = _XMLGetAttrib(" / invoke", "name")
    $parameters = _XMLGetValue(" / invoke / arguments / string")
    MsgBox(1, "Call from Flash", "Function: " & $calledFunc & @CRLF & "Parameter: " & $parameters[1] & @CRLF & "Full XML:" & $xml)
EndFunc 

Func closeTest();Close GUI Event Handler
    $busy = False
    GUIDelete()
EndFunc ;==>closeTest

Func COMErrFunc()
    MsgBox(0, "AutoItCOM Test", "We intercepted a COM Error !" & @CRLF & @CRLF & _
            "err.description is: " & @TAB & $oMyError.description & @CRLF & _
            "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _
            "err.number is: " & @TAB & Hex($oMyError.number, 8) & @CRLF & _
            "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _
            "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _
            "err.source is: " & @TAB & $oMyError.source & @CRLF & _
            "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _
            "err.helpcontext is: " & @TAB & $oMyError.helpcontext _
            )
    Local $err = $oMyError.number
    If $err = 0 Then $err = -1
    SetError($err); to check for after this function returns
EndFunc ;==>COMErrFunc

I'm new to COM but I think it might have something to do with the way my xml is formatted. I've tried every variation of it I could think of but still no go. Anything jumping out at anybody here?

Thanks alot. :)

Link to comment
Share on other sites

Isn't the external interface command call() and not CallFunction()?

From the docs: static

call(methodName:String, [parameter1:Object]) : Object

Calls a function exposed by the Flash Player container, passing 0 or more arguments.

Besides that, a method that I've used to communicate from autoit to flash would be to write a text or xml file and have flash read it with an xml object or a loadvars object. I haven't used the externalInterface yet, so I'm curious. What command in flash calls functions from within AutoIt? I've used fscommand, but your autoit code is structured differently than mine when fscommand is used.

Link to comment
Share on other sites

Isn't the external interface command call() and not CallFunction()?

From the docs: static

call(methodName:String, [parameter1:Object]) : Object

Calls a function exposed by the Flash Player container, passing 0 or more arguments.

Besides that, a method that I've used to communicate from autoit to flash would be to write a text or xml file and have flash read it with an xml object or a loadvars object. I haven't used the externalInterface yet, so I'm curious. What command in flash calls functions from within AutoIt? I've used fscommand, but your autoit code is structured differently than mine when fscommand is used.

Hi there Justin.

Thanks alot for the response. I got it to go with some kind help from the member austin6. He has a great tutorial on his website if you are interested in learning more about ExternalInterface.

http://www.active6.com/blog

I used to use fscommand too, but the new EI allows you to send parameters.

I think that the call() method only pertains to sending from a browser but I may be wrong.

In case you're wondering, my error arose from my callback line which needed a null parameter.

ExternalInterface.addCallback ("hideMC", null, hideMC)

Thanks for diving in, have a good one.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...