|
|
|
|
| Tutorial |
4 In the Variable parameter box, enter an instance name for the new object, for example,
myLoadVars.
5 With the insertion point in the Value parameter box, from the Actions toolbox, click the
Objects category, then click Client/Server, click LoadVars, and double-click new LoadVars to
add it to the Script pane. Select the Expression box.
The code should look like this:
myLoadVars = new LoadVars();
6 In the Actions toolbox, click the Objects category, click Client/Server, LoadVars, and Methods,
and double-click the load method to add it to the Script pane.
7 In the Object parameter box, enter the instance name of the LoadVars object into which the
data will load—in this example, myLoadVars.
8 In the Parameters box, enter the URL from which to download data.
The URL must be enclosed in quotation marks, for example, "http://www.myserver.com/
data.txt". The finished code should look like this:
myLoadVars = new LoadVars();
myLoadVars.load("http://www.myserver.com/data.txt");
For more information, see the LoadVars object in the online ActionScript Dictionary in the
Help menu.
Loading an image or sound dynamically
If you import an image or a sound while you author a Flash document, the image and sound are
then packaged and stored in the SWF file when you publish the movie. To load JPEG images at
runtime, you use the loadMovie or loadMovieNum method of the MovieClip object. To load
MP3 sounds at runtime, you use the loadSound method of the Sound object. To return the
number of bytes that have downloaded and the expected number of bytes for the image or sound
file being downloaded, you use the getBytesLoaded and getBytesTotal methods of the
MovieClip and Sound objects.
To load an image into a level in the Flash Player, you must use the loadMovieNum method or
action. To load an image into a movie clip target in the Flash Player, you must use the loadMovie
action or method. The loaded image replaces all the contents of the target movie clip.
To load a sound, you must create a new instance of the Sound object. You can use the new
instance to call the loadSound method to load an event or a streaming sound. Event sounds are
loaded completely before being played; streaming sounds are played as they are downloaded. You
can set the isStreaming parameter of the loadSound method to specify a sound as an event
sound or a streaming sound. After you load an event sound, you must call the start method of
the Sound object to make the sound play. Streaming sounds begin playing when sufficient data is
loaded into the movie; you don’t need to use the start method.
Note: For image files, Flash supports only the standard JPEG image file type, not progressive JPEG files. For sound
files, Flash supports only the MP3 sound file type.
To load an image dynamically:
1 Choose a frame, button, or movie clip to which to assign the action.
2 Choose Window > Actions to open the Actions panel if it isn’t already open.
|
|
|
|
|
|
| Link Partners: Asia florist, Flowers to India, Hong kong flowers, Site submit, Cheap web hosting, China florist, Japan florist |
|