Redirecting to a new URL after a Flash File has finished... How to

Posted on 2008-11-13
Last Modified: 2013-12-20
I have a web site that starts with an intro... I can't seem to figure a way to automaticly redirect to a specific URl when the flash file is done playing.
Question by:zmann800
    LVL 39

    Expert Comment

    is it a simple case of when the flash reaches the last frame its' done?
    what are you using AS3 or AS2?
    in the former - URLRequest

    package {
        import flash.display.Sprite;

        public class URLVariablesExample extends Sprite {

            public function URLVariablesExample() {
                var url:String = "http://www.[yourDomain].com/application.jsp";
                var request:URLRequest = new URLRequest(url);
                var variables:URLVariables = new URLVariables();
                variables.exampleSessionId = new Date().getTime();
                variables.exampleUserLabel = "guest";
       = variables;

    in the latter - getURL("", "_blank");

    Author Comment

    Yes, I just want it to redirct once the last frame of the flash is reached.

    I am using AS3.

    Can you help me decide where this goes in my code?
    getURL("", "_blank");

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    body {
          background-color: #000000;
          margin-left: 100px;
    .style1 {
          font-family: Impact;
          font-size: 18px;
          color: #FFFFFF;
    <script type="text/javascript">
    function MM_CheckFlashVersion(reqVerStr,msg){
        var isIE  = (appVersion.indexOf("MSIE") != -1 && userAgent.indexOf("Opera") == -1);
        var isWin = (appVersion.toLowerCase().indexOf("win") != -1);
        if (!isIE || !isWin){  
          var flashVer = -1;
          if (plugins && plugins.length > 0){
            var desc = plugins["Shockwave Flash"] ? plugins["Shockwave Flash"].description : "";
            desc = plugins["Shockwave Flash 2.0"] ? plugins["Shockwave Flash 2.0"].description : desc;
            if (desc == "") flashVer = -1;
              var descArr = desc.split(" ");
              var tempArrMajor = descArr[2].split(".");
              var verMajor = tempArrMajor[0];
              var tempArrMinor = (descArr[3] != "") ? descArr[3].split("r") : descArr[4].split("r");
              var verMinor = (tempArrMinor[1] > 0) ? tempArrMinor[1] : 0;
              flashVer =  parseFloat(verMajor + "." + verMinor);
          // WebTV has Flash Player 4 or lower -- too low for video
          else if (userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 4.0;

          var verArr = reqVerStr.split(",");
          var reqVer = parseFloat(verArr[0] + "." + verArr[2]);
          if (flashVer < reqVer){
            if (confirm(msg))
              window.location = "";
    <script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>

    <body onload="MM_CheckFlashVersion('8,0,0,0','Content on this page requires a newer version of Adobe Flash Player. Do you want to download it now?');">
      <script type="text/javascript">
    AC_FL_RunContent( 'codebase',',0,0,0','width','640','height','480','id','FLVPlayer','src','FLVPlayer_Progressive','flashvars','&MM_ComponentVersion=1&skinName=Clear_Skin_1&streamName=UCFTrailer2&autoPlay=true&autoRewind=false','quality','high','scale','noscale','name','FLVPlayer','salign','lt','pluginspage','','movie','FLVPlayer_Progressive' ); //end AC code
      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase=",0,0,0" width="640" height="480" id="FLVPlayer">
        <param name="movie" value="FLVPlayer_Progressive.swf" />
        <param name="salign" value="lt" />
        <param name="quality" value="high" />
        <param name="scale" value="noscale" />
        <param name="FlashVars" value="&MM_ComponentVersion=1&skinName=Clear_Skin_1&streamName=UCFTrailer2&autoPlay=true&autoRewind=false" />
        <embed src="FLVPlayer_Progressive.swf" flashvars="&MM_ComponentVersion=1&skinName=Clear_Skin_1&streamName=UCFTrailer2&autoPlay=true&autoRewind=false" quality="high" scale="noscale" width="640" height="480" name="FLVPlayer" salign="LT" type="application/x-shockwave-flash" pluginspage="" />  
    LVL 39

    Accepted Solution

    in AS3 you can't use getURL.
    your code needs to go into the flash not the JS/HTML to embed the flash.

    Expert Comment

    This is exactly what I've been looking for, but I tried blue-genie's AC3 script and this error kicked back when I was  converting the fla to a swf:
    1037: packages cannot be nested.

    I made a keyframe at the end of the movie and Flash added the customary additional frames which totaled the entire timeline to 264 (those adidtional frames came out as repeat stills of the last frame. I  entered the code with my desired url at the keyframe (137)



    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
    I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
    In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
    The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

    729 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

    22 Experts available now in Live!

    Get 1:1 Help Now