tb_external_interface function on OSX

0 views
Skip to first unread message

Eric Priou

unread,
Jun 26, 2007, 12:14:08 PM6/26/07
to flash-th...@googlegroups.com
Hi,

I get some trouble using thunderbolt throught the ExternalInterface
option.
Only the getURL seems to work for me.

Do the first one works on windows ?

OSX 10.4 FF 2.0.0.4 just don't.

Can any osx user confirm ?
Or am I alone in the osx flash market ?

Thanks.

---
Eric Priou aka erixtekila
http://www.v-i-a.net/inprogress/

aemkei

unread,
Jun 26, 2007, 12:36:34 PM6/26/07
to flash-thunderbolt
Have you tried the online example?

http://flash-thunderbolt.googlecode.com/files/thunderbolt.html

For me (Win XP, Firefox 2.0.0.4, Firebug 1.05) ExternalInterface and
getUrl works fine.

- Martin

Eric Priou

unread,
Jun 27, 2007, 5:20:06 AM6/27/07
to flash-th...@googlegroups.com
> Have you tried the online example?
>
> http://flash-thunderbolt.googlecode.com/files/thunderbolt.html
>
> For me (Win XP, Firefox 2.0.0.4, Firebug 1.05) ExternalInterface and
> getUrl works fine.

Yep I've tried it.
But as I didn't have any references, I thought I'd got the good results.

Now, I know what are the troubles.
There are 2 issues in the current as2 distro :

1- Console.enabled don't return a bolean when first launched.
This is now fixed in the current repository.
The first trace was never being called here.

2- ExternalInterface seems to require some time to launch on my osX
version of Firefox.
Maybe the init process is different on Windows ?
Then calling a trace to fast, at launch time, just fail silently.

I had bad time to track that one…
But now I am sure that getURL is easier to use on mac, because
directly available.

I never had any bugs with getURL and know by experience that it
handle bigger data size.
Can you elaborate on the issues you got with it ?
ExternalInterface is good, to get return value of a javascript call.

I can think of a way to be sure that the tb_external function is set
before calling it.
The way to add it to the DOM directly from the swf is pretty elegant.
NOTE : The other js functions (shown in the example) should be also
added to the DOM with that technique, with such a non obtrusive way.


To conclude :
- I've commited to the trunk the fix for the enabled function.
- It seems that you have a sort of Makefile to create the .zip and
so, can you use it with the fix I've commited ?
- I'll try to think of a way to handle the init time of the
ExternalInterface : something like call getURL until
ExternalInterface is there.
- I ask you I you consider putting the js function declaration
(inspect, set, …) inside Console.initExternalInterface

Cheers.


---
Eric Priou aka erixtekila

Dev notes : http://www.v-i-a.net/inprogress
Oregano XMLSocket server forum : http://www.v-i-a.net/forum


aemkei

unread,
Jun 29, 2007, 11:14:15 AM6/29/07
to flash-thunderbolt
Hmm... maybe this helps:

getURL("javascript:console.log('url')");
ExternalInterface.call("console.log", "interface");
getURL("javascript:console.log('url')");

will output:
// interface
// url
// url

So, the ExternalInterface will be executed BEFORE getURL!

And because ThunderBolt initialized the JavaScript callback via getURL
and call this via ExternalInterface in the same frame it won't output
the traces.

On Jun 27, 11:20 am, Eric Priou <erixtek...@gmail.com> wrote:
> > Have you tried the online example?
>
> >http://flash-thunderbolt.googlecode.com/files/thunderbolt.html
>
> > For me (Win XP, Firefox 2.0.0.4, Firebug 1.05) ExternalInterface and
> > getUrl works fine.
>
> Yep I've tried it.
> But as I didn't have any references, I thought I'd got the good results.
>
> Now, I know what are the troubles.
> There are 2 issues in the current as2 distro :
>
> 1- Console.enabled don't return a bolean when first launched.
> This is now fixed in the current repository.
> The first trace was never being called here.
>
> 2- ExternalInterface seems to require some time to launch on my osX
> version of Firefox.
> Maybe the init process is different on Windows ?
> Then calling a trace to fast, at launch time, just fail silently.
>

> I had bad time to track that one...


> But now I am sure that getURL is easier to use on mac, because
> directly available.
>
> I never had any bugs with getURL and know by experience that it
> handle bigger data size.
> Can you elaborate on the issues you got with it ?
> ExternalInterface is good, to get return value of a javascript call.
>
> I can think of a way to be sure that the tb_external function is set
> before calling it.
> The way to add it to the DOM directly from the swf is pretty elegant.
> NOTE : The other js functions (shown in the example) should be also
> added to the DOM with that technique, with such a non obtrusive way.
>
> To conclude :
> - I've commited to the trunk the fix for the enabled function.
> - It seems that you have a sort of Makefile to create the .zip and
> so, can you use it with the fix I've commited ?
> - I'll try to think of a way to handle the init time of the
> ExternalInterface : something like call getURL until
> ExternalInterface is there.
> - I ask you I you consider putting the js function declaration

> (inspect, set, ...) inside Console.initExternalInterface

Eric Priou

unread,
Jun 29, 2007, 11:44:10 AM6/29/07
to flash-th...@googlegroups.com
getURL("javascript:console.log('url')");
ExternalInterface.call("console.log", "interface");
getURL("javascript:console.log('url')");

will output:
// interface
// url
// url

So, the ExternalInterface will be executed BEFORE getURL!

And because ThunderBolt initialized the JavaScript callback via getURL
and call this via ExternalInterface in the same frame it won't output
the traces.
Good finding !
I've got the same result on osx.

Can we inject javascript with ExternalInterface then ?
I don't think so…

aemkei

unread,
Jun 29, 2007, 12:00:19 PM6/29/07
to flash-thunderbolt
I solved the problem!

By adding a return true statement in the javascript callback we can
check if the command has been executed. If not, we switch back to
getURL.

Check out the updated classes!

On Jun 29, 5:44 pm, Eric Priou <erixtek...@gmail.com> wrote:
> > getURL("javascript:console.log('url')");
> > ExternalInterface.call("console.log", "interface");
> > getURL("javascript:console.log('url')");
>
> > will output:
> > // interface
> > // url
> > // url
>
> > So, the ExternalInterface will be executed BEFORE getURL!
>
> > And because ThunderBolt initialized the JavaScript callback via getURL
> > and call this via ExternalInterface in the same frame it won't output
> > the traces.
>
> Good finding !
> I've got the same result on osx.
>
> Can we inject javascript with ExternalInterface then ?

> I don't think so...

Eric Priou

unread,
Jul 4, 2007, 11:37:31 AM7/4/07
to flash-th...@googlegroups.com
By adding a return true statement in the javascript callback we can
check if the command has been executed. If not, we switch back to
getURL.

Check out the updated classes!
G.R.E.A.T
Thanks.
Reply all
Reply to author
Forward
0 new messages