Golden Flash guest as class record three

Source: Internet
Author: User
Tags variables relative variable

Teaching purposes:

1. Master the methods of loading and unloading external film clips;
2, load the film clip control method.

Prepare before class: Create a new folder on your local disk T4 and copy the movie clips you want to load 01.swf, 01.jpg to the folder.

Material Download:

  Click here to download the source file

  Teaching Process:

1, open Flash, a new document, the background is black.

2, select the window-other panels-Common library-button command, drag two buttons to the lower right corner of the stage. We will use these two buttons for loading and unloading operations.

3, save the file to the T4 folder, the file name is L4.

4, select the green button, press F9 key to open the action panel, enter the statement

On (release) {
Loadmovie ("01.swf", 1);
}
5, select the Red button, enter the statement in the script input area

On (release) {
Unloadmovie (1);
}6, press Ctrl+enter test.

Explain:
Usage
Loadmovie ("url", Target [, Method])

Parameters
The absolute or relative URL of the SWF file or JPEG file to be loaded by the URL. The relative path must be relative to the SWF file at level 0. An absolute URL must include a protocol reference, such as http://or ftp://.
Target points to the path of the target movie clip. The target movie clip will be replaced with a loaded SWF file or image.
Method an optional parameter that specifies the HTTP methods used to send the variable. The parameter must be a string get or POST. If there are no variables to send, this argument is omitted. The Get method appends a variable to the end of the URL, which is used to send a small number of variables. The POST method sends a variable in a separate HTTP header, which is used to send a large number of variables.
Description
function to load a SWF file or JPEG file into Flash player while playing the original SWF file.
Exercise: 1, change the statement on the green button to

On (release) {
Loadmovie ("01.jpg", 1);
Test to see what effect? Notice the format of the picture.
2, the red button to amend the sentence to
On (release) {
Unloadmovie (0);
} or on (release) {
Unloadmovie (this);
Test to see what happens?
3. Pay attention to the location of film clips and pictures.
With the above practice we have a preliminary grasp of how to load and uninstall movie clips. We summarize the following conclusions:
1, we can use the Loadmovie () function to load the movie clip or JPEG format picture, with Unloadmovie () uninstall.
2. We load the movie clip onto the specified layer, and the default registration point is the upper-left corner of the stage.
Let's practice the second method of loading an external movie clip into a movie clip on the timeline.
In this way we need to first create a movie clip on the stage and give it an instance name ABC.
We'll change the statement on the green button to
On (release) {
_root.createemptymovieclip ("abc", 1);
Loadmovie ("01.swf", "abc");
The statement on the red button also needs to be modified accordingly
On (release) {
Unloadmovie ("abc");
Disk Test.
Both of these methods are useful when loading external movie clips or JPEG pictures. If we want to load a movie clip to a level in flash Player, we need to use the Loadmovienum () function, which is left to practice after class. Let's solve the second problem-how to position.
The principle and method of loading are mastered, and the positioning is simpler. If we're using method one-loading onto the layer, we just need to adjust the coordinates and size of the layer, and if we take method two-loaded into the movie clip, we just need to resize the movie clip's coordinates. For example, like we hang a picture frame on the wall, the movie clip to be loaded is the photo, we just adjust the size and position of the frame, and the size and position of the photo are changed accordingly.
Method One: The adjustment of loading to the layer position
On (release) {
Loadmovie ("01.swf", 1);
Onenterframe = function () {
_level1._x = 100;
_level1._y = 50;
_level1._width = 400;
_level1._height = 300;
};
Delete Onenterframe;
Method Two: Adjust the position to load into the movie clip

On (release) {
_root.createemptymovieclip ("abc", 1);
Loadmovie ("01.swf", "abc");
Onenterframe = function () {
With (ABC) {
_x = 100;
_y = 50;
_width = 400;
_height = 300;
}
};
Delete Onenterframe;
Because the time is more urgent, perhaps some places are not very rigorous, everybody practice to leave more dim sum.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.