Groups > Multimedia > Macromedia rich int apps > Re: Return value from ExternalInterface.call method




Return value from ExternalInterface.call method

Return value from ExternalInterface.call method
Fri, 9 Jun 2006 16:43:41 +0000
Hi people,
 I can not achieve to get any return value from javascript other than
 null.
 In th HTML container I have a functions like this:

 function f(p)
 {
 alert(p);
 return(p);
 }

 In my flex app I call the browser function in the following way:

 var ret:*;
 ret = ExternalInterface.call( "f", "Hello" );
 Alert.show( ret.toString() );

 I get an alert in the browser saying "Hello" and another Alert from
 flex saying "null".

 What's wrong?... I think that I should get two alerts shown, no?


Post Reply
Re: Return value from ExternalInterface.call method
Fri, 9 Jun 2006 16:51:32 +0000
You might need to add something like the following:

 <SCRIPT type="text/vbscript" >
 	<!--
 	Sub f(ByVal command, ByVal args)
 		call f(command, args)
 	end sub
 	-->
 </SCRIPT>

 This "forwards" the call. Note that this written in VB not JS.
Post Reply
Re: Return value from ExternalInterface.call method
Fri, 9 Jun 2006 17:05:27 +0000
Sorry, but I do not understand the code you sent:
 - Should I interpret to add that piece of code to my HTML container?
 - Must be that Sub in vbscript to work?
 - what is the meaning of "call f ( command, args)" ?
Post Reply
Re: Return value from ExternalInterface.call method
Fri, 9 Jun 2006 17:08:03 +0000
There is not a valid answer yet.
Post Reply
Re: Return value from ExternalInterface.call method
Fri, 9 Jun 2006 18:54:42 +0000
yes, add it to your html in the<head> section. The funtion in your example
had 
the name "f", so that's what I used. That little snippet just forwards
your 
function call to the 'actual' function written in javascript.
Post Reply
<< Previous 1 2 Next >>
( Page 1 of 2 )
about | contact