FlashVars Help - ActionScript 3.0

Posted on 2007-08-09
Last Modified: 2008-06-09
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 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?

Question by:makman24
    LVL 1

    Accepted Solution

    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:


    Author Comment

    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.


    Author Comment

    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!


    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
    In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
    The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
    The goal of the tutorial is to teach the user how to how to record live broadcast.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now