PDA

View Full Version : dynamic button?


monotypic
03-28-2003, 11:33 PM
would someone mind helping me create a button in flash that gets its url from a txt file?

i've made a txt file named "variables.txt"
and then have:
"link01=http://www.monotypic.com"

but i'm confused as to how to get this read into flash mx.
i have a movie clip and on the first frame i put:
"Load Variables ("variables.txt", 0)"

then the next frame i try and use the link01 variable i made on a button as:

on (release) {getUrl( link01, "_blank");
}

but no go.... when i check my scene inside flash.. if i click the button it opens up a new window with my scene directory..
when i export it and test it as a html file the link doesn't go anywhere at all.

-any help would be enough for me to give you my undying gratitude.....or my first born child.. which ever you prefer...^_^

knebbes
03-29-2003, 08:53 AM
it should be

loadVariablesNum("variables.txt",0)


remember that it might take a while to load the text file

mohh
03-29-2003, 03:10 PM
A text file with a list of variables, will not take that long to load so you should be good. This will also allow you to make changes without having to modify the source fla. Good idea.

Try this out; in Frame 1 of the main timeline:

onClipEvent(load) {
this.loadVariables("variables.txt");
}

monotypic
03-31-2003, 11:10 PM
thanks guys. still not working.. but i'm gonna reinstall flash and see what happens...its given me prob's like this b4 with dynamic content...

mohh
04-01-2003, 03:05 AM
Hmm,

Maybe you should post your .fla so that we can take a look. :shrug:

Maxx
04-01-2003, 10:52 AM
Personally, I'd use the LoadVars() object. Assuming you're on MX, try this:

myObject = new LoadVars();
myObject.onLoad=parseIt;
myObject.load("variables.txt");

Where parseIt is the function to parse the data from the new object. (Note that there are no parens after the parseIt function call. There's some wierd thing about the timing of calling the function and the parens - didn't understand it myself, but it seems to work.)

Also make sure that your text file is saved in a unicode format and set up with variables declared with an "&" character.

monotypic
04-01-2003, 11:26 PM
here's pretty much what i was trying..
the zip file (http://www.monotypic.com/dynamicbutton.zip)

thanks for all the help guys, i'm really new to actionscripting and mx.

mohh
04-02-2003, 06:19 AM
It's not pretty, but you should get the general gist of it: Dynamic Buttons Sample (http://www.mohhs.com/flash/samples/dynamicbutton.zip)

If I had more time I would have created the buttons themselves with ActionScript, but this should do as a demonstration.

monotypic
04-02-2003, 05:57 PM
o_0 WOW. thank you sir! your my hero!

mohh
04-03-2003, 02:51 AM
You're welcome. You shouldn't have much troube modifying that to your needs. :thumbsup:

CGTalk Moderation
01-14-2006, 06:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.