Hi guys and thanks in advance for reading ,
I hope im not repeating a thread, but ive researched far and wide,
and cannot find a solution that works.
I am using the javascript SetVariable function to change the value
of a parameter in flash. In IE it works nicely, though in FireFox i get the
error:
Error:
document.Character.SetVariable is not a function
In this file, "Character" is the name of my flash file and id on the object
and embed tags.
The code im using at the moment is something like this for firefox,
function startMovie(gotoStartPage){
document.SetVariable("startPage", gotoStartPage);
}
quite simple, though just not working.
What i really need to do is have some way to change the value of a variable in
flash from javascript. Any ideas?
Thanks again,
ahMaDness
RTalisman - 13 Feb 2006 22:58 GMT
ahMaDness,
Pick a different name for it, don't use "Character", it is interpreted differently by FireFox (as far as I remember).
Best Regards,
Rangar Talisman
ahMaDness - 14 Feb 2006 04:22 GMT
RTalisman , thanks for trying and I have renamed the flash object to WebAvatar,
though it didnt make a difference.
I still get the error
Error: document.WebAvatar.SetVariable is not a function
when trying to run javascript talking to flash in firefox, runs fine in IE,
just not in Firefox..
Can anyone help,
Thanks guys
RTalisman - 14 Feb 2006 05:48 GMT
ahMaDness,
Well I figured it out... Document.SetVariable is not a function, so the error
is corrent...
You do not need to reference an internal variable with SetVariable, just
reference it directly.
document.WebAvatar.gotoandPlay("StartPage");
Try that...
So yeah, "SetVariable" might be javascript, but it is NOT Flash, and Flash is
the one you have to keep happy. (Check the Help files with a search from within
Flash if you are still sure, you can see it's isn't there for yourself.
However, you couldn't have known that, so no big deal)
Let me know how it goes okay.
Best Regards,
Rangar Talisman
ahMaDness - 14 Feb 2006 23:22 GMT
RTalisman,
Thanks for your suggestion, though it hasnt fixed my problem,
which is a bit of a worry. Here's why,
I first thought that instead of using gotoAndPlay() i would create my own
function called startMeUp() which basically loads a lovie into an empty MC.
then it said startMeUp() is not a function, so i thought hey il try gotoAndPlay
and see what that says,
and i got this: Error: document.WebAvatar.gotoAndPlay is not a function
Which means theres something else retarded here. The SetVariable and code
works in IE flawlessly, its only FireFox that im having issues with, heres the
code im using to contact Flash
function startMovie(gotoStartPage){
// For IE
if(window.WebAvatar) window.document.SetVariable("startPage", gotoStartPage);
// For FireFox
//Neither of these two lines worked, the first was call a
function, the second use gotoAndPlay.
// if(document.WebAvatar)
document.WebAvatar.startMeUp(gotoStartPage);
if(document.WebAvatar) document.WebAvatar.gotoAndPlay(3);
}
Seems theres something wrong with the call, because whenever i want to call
any function, even ones i know are there (e.g. gotoAndPlay) it says that this
isnt a function.
I'm really puzzled, any ideas?
Cheers in advance
RTalisman - 15 Feb 2006 18:26 GMT
hang on, what is "WebAvatar"?
if you are refeerencing the document properties, use:
doucment.myfunctiongoeshere
if you are referencing WebAvatar properties, use:
WebAvatar.myfunctiongoeshere
or you can try:
_root.WebAvatar.myfunctiongoeshere
ahMaDness - 17 Feb 2006 05:59 GMT
hey
WebAvatar is the name of my flash movie...
So howcome this works in IE
window.document.SetVariable("startPage", gotoStartPage);
but this doesnt work in FireFox
document.WebAvatar.SetVariable("startPage", gotoStartPage)
Really appreciate your time, thanks
Maddy's page - 23 Feb 2006 11:58 GMT
Hey have u solved this problem? If yes please answer to this post how did u solved it Even I am facing the same problem. It is not working in mac safari and in firefox:(