all groups > flash data integration > february 2006 >
You're in the

flash data integration

group:

Dreaded SetVariable function


Dreaded SetVariable function ahMaDness
2/13/2006 12:00:00 AM
flash data integration:
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

Re: Dreaded SetVariable function RTalisman
2/13/2006 10:58:31 PM
ahMaDness,

Pick a different name for it, don't use "Character", it is interpreted differently by FireFox (as far as I remember).

Best Regards,

Re: Dreaded SetVariable function RTalisman
2/14/2006 12:00:00 AM
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
Re: Dreaded SetVariable function ahMaDness
2/14/2006 4:22:37 AM
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
Re: Dreaded SetVariable function ahMaDness
2/14/2006 11:22:14 PM
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
Re: Dreaded SetVariable function RTalisman
2/15/2006 6:26:47 PM
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
Re: Dreaded SetVariable function ahMaDness
2/17/2006 12:00:00 AM
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
Re: Dreaded SetVariable function Maddy's page
2/23/2006 12:00:00 AM
AddThis Social Bookmark Button