PDA

View Full Version : Dynamic external text files(oneliners)


AMiller099
02-13-2001, 04:28 AM
How can I use a textfile filled with oneliners in flash? I want to have a text field pick a random variable from the text file and have it do a simple fade in/out tween. Any help would be appreciated.

Jesse
02-13-2001, 08:04 AM
You would put all your oneliners in a text document in the following form:

oneliner1=Your mommoa's so fat, her belt size is equator
&oneneliner2=Your momma's so fat, she's got other, smaller women orbitting around her
&oneliner3=Your momma's so fat, she DJs for the ice cream truck

Save the above text in a plain text file as say 'onelines.txt'. Then in Flash, on frame 1 put:

loadVariablesNum ("oneliners.txt", 0);

Then you have an animation of a dynamic text field which tweens in and out, and fades etc. You make the text field hold the variable 'joke' or some such and put one instance of this MC on the stage and call it 'anim'.

Then you have a bit of code which selects your random joke and inserts it into the text field:

_root.anim:joke = ["oneliner" + random(3) + 1]

Cheers

Jesse

flashhelpme
05-09-2007, 06:12 PM
I am trying to get this to work... where exactly do i put the code:

_root.anim:factoid...

Thanks

jonathanloudon
06-09-2007, 02:54 PM
I want to do this, but I want it display a random .swf ...
:confused:

Anyone know how to do that?