The trial version of the Flash MX 2004 is finally available for download, and it helps the examples that come with it in the file reflect the new additions to the 2004 feature. Let's learn more about the new features in 2004 by learning these examples. These examples are from the Flash MX 2004 Help documentation. The save path in my windows2000 is c:documents and settingsadministratorlocal settingsapplication datamacromediaflash MX 2004enConfigurationSamples. If you can't find it, search for "Samples" in the Find file.
Let's learn about the exciting new features in Flash MX 2004. The explanations of each instance are divided into three parts, which are related to characteristics, production process and actual use.
Example one, Accessible applications
I. Characteristics involved
This example mainly involves the application of new components, as well as the programming of components. In 2004, components are divided into three categories: data, Media, and UI. The surprise is that almost all of the components needed to make a Web application are already included in the UI category, and it's no trouble to create a Web page in flash later. And through programming can be flexible and comprehensive control of the components.
Second, the production process
1. Press Ctrl + F8 to create a new symbol with the type "Movie Clip" named "Display". Drag a "label" component into the scene of this symbol, named "label". Drag this symbol to the scene, named "Display."
2. Drag a "List" component to the scene, named "ColorList", and add the content "Green", "Blue", "Brown", "Red", "Orange" and "Purple" in the label attribute.
3. Drag two "Text Input" components into the scene, named "Usernameinput" and "Passwordinput" respectively, and set the "password" in the second property to True.
4. Drag a "button" component to the scene, named "Submitbutton", and set the Label property to "Submit".
5. Drag two "Radio button" components to the scene, named "Radio_single" and "radio_multiple" respectively, setting the Label property to "single Selection" and "multiple Selection ".
6. Drag four "Label" components to the scene, named "caption", "Username_label", "Password_label", "Select_label", respectively. Set the "Text" property to "Please enter your name", "" "Name:" "," "", "" Please Choose Item: ".
7. Press Ctrl + F8 to create a new symbol with the type "Movie Clip", named "ARROW_MC". Draws an arrow in this symbol's scene. Drag this symbol to the scene, named "Arrow_mc". Adjust the layout of symbol in the scene as shown in the figure.
8. Add a layer to the timeline of the main scene named "Action", and add the code to the action Panel on this layer as follows:
Note 1
/* Copyright 2003 Macromedia, Inc. All rights reserved.
The following is Sample Code and are subject to all restrictions
On such code as contained in the end User License agreement
Accompanying this product.
*/
NOTE 2
Display.onenterframe = function () {
if (Selection.getfocus ()!= null) {
var Mcfocus:movieclip;
var mcloc:object = {x:0, y:0};
Get the object so ' s in focus
Mcfocus = eval (Selection.getfocus ());
Set the label
This.label.text = Mcfocus;
Get the location's the object in global coordinates
Mcloc = {x:mcfocus._x, y:mcfocus._y};
Mcfocus._parent.localtoglobal (Mcloc);
Note 3
Move the arrow to point to it
this._parent.arrow_mc._x = mcloc.x;
this._parent.arrow_mc._y = MCLOC.Y;
} else {
Note 4
Label.text = "There is no object with focus.";
this._parent.arrow_mc._x = 0;
this._parent.arrow_mc._y = 0;
}
}
Note 5
function OnClick (evt) {
if (Evt.target.selectedRadio = = Radio_single) {
Colorlist.multipleselection = false;
} else {
Colorlist.multipleselection = true;
}
}
Note 6
Radiogroup.addeventlistener ("click", OnClick);
Radio_single.selected = true;
The action in 2004 is very different from the MX action, so try to explain it in detail.
NOTE 1: Copyright information, the source of the instance is in the Flash MX 2004 Help file, so keep this copyright information.
Note 2: This function changes the content displayed in display based on the components selected by the mouse.
Note 3: Move the arrows near the selected component of the mouse.
Note 4: The mouse does not select how to component, and the arrow is placed in the upper-left corner.
Note 5: Is the radio button's listening function, which sets the properties in the list component based on the selected radio button.
Note 6: Adds event listening for the "click" to two radio button components, listens for "OnClick", and sets the default selected radio button to be a radio.
Iii. Practical uses
This example is primarily concerned with the UI components and the programming of the components. UI components are used primarily on the web, such as rich components and flexible controls that make the job easier when you make a form in a Web page with Flash. It also provides the idea of a component application: Not only can you encapsulate commonly used things into components, but you can also control components more flexibly by programming.
Case II, Behaviors scrapbook
I. Characteristics involved
There are two features involved in this instance: Reading pictures and setting symbol levels. Not a new addition, but the performance improvement is still relatively large.
Second, the production process
1. Press Ctrl + F8 to create a new symbol, type "Movie Clip", named "Photo", and draw a black rectangle in this symbol.
2. Press Ctrl + F8 to create a new symbol with the type "Movie Clip", named "snapshot", to draw a gray rectangle in this symbol. Drag symbol "Photo" to this symbol, adjust its position, and name it "photo."
3. Drag symbol "snapshot" five times to the scene, named "Snapshot1", "Snapshot2", "Snapshot3", "Snapshot4", "Snapshot5". Add a statement to each "snapshot" action panel, respectively, as follows:
On (Press) {
Note 1
StartDrag (this);
NOTE 2
Mx.behaviors.DepthControl.bringToFront (this);
}
On (release) {
Note 3
Stopdrag ();
}
Note 1: When the mouse is pressed, drag the picture.
NOTE 2: Set the picture for the mouse to be the front end.
Note 3: When the mouse is released, stop dragging the picture.
4. Add a layer to the timeline of the main scene named "Action", and add the code to the action Panel on this layer as follows:
/* Copyright 2003 Macromedia, Inc. All rights reserved.
The following is Sample Coe and are subject to all restrictions
On such code as contained in the end User License agreement
Accompanying this product.
*/
Note 1
This.snapshot1.photo.loadMovie ("image1.jpg");
This.snapshot2.photo.loadMovie ("image2.jpg");
This.snapshot3.photo.loadMovie ("image3.jpg");
This.snapshot4.photo.loadMovie ("image4.jpg");
This.snapshot5.photo.loadMovie ("image5.jpg");
Note 1: Read the corresponding picture from the folder where the Flash is located.
5. Save this flash document and place 5 pictures in the same folder as the Flash. Note that the name of the picture will be the same as the picture name in step 4th.
Iii. Practical uses
The ability to read pictures is already available in Flash MX. But from the picture reading speed and display effect, the improvement is still not small. Later in the use of flash to create a picture browser, you can read the file name of the picture, and then dynamically read the folder in the picture.