Loading script for button

Hi all,
I have got myself into a bit of a problem here and i thought maybe you guys could help me out. Okay its like this.
I have a button and I want it to go to URL when u click on it, at the moment i have getURL(…) action on it, but what i would like to be able to do is too be able to change the URL the button goes to from an external txt file. I thought that if the URL is written inside the txt file and the txt file is loaded into the swf then i have a variable of the URL and then when on the button i just tell it to go to the vaiable, which is the URL.
Yet i am not really so sure how to do that. I am guessing there is goin to be a laod function somewhere… but im not very sure…
Just one more thing… if i do it this way… will it still work on flash 5??

Thanks in advance…
/Aussie Devil

It can work in Flash 5.0 yes. If you need the variable to be loaded from an external txt file we can do that.

I would say…

create a txt file that contains this

&linkVariable=http://www.centerspin.com&

and name the file “urlVariables.txt”

place this in the first frame of your action script layer.

loadVariables(“urlVariables.txt”,"");

Then the button’s script would be something like

on(release){
getURL(_root.linkVariable);
}


potential problem. :slight_smile: there’s always one of these.

I think that the address in the urlVariables.txt doc will need to be url encoded. If you don’t know about url encoding let me know and I’ll try to write up something for you.

OKay… so thats cool… thanks for that… so i was trying some more stuff and it so that it would show a variable in a dynamic text field… If you check out the attached zip file and open the swf, you see that the text “Hello” works… but i flickers go from frame 1 to 2… and if i put a stop action on frame 2 it doesnt work at all… Why is this?? and how can i fix it??

Thanks you once again…
/Aussie Devil

Thats right gotta attach the file… =P