blue-genie
asked on
javascript-flash communication
Can anyone tell me if there are any other alternatives for javascript to communicate with a flash file other than using the setVariable() method as a flag to call flash methods? Also, does anyone know of how I could cache my processing so that javascript will wait for flash and vice versa?
blu.
blu.
ASKER
Hi Rex. it's my colleague asking this question.
he's a java programmer, what he's basically wants to know is, can you use javascript to call a method in flash, and if yes, how would you do this.
blu.
he's a java programmer, what he's basically wants to know is, can you use javascript to call a method in flash, and if yes, how would you do this.
blu.
here is my way
see this how to properly embed the movie : http://www.moock.org/webdesign/flash/fscommand/#javascripttoflash
i think it is not possible to call a method directly in flash. therefore i use a setter function to transport the parameters and a getter function to fetch the result. (obj.addProperty(n,s,g))
here are my files:
http://home.pages.at/andreas-deschka/xy.fla
http://home.pages.at/andreas-deschka/xy.html
<script language="javascript">
var cf=function(fn){
var r= new Array();
for(var i=0; i< arguments.length-1; i++){
r.push(arguments[i+1]);
}
document.xy.SetVariable(fn , r.join(";"));
// i pass the arguments converted to a string
return document.xy.GetVariable(fn );
}
</script>
<a href="javascript:alert(cf( 'obj.multi ply',45,3) );">click< /a>
Andreas
see this how to properly embed the movie : http://www.moock.org/webdesign/flash/fscommand/#javascripttoflash
i think it is not possible to call a method directly in flash. therefore i use a setter function to transport the parameters and a getter function to fetch the result. (obj.addProperty(n,s,g))
here are my files:
http://home.pages.at/andreas-deschka/xy.fla
http://home.pages.at/andreas-deschka/xy.html
<script language="javascript">
var cf=function(fn){
var r= new Array();
for(var i=0; i< arguments.length-1; i++){
r.push(arguments[i+1]);
}
document.xy.SetVariable(fn
// i pass the arguments converted to a string
return document.xy.GetVariable(fn
}
</script>
<a href="javascript:alert(cf(
Andreas
Yep, there is. Use SetVariable to pass arguments, and TCallLabel to invoke the script (pseudo function call):
http://www.macromedia.com/support/flash/publishexport/scriptingwithflash/scriptingwithflash_03.html#70479
http://www.macromedia.com/support/flash/publishexport/scriptingwithflash/scriptingwithflash_03.html#70479
ASKER
neg.
Glad you're around, I told my colleague if any one can answer this it would be you.
What he's trying to do is, using Javascript, calls a method in Flash, its not parsing anything to the Flash, the Javascript must then wait for a return value from the flash method, before it proceeds with anything else.
Can this be done, can you help with an example?
Many thanks,
blu.
Glad you're around, I told my colleague if any one can answer this it would be you.
What he's trying to do is, using Javascript, calls a method in Flash, its not parsing anything to the Flash, the Javascript must then wait for a return value from the flash method, before it proceeds with anything else.
Can this be done, can you help with an example?
Many thanks,
blu.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok, thanks neg.
We're gonna work on it for a while and I'll get back to you.
It makes sense.
blu.
We're gonna work on it for a while and I'll get back to you.
It makes sense.
blu.
or SharedObjects...