How do I access flashvars if I can't access the stage?

188 views Asked by At

How do I access flashvars if I can't access the stage?

I'm fiddling with the Open Source Media Framework's Strobe Media Playback player, and I'm trying to take a flashvar and put it in the package org.osmf.net.NetNegotiator.

But the netNegotiator class can't access the stage, so I can't do stage.loaderInfo.parameters to get the flashvar.


Alternately, I can get the flashvar from StrobeMediaPlayback.as, but I can't figure out how to send it over there.

I've tried to import the package in the StrobeMediaPlayback.as, but not only does NetNegotiator show up on the predictive typing thing, I get an undefined error when I try to use it.

2

There are 2 answers

2
Creative Magic On BEST ANSWER

You can always make a singleton class, something like SeesionFlashVars.as

package
{
    public class SeesionFlashVars
    {
        public static var flashVars:Object;
    }
}

Now, in your main class you can write the data in the static variable like this:

SessionFlashVars.flashVars = YOUR_OBJECT;

After that you can access the data same way in any of your classes.

0
Pier On

Does this work?

var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;

for (keyStr in paramObj) {
  valueStr = String(paramObj[keyStr]);
  tf.appendText("\t" + keyStr + ":\t" + valueStr + "\n");
}