7 Replies Latest reply on Oct 23, 2010 5:55 AM by Ned Murphy

    Converting external link as2 script to as3

    ShawnMac63

      Hello.

       

      I used this script I found online to make a Flash file that accessed an external text file full of hyperlinks through buttons in the Flash movie. The code is as2. I had to update the Flash file to AS3 and now the script doesn't work. I can't figure out how to do the same thing that this script does in AS3. Can anyone help me?

       

      Here is the AS2 script:

       

      textFile = new LoadVars()
      textFile.onLoad = function(){
      buttonlink1 = this.BlackBooklink;
      buttonlink2 = this.Ashtraylink;
      buttonlink3 = this.bedroomlink;
      buttonlink4 = this.tvlink;
      buttonlink5 = this.spiderlink;
      buttonlink6 = this.Mirrorlink;
      buttonlink7 = this.Boomboxlink;
      buttonlink8 = this.Suitlink;
      buttonlink9 = this.cashlink;
      buttonlink10 = this.fastfoodlink;
      buttonlink11 = this.Idolatrylink;
      buttonlink12 = this.Trashlink;
      }

      textFile.load("LeftHouseLinks.txt");

      //---buttons
      BlackBook.onRelease = function(){
      getURL(buttonlink1, "_self");
      };

      Ashtray.onRelease = function(){
      getURL(buttonlink2, "_self");
      };

      bedroom.onRelease = function(){
      getURL(buttonlink3, "_self");
      };

      tv.onRelease = function(){
      getURL(buttonlink4, "_self");
      };

      spider.onRelease = function(){
      getURL(buttonlink5, "_self");
      };

      Mirror.onRelease = function(){
      getURL(buttonlink6, "_self");
      };

      Boombox.onRelease = function(){
      getURL(buttonlink7, "_self");
      };

      Suit.onRelease = function(){
      getURL(buttonlink8, "_self");
      };

      cash.onRelease = function(){
      getURL(buttonlink9, "_self");
      };

      fastfood.onRelease = function(){
      getURL(buttonlink10, "_self");
      };

      idolatry.onRelease = function(){
      getURL(buttonlink11, "_self");
      };

      trashtalk.onRelease = function(){
      getURL(buttonlink11, "_s

       

      This is the external .txt file content

       

      &BlackBooklink=http://www.yahoo.com
      &Ashtraylink=http://www.google.com
      &bedroomlink=http://www.yahoo.com
      &tvlink=http://www.google.com
      &spiderlink=http://www.yahoo.com
      &Mirrorlink=http://www.google.com
      &Boomboxlink=http://www.yahoo.com
      &Suitlink=http://www.google.com
      &cashlink=http://www.yahoo.com
      &fastfoodlink=http://www.google.com
      &Idolatrylink=http://www.yahoo.com

       

       

      I know how to make AS3 button work, I just don't know the code so that when I click the button, it accesses the external file and goes to the hyperlink specified by the button.

       

       

      Any help would be much appreciated.

       

      -Shawn