0 Replies Latest reply on May 8, 2009 8:43 AM by yevri

    Embed to Pass URL Var

    yevri Level 1

      I have interface.swf bringing in variables from a txt file based on getting variables from the URL.

       

      mydomain.com/agent/purple has an index file that redirects to:

       

      mydomain.com/a/?agent=purple

       

      I have interface.swf embedded with Javascript (below) and this in the second frame of interface.swf:

      //load Movie Behavior

      if(this.photo == Number(this.photo)){

      loadMovieNum("images/"+agent+".jpg",this.photo);

      } else {

      this.photo.loadMovie("images/"+agent+".jpg");

      }

      //End Behavior

       

      loadVariables ("txt/"+_root.agent + ".txt", this);

       

       

      It's been working great, but suddenly it stopped working and I'm not sure what I did (don't think I was even changing any code to make that happen). Could the server settings or something external with the player, ac script file, etc. affect  this at all or is it that I've messed something up in the code?

       

      Thanks,

       

      Brian

       

       

      <script language="JavaScript" type="text/javascript">
      <!--
      // QueryString() & QueryString_Parse courtesy of http://javascript.about.com/library/scripts/blquerystring.htm
      function QueryString(key)
      {
           var value = null;
           for (var i=0;i<QueryString.keys.length;i++)
           {
                if (QueryString.keys[i]==key)
                {
                     value = QueryString.values[i];
                     break;
                }
           }
           return value;
      }
      QueryString.keys = new Array();
      QueryString.values = new Array();
      
      function QueryString_Parse()
      {
           var query = window.location.search.substring(1);
           var pairs = query.split("&");
           
           for (var i=0;i<pairs.length;i++)
           {
                var pos = pairs[i].indexOf('=');
                if (pos >= 0)
                {
                     var argname = pairs[i].substring(0,pos);
                     var value = pairs[i].substring(pos+1);
                     QueryString.keys[QueryString.keys.length] = argname;
                     QueryString.values[QueryString.values.length] = value;          
                }
           }
      
      }
      QueryString_Parse();
      
      // write flash obj with query string
      function writeFlash() {
           // appearance vars, these can be customized to your liking
           var width = '920'
           var height = '650'
           var src = 'interface.swf'
           // queries -- type in the variables you want to send to flash here
           var queries = '?page='+QueryString('page')+'&month='+QueryString('month')+''
      
           // assemble flash obj
           var l1 = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+width+'" height="'+height+'">;'
           var l2 = '<param name="movie" value="'+src+queries+'" />;'
           var l3 = '<param name="quality" value="high" />;'
           var l4 = '<embed src="'+src+queries+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed>;'
           var l5 = '</object>'
      
           // write all lines
           document.write(l1+l2+l3+l4+l5)
      }
      //-->
      </script>
      
      <script language="JavaScript" type="text/javascript">
      <!-- 
      writeFlash();
      -->
      </script>