With dynamic text, your
font is not embedded in the swf (unless
you specifically choose to embed it via
the "Character" button), so
it is best to work with a common font
such as Arial.
Save your movie as "loadText.fla" into
a folder named "load_external_text".
Now open a simple text edit program
such as simpletext on the mac or notepad
on the pc. Make a new document and paste
in this text
myText=This is
the text for the contact sections blah
blah dsvfvrb tstsrtb srtbh stbsrthb
tgntrn nrdn srtnsrtdnsdrtn r gdfb sdfdfb
You will recall that myText is the variable
name that we gave to our text box.
Save the text file as contact.txt to
the same folder as the fla.
OK now back to the fla. Make a button
on your stage and give it an instance
name of "but1". make a new "actions" layer
and place this action on the first frame
but1.onRelease=function(){
loadVariablesNum ("contact.txt",
0);
}
This loads your text file into _root
(level0). Be aware that if your text
box is inside an mc you will need to
load the text file accordingly
eg
but1.onRelease=function(){
loadVariablesNum ("contact.txt", "_root.mcInstanceName");
}
But for this tute our text box is on
the main timeline so just leave the action
as it was in the first example. Test
your movie and click on the button.
That's pretty much it. Open the contact
text file and change the text to
myText=This is
the text for the about us section blah
blah dsvfvrb tstsrtb srtbh stbsrthb
tgntrn nrdn srtnsrtdnsdrtn r gdfb sdfdfb
rn nrdn srtnsrn nrdn srtnsrn nrdn srtns
Choose "Save As" and save
the file as "about.txt" to
the same folder as the other files.
Now go back to flash and option-drag
a copy of your button. Change the instance
name of the new button to "but2" and
add this action to frame 1 of your actions
layer
but2.onRelease=function(){
loadVariablesNum ("about.txt",
0);
}
Save your movie and then test it again
and click on both the buttons.
That's it! Go ahead and make as many
different text files as you need need
and buttons to load them in.
Advantages of loading in external text:
- easy to update
- text doesn't anti-alias (unless you
embed the font)
Disadvantages:
- cannot animate or mask dynamic text
(unless you embed the font)
- do not have complete control over the
appearance of your text (unless you embed
the font)
|