Flash SetVariable

Howdy.
I've been working on a gadget that allows the users to interact with a flash player by clicking on urls in the gadget.

I'm having problems, though, when I try to use the "setVariable" command in javascript. Also, it seems that flash cannot access any javascript commands either!

Has anyone else encountered this, or solved the problem?

[362 byte] By [Follower46] at [2008-2-23]
# 1
This is a similar question.
Has anyone been able to call javascript from flash in these gadgets?

It appears that each gadget is acting as a "code island" to keep javascript functions and variables from colliding. Yet flash is acting as if it is outside of the gadget it's residing in.
So when a javascript command is called, it is thrown an error that the function does not exist.

Is there a way to reference the javascript function so that it knows what gadget contains the correct functions?

Follower46 at 2007-9-4 > top of Msdn Tech,Gadgets,Web Gadget Development...
# 2
I was, in fact, able to communicate from flash to javascript.

Like I said above, the flash compiled file is an object located outside of the javascript object that spawns it. To access the functions, you must go back through the object's functions.

Sadly, the best way I saw to do this was to use global variables.

in .js file


registerNamespace("Company.Group.Project");

var flashNextSong;

Company.Group.Project.Test = function(p_elSource, p_args, p_namespace)
{
...
this.initialize = function(p_objScope)
{
flashNextSong = function(){nextSong();}
}
...
}



in .swf file


getURL(flashNextSong()");


This, of course, means that if you have multiple instances of the same gadget, you have to handle for it by setting up an array of ID's and passing them to the flash swf upon initialization (using FlashVars, which does work).
(the above only applies to inline gadgets)
Follower46 at 2007-9-4 > top of Msdn Tech,Gadgets,Web Gadget Development...