kcwu
kcwu

Reputation: 7011

How to GetVariable() flash class variable?

I want to use javascript flash method GetVariable() to get variable from flash.

I can get variable "foo" from default timeline by GetVariable("/:foo").

But I don't know how to get class static variable "bar" from this actionscript

package abc
{
    class def
    {
        public static var bar:Number;
    }
}

If you could provide reference link is plus. I found only few useful information via google.

Upvotes: 0

Views: 3647

Answers (2)

mwilcox
mwilcox

Reputation: 4132

GetVariable goes back to Flash 4.0 (maybe 3.0) - it's really only still there for backwards compatibility, you won't get it to work with AS2 or AS3. iirc, you couldn't even get a var from a movie clip (in other words, an object property), such as _root.myMovie.myVar. It would only get variables in the root. I remember throwing all of my vars up there so I could access them.

As the previous poster said, EI is your best bet. Other workarounds would be to set the var in the root so you can access it, or set the var in JS directly from AS (if you aren't doing this every 20ms or something).

Upvotes: 1

Lior Cohen
Lior Cohen

Reputation: 9055

You can use ExternalInterface to set this up without using GetVariable().

Here's a link to Adobe's documentation about ExternalInterface.

http://livedocs.adobe.com/flex/3/html/help.html?content=19_External_Interface_04.html

Upvotes: 1

Related Questions