Login | Register
Gas & Electricity Prices Gas & Electricity Prices

Translations

By: Energy Complaints | posted in Flash, HTML/CSS, Tutorials, Web Design |
Date: October 28th, 2008

Let’s say you have 3 buttons inside of flash that link to different web sites and you want to be able to update those links without having to open the .fla file to decompile and then upload the .swf file.

With the action script below you can easily open the external .txt file and edit the links without ever having to open flash.

//put this script on a frame where all your 3 buttons are located…

textFile = new LoadVars()
textFile.onLoad = function(){
buttonlink1 = this.link1;
buttonlink2 = this.link2;
buttonlink3 = this.link3;
}
textFile.load(\”mylink.txt\”); // mylink.txt is your external text file

//—actionscript for buttons
//—make sure you have all your buttons instance name added. btn1, btn2 and btn3.

btn1.onRelease = function(){
getURL(buttonlink1, \”_self\”);
};

btn2.onRelease = function(){
getURL(buttonlink2, \”_self\”);
};

btn3.onRelease = function(){
getURL(buttonlink3, \”_self\”);
};

Then this is what you put inside mylink.txt


&link1=http://www.yahoo.com
&link2=http://www.google.com
&link3=http://www.w3schools.com



That’s it..

  • Facebook
  • Twitter
  • del.icio.us
  • StumbleUpon
  • Digg
  • Technorati
  • Google Bookmarks
  • Reddit
  • MySpace
  • LinkedIn
  • Sphinn
  • Mixx
  • RSS
  • email
  • Print
  • PDF

Related posts:

  1. Flash XML Editor Verson 2: Best Flash Content Management System The creator of flash xml editor version 1 has recently released his brand new flash xml editor version 2 with all the improvements from the...
  2. Best and affordable Flash XML content management system (CMS) You know I been waiting for a very long time to finally find a content management system for my flash websites and it doesn’t cost...
  3. Full XML Website V3 – Flash template review If you are looking for a great flash template with ability to update through a xml file, then this Full XML Website V3 does a...
  4. Flash vs HTML/CSS The Pros and Cons about Flash websites. Pros: Freedom – Any good flash designer can do anything he/she wants. The only limit is their imaginations,...
  5. Available Auto Military Parts @ Tecmotiv Tecmotiv is the world leader in military automotive supplier. Automotive Engine Parts Military Parts in stock In stock Automotive parts In stock Military Parts Available...
  6. Ontario gas & electricity fixed/Variable rates, Aug. 2010 Deregulated natural gas fixed rates in Ontario Commodity prices in ¢/m³ Distributors: Enbridge Gas Distribution Inc. Kingston Utilities – Natural Gas Kitchener Utilities Union...
  7. Block or disable background button with Flash This is a little tutorial for Flash button. I found out about this trick on my own by accident when I was building my Flash...
  8. Two different design and layout for wordpress posts Lets say you have your wordpress setup and ready to go. But we all know that the current default wordpress can only have one single...
  9. Western Digital External 1000GB Review I brought my Western Digital external hard drive with 1TB or 1000 GB of space two years ago. This is an older model compare...
  10. British Columbia gas & electricity Fixed/Variable rates, Aug. 2010 Deregulated natural gas fixed rates in British Columbia Commodity prices in $/Gj Distributors: Terasen Gas Terasen Gas-East Kootenays Terasen Gas-Inland Terasen Gas-Lower Mainland/Squamish *...

Comment Pages

There are 6 comments for Flash buttons link in external text file

  1. Light says:

    THANK YOU! After struggling with loadVariables or loadVariablesNum to get it to load the file and put a URL, I finally gave up. THIS IS THE ONLY SOLUTION THAT WORKED FOR ME! TY :)

    PS: Instead of doing the:

    btn1.onRelease = function(){
    getURL(buttonlink1, “_self”);
    };

    You can do the following also without specifying the button instance:

    on (release) {
    getURL(buttonlink1, “_self”);
    }

    Agree or Disagree: Thumb up 0 Thumb down 0

  2. Jef says:

    First of all, thank you for this, you’ve saved my life after a couple hours of losing my mind trying to figure this out.

    Quick question…when I use test this in a browser (Firefox and Safari), it’s adding a “\” at the end of the URLs, leading to a page load error.

    How do I fix this, or what might be causing it?

    My test link for link1 is copied exactly from your mylink.txt window.

    Thanks!

    Agree or Disagree: Thumb up 0 Thumb down 0

  3. Jef says:

    figured it out, thought i’d post just in case anyone else has a similar problem. Not sure why, but it didn’t work when creating the .txt file with TextEdit, but creating it in Pages and exporting as a .txt worked great.

    Agree or Disagree: Thumb up 0 Thumb down 0

  4. Thom says:

    Glad to hear you find this useful. Cheers.

    Agree or Disagree: Thumb up 0 Thumb down 0

  5. Troy says:

    Simple, to the point, and had it working in under a minute. Thanks for taking the time to make this!

    Agree or Disagree: Thumb up 0 Thumb down 0

Comment Pages

Write a Comment