| 实例一、Accessible Applications 一、涉及特性 这个实例主要涉及新增组件的应用,以及对组件的编程。在2004中,组件分为Data、Media、UI三大类别。让人惊喜的是在UI类别中差不多已经包括了制作WEB应用所需要的所有组件,以后用制作网页再也不麻烦了。而且通过编程可以对组件进行灵活、全面的控制。 二、制作过程 1. 按“Ctrl + F8”新建一个Symbol,类型为“Movie Clip”,命名为“display”。将一个“Label”组件拖到此Symbol的场景中,命名为“label”。将此Symbol拖到场景中,命名为“display”。 2. 将一个“List”组件拖到场景中,命名为“colorList”,在“label”属性中增加内容“Green”、“Blue”、“Brown”、“Red”、“Orange”、“Purple”。 3. 将两个“Text Input”组件拖到场景中,分别命名为“usernameInput” 和“passwordInput”,并设置第二个的属性中的“password”为true。 4. 将一个“Button”组件拖到场景中,命名为“submitButton”,设置“Label”属性为“Submit”。 5. 将两个“Radio Button”组件拖到场景中,分别命名为“radio_single”和“radio_multiple”,设置“Label”属性为“Single Selection”和“Multiple Selection”。 6. 将四个“Label”组件拖到场景中,分别命名为“caption”、“username_label”、“password_label”、“select_label”。分别设置“Text”属性为“Please enter your name”、“First Name:”、“Last Name:”、“Please choose an item:”。 7. 按“Ctrl + F8”新建一个Symbol,类型为“Movie Clip”,命名为“arrow_mc”。在此Symbol的场景中绘制一个箭头。将此Symbol拖到场景中,命名为“arrow_mc”。调整场景中的Symbol的布局如图所示。  8. 在主场景的时间轴上增加一个层,命名为“Action”,在此层的Action面板上增加代码如下: //注释1 /* Copyright 2003 Macromedia, Inc. All rights reserved. The following is Sample Code and is subject to all restrictions on such code as contained in the End User License Agreement accompanying this product. */ //注释2 display.onEnterFrame = function () { if (Selection.getFocus() != null) { var mcfocus:MovieClip; var mcloc:Object = {x:0, y:0}; // Get the object that's in focus mcfocus = eval(Selection.getFocus()); // Set the label this.label.text = mcfocus; // Get the location of the object in global coordinates mcloc = {x:mcfocus._x, y:mcfocus._y}; |