Flexible use of the "Connect movie" feature in Flash

Source: Internet
Author: User
Tags connect numeric value

Many teachers find it difficult to make a courseware entirely with Flash MX, one of the main reasons is that there are many ActionScript commands in Flash MX that are daunting. I use Flash courseware has a few years of history, through practice, in fact, in many orders, many are not necessary to remember its detailed usage, to use the time to check the data can be. But there are a few important commands to be proficient in the use of, "connect the film" (Attachmovie) is one, the following is to say its powerful function and role.

First explain its usage: Attachmovie is used to invoke the MC (movieclip movie clip) in the library, which should have idname (set itself, in linkage).

Target.attachmovie (Idname, NewName, Depth) parameter description: Target is the path to the new MC; Idname is a string value representing the connection name of the object to be loaded in the object library (linkage name) NewName is a string value representing the reference name of the MC object after it is loaded; depth is a numeric value indicating the depth of the layer of the loaded MC object.

The command that corresponds to the Attachmovie and is used together is removemovieclip (clear Movie) command. The following author will use specific examples to illustrate its use in the courseware.

   1. function in the courseware structure

Flash MX made of courseware generally have three kinds of structure, one is the whole courseware only one home scene, the second is the production of several scenes, three is divided into several films. The first kind of structure makes the whole courseware too messy, making and modifying are not easy, unfavorable to adopt. The author likes to adopt the third kind of structure. First of all the courseware into a number of teaching links, each teaching link is a film, and then "connect the film" call, so that the production of courseware structure clear, easy to modify. For example, in the courseware "two corner", I will be divided into "see think, independent exploration, Mathematical thinking, collaborative research, practice consolidation, summary" 7 films. Below I take "see think" for example to say connection method.

(1) Create a new MC, enter its editing status, arbitrary production of a simple animation effect (this article only "see think" four words). Note: For the following does not produce overlap, the size of the MC and the main scene with a good match.

(2) Open the library, the right key to select the MC just made, select "Connection ..." (linkage) ", open the Connection Properties dialog box, select the first item (the default is also selected by the fourth), fill in the identifier column" Kkxx "as the name of the MC.

(3) Go back to the main scene and add the following ActionScript in the "See Think" button:

On (release) {

_root.attachmovie ("Kkxx", "B1", 1);

SetProperty ("B1", _x, 200);

SetProperty ("B1", _y, 200);

The position of the loaded MC is set in order to make it in the center of the scene;

}

This completes the connection movie.

   2. Role in implementing interactive functions

The good courseware should have the good interactivity and the openness. The use of Flash MX courseware, combined with its action scripting language, can fully meet this requirement. This paper presents an example of the use of a "connection movie" in making interactive courseware.

(1) Create the following several symol (symbols) through the menu "insert→new symol" command: Two movie Clip (movie clips), one named "right" and the other named "Wrong" for error feedback; 5 button (button), 4 of them are answer buttons and the other is the return button.

(2) Add the following ActionScript in the "A, fluent" button:

On (release) {

_root.attachmovie ("Right", "a", 1);

SetProperty ("A", _x, 60);

SetProperty ("A", _y, 100);

}//connection "right" movie

In the same vein, add the following ActionScript to the remaining three buttons:

On (release) {

_root.attachmovie ("Wrong", "B", 1);

SetProperty ("B", _x, 60);

SetProperty ("B", _y, 100);

}//connection "wrong" movie

(3) Open the "right" film, add some feedback in the text, plus a return button. Add the following ActionScript to the return button:

On (release) {

Removemovieclip (this);/clear Connected ' right ' movie

}

Similarly set in the "wrong" movie.

(4) In accordance with the second step of "1" to connect the film method, respectively, "right" "wrong" for the connection name set.

Finally press the "Ctrl+enter" key to test the effect.

Note: The above two examples of the source program download URL is:Http://www.hzgz.net/pjc/kjy/download/lizi.rar



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.