;

PDA

Click to See Complete Forum and Search --> : problem of ExternalInterface


HBB Alfred
08-21-2005, 12:04 PM
hello~
i have tired to ExternalInterface but it doesnt work:(

// as
myBtn.onPress = function()
{
flash.external.ExternalInterface.call("jsFunc", "hi");
}
// js
<script language="javascript">
function jsFunc( args )
{
window.alert(args);
}
</script>


my flash player version is 8.0.15.0

betaruce
08-21-2005, 12:10 PM
it should be ExternalInterface.call("jsFunc","hi")
read the help doc for more details :)

for the JS part, I wonder if there is "window" before "alert"? seems there isnt....

HBB Alfred
08-21-2005, 12:15 PM
i am sorry,the code was not copy from my code
actually, it is flash.external.ExternalInterface.call("jsFunc", "hi");

HBB Alfred
08-21-2005, 12:15 PM
hello~
i have tired to ExternalInterface but it doesnt work:(

// as
myBtn.onPress = function()
{
flash.external.ExternalInterface.call("jsFunc", "hi");
}
// js
<script language="javascript">
function jsFunc( args )
{
window.alert(args);
}
</script>


my flash player version is 8.0.15.0

betaruce
08-21-2005, 12:34 PM
hv u import the external class?

and r u sure onPress there's reli sth happen?

also try jus to call ExternalInterface.call("jsFunc", "hi");

annexion
08-21-2005, 01:25 PM
Works for me, although it gives me a prompt saying it stopped a potentially unsafe operation. Try it without the "window" reference as mentioned.

HBB Alfred
08-21-2005, 10:37 PM
to betaruce :i don't have external class, cause of i have used flash 2004 -__-||
but i convert swf to version 8
to annexion :i have got the prompt of unsafe in local at first, then i have came across the script error after upload my server
here (http://www.hbbspace.com/test/1.html) is the test page, can you get the alert from js correctly, tell me, thank you!

PAlexC
08-22-2005, 02:45 PM
Do you need to set swLiveConnect as an object/embed param for External API to work?

betaruce
08-22-2005, 03:22 PM
no basically u don't need to set anything.

for the unsafe part, i think all ppl will encounter this problem. we need to alter the settings of the Flahs player so that it allows the action to be called.

jonathan67
08-24-2005, 08:59 AM
here (http://www.hbbspace.com/test/1.html) is the test page, can you get the alert from js correctly, tell me, thank you!
Hi,
I got the alert box "aaa" without errors or warnings
I'm viewing the sample in Firefox v 1. 0. 6
and my flash player is WIN 8,0,5,0

HBB Alfred
08-24-2005, 11:16 PM
oh,thank you guys
it's my mistake that i set the id just is a number "1" in object tag.