FlashVars Help - ActionScript 3.0

I am trying to load FLV files using FlashVars "file=rmpt://path_to_flv_file.flv" using ActionScript 3.0. I was following a tutorial http://reallyshiny.com/tutorials/flash.php but apparently this is for AS 2.0 and getting FlashVars informaion is not as simple as var=var anymore in AS 3.0.  anyways, question is:

Can someone help me dynamically load an FLV file into my FLV player with FlashVars ebmedded into the HTML of the page? What do I need to place in my FLA file to set the source of the FLV as my FlashVar variable?

Who is Participating?
MacSimsConnect With a Mentor Commented:
FlashVars and querystring vars are still there, they have just been moved in AS3 (like many other things.)

In AS3 they can now be found in a generic object located at this.loaderInfo.parameters off the main timeline, or this.root.loaderInfo.parameters from elsewhere.

(It's best practice to typecast loaderinfo like: LoaderInfo(this.root.loaderInfo).parameters)

So if you have querystring vars like:


then the parameters object would look like:

parameters.var1 == "bob"
parameters.var2 == "jane"

You can read more in depth explanation and code samples here:


makman24Author Commented:
This helps at a glance, but my question was "What do I need to place in my FLA file to set the source of the FLV as my FlashVar variable?" In other words, what is the exact AS code I would need to put into the first frame of the movie to assign the "file" var's contents to the player's source parameter.

makman24Author Commented:
Well, I figured it out myself. Was hoping for a quick help, but that's ok.

You pass variables through FlashVars to the SWF and retrieve them by simply typing:

root.loaderInfo.parameters.myFlashVar; Where "myFlashVar is the FlashVar passed. In my case, I wanted to dynamically load an FLV file from my php page and call the FLV based on user input. thus i placed:

player.source = root.loaderInfo.parameters.file;

on the first frame of my FVLPlayer movie. Where player is the instance name of the FLVPlayback Object and "file" is the FlashVar passed. I am dynamically setting the source of the FLV file. Works like a charm!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.