actionscript-3flashflashvarsosmfstrobe-media-playback

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


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.


Solution

  • 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.