Skip to main content
Participant
May 16, 2008
Question

How to reuse the swf file with multiple FLV's??

  • May 16, 2008
  • 1 reply
  • 342 views


I am using CS3 with FMSS over the internet. I'm using the skinunderallnocaption.swf file provided with CS3 and wish to publish it, except I need to pull the actual FLV name from the url and not hard-code it into the SWF.

Example: my url would look like this:

http://mydomain.com?file=someflvname

I then wish to pass the "someflvname" variable into the skinunderallnocaption.swf file as a variable so it streams from my FMSS.

I think I see where I need to use actionscript for this but I have no idea what I'm doing.

Thanks
    This topic is closed to new replies. Start a new post to keep the conversation going.

    1 reply

    Participant
    May 21, 2008
    You want to use what is known as a query string. This is my
    implementation.

    Here is what you would need in your Actionscript (this is AS3, BTW):

    var vidName:String = "";

    function loaderComplete(myEvent:Event)
    {
    this.myParams=this.loaderInfo.parameters;
    this.myParamsLoaded=true;
    this.useParams();
    }

    function useParams()
    {
    vidName = this.myParams.myVideo;
    vidName = vidName.slice(1,vidName.length);
    debugTxt.text = vidName;
    LoadXML();
    }

    var myLoaderInfo=new Object();
    myLoaderInfo.myParamsLoaded=false;
    myLoaderInfo.loaderComplete=loaderComplete;
    myLoaderInfo.useParams=useParams;

    this.loaderInfo.addEventListener(Event.COMPLETE,
    myLoaderInfo.loaderComplete);
    //End of Actionscript


    Later in your Actionscript you can tack on the vidName to your RTMP
    path.


    In your HTML file, you need code to take the query string and turn it
    into a FlashVar. I use javascript for the query string grab, and
    swfobject to make it FlashVar and embed my Flash Player. Here is the
    HTML code for that: (******take note***** replace all of the '-' in the 'document-location-search' statement with '.' in the code below. Apparently it is a censored word when it has the periods?)

    <script type="text/javascript" src="swfobject.js"></script>
    <script type="text/javascript">
    var flashvars = {};
    flashvars.myVideo = document-location-search;
    var params = {};
    var attributes = {};
    attributes.name = "fmsVideo";
    swfobject.embedSWF("VideoPlayer.swf", "myAlternativeContent", "1024",
    "768", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
    </script>

    So you can see here that the FlashVar in the HTML ("myVideo") is the
    same as what my SWF is looking for in the line "vidName =
    this.myParams.myVideo;".


    When everything is in place, your URL will look like this:
    http://mydomain.com/flvplayer.html?someflvname

    Here are the sources I used for this:
    http://www.permadi.com/tutorial/flashQueryString/index2.html
    http://code.google.com/p/swfobject/

    Hope that helps! Enjoy!!!