[Laszlo-dev] swf9 ExternalInterface.addCallback
Sarah Allen
sarah at ultrasaurus.com
Thu Jun 18 22:09:27 PDT 2009
So, is there any native-LZX way to do this? or is the Flash API the
best I can do for now?
Thanks!
Sarah
On Jun 12, 2009, at 10:12 AM, Henry Minsky wrote:
> You're looking at out of date docs, the new docs say it has two args.
>
> See the docs at http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/
>
> addCallback () method
> public static function addCallback(functionName:String,
> closure:Function):void
> Language Version : ActionScript 3.0
> Runtime Versions : AIR 1.0, Flash Player 9
> Registers an ActionScript method as callable from the container.
> After a successful invocation of addCallBack(), the registered
> function in Flash Player can be called by JavaScript or ActiveX code
> in the container.
>
> Note: For local content running in a browser, calls to the
> ExternalInterface.addCallback() method work only if the SWF file and
> the containing web page are in the local-trusted security sandbox.
> For more information, see the following:
>
> The security chapter in the Programming ActionScript 3.0 book and
> the latest comments on LiveDocs
> The Flash Player 9 Security white paper
> Parameters
>
>
> functionName:String — The name by which the container can invoke the
> function.
>
>
> closure:Function — The function closure to invoke. This could be a
> free-standing function, or it could be a method closure referencing
> a method of an object instance. By passing a method closure, you can
> direct the callback at a method of a particular object instance.
>
> Throws
>
> Error — The container does not support incoming calls. Incoming
> calls are supported only in Internet Explorer for Windows and
> browsers that use the NPRuntime API such as Mozilla 1.7.5 and later
> or Firefox 1.0 and later.
>
>
> SecurityError — A callback with the specified name has already been
> added by ActionScript in a sandbox to which you do not have access;
> you cannot overwrite that callback. To work around this problem,
> rewrite the ActionScript that originally called the addCallback()
> method so that it also calls the Security.allowDomain() method.
>
>
> SecurityError — The containing environment belongs to a security
> sandbox to which the calling code does not have access. To fix this
> problem, follow these steps:
> In the object tag for the SWF file in the containing HTML page, set
> the following parameter:
> <param name="allowScriptAccess" value="always" />
>
> In the SWF file, add the following ActionScript:
> flash.system.Security.allowDomain(sourceDomain)
>
> See also
>
>
>
> On Fri, Jun 12, 2009 at 12:51 PM, Sarah Allen
> <sarah at ultrasaurus.com> wrote:
> I'm seeing a weird compiler error in trunk... might be recent
> regression (it is possible, but unlikely that I somehow left this
> code in a state that had a compiler error a couple of months ago
> when I last looked at this app) I'll be looking at this more, but I
> wanted to send a note in case anyone else is seeing something
> similar or has any ideas.
>
> org.openlaszlo.sc.CompilerError: main.lzx: 41: Error: Incorrect
> number of arguments. Expected no more than 2, in line:
> flash.external.ExternalInterface.addCallback("playMedia", null,
> playMedia)
>
> The Flash docs indicate that there are three arguments:
> http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001653.html
>
> Also, is there any LZX-native way that I should be making this call
> instead of devolving into calling Flash directly?
>
> Thanks in advance,
> Sarah
>
>
>
>
>
> --
> Henry Minsky
> Software Architect
> hminsky at laszlosystems.com
>
>
http://www.ultrasaurus.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20090618/b6e8708d/attachment-0001.html
More information about the Laszlo-dev
mailing list