Flash CS3 Documentation |
|||
| Learning ActionScript 2.0 in Adobe Flash > Working with Text and Strings > About loading text and variables into text fields | |||
You can load text into a Flash document several ways, including (but certainly not limited to) using FlashVars, LoadVars, XML, or web services. Perhaps the simplest method of passing text into a Flash document is to use the FlashVars property, which passes short strings of text into a Flash document through the object and embed tags in the HTML code that you use to embed the SWF file in an HTML page. Another easy way to load text or variables into a Flash document is to use the LoadVars class, which can load large blocks of text or load a series of URL encoded variables from a text file.
As you can see from the previous examples in this section, some ways of loading text into a SWF file are easier than others. However, if you syndicate data from external sites, you might not have a choice for the format of the data that you need to load.
Each way of loading and/or sending data to and from a SWF file has its pros and cons. XML, web services, and Flash Remoting are the most versatile for loading external data, but they are also the most difficult to learn. For information on Flash Remoting, see www.adobe.com/support/flashremoting.
FlashVars and LoadVars are much simpler, as demonstrated in Using FlashVars to load and display text and Using LoadVars to load and display text, but they can be much more limited in the types and formats of data that you can load. Also, you must follow security restrictions when you send and load data. For information on security, see Understanding Security. For more information on loading external data, see Working with External Data.
The following sections show you different ways to load text and variables into your documents:
For samples that demonstrate how to work with text fields using ActionScript, see the Flash Samples page at www.adobe.com/go/learn_fl_samples. Download the Samples zip file and navigate to the ActionScript 2.0/LoadText folder to access these samples:
For a sample source file, aliasing.fla, that loads text and applies anti-alias formatting in addition to bitmap caching, see the Flash Sample page at www.adobe.com/go/learn_fl_samples. Download the Samples zip file and navigate to the ActionScript 2.0/Advanced Anti-Aliasing folder to access the sample.
Flash CS3
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00000886.html