当前位置: 首页 > 图文教程 > Flash动画 > Flash动画制作 > Flash MX 2004新特性实例(1)

Flash动画制作
Flash新手入门教程:AS2代码中duplicateMOvieClip的应用
Flash新手入门教程:AS代码实现漂亮的立体球旋转效果
Flash新手入门教程:AS代码打造漂亮的螺旋上升效果
Flash新手入门教程:初识Flash的开始页面、界面、工具栏
Flash新手入门教程:文件的导出和导入
Flash新手入门教程:AS入门第一课_认识编程环境
Flash cs3仿真艺术设计3.2:遮罩运用制作飘扬的旗帜
Flash AS3.0菜鸟学飞教程:创建Bitmap类
Flash AS 3.0入门教程:初识AS 3.0
Flash cs3仿真艺术设计3.3:遮罩运用打造光圈变换效果
Flash AS3.0菜鸟学飞教程:用反射动态创建实例
Flash cs3仿真艺术设计3.4:遮罩运用制作手写字效果
Flash cs3仿真艺术设计3.5:遮罩运用之聚光灯效果
Flash AS3.0菜鸟学飞教程:代码的位置
Flash实例教程:AS 3.0打造漂亮的水汶效果
Flash cs3仿真艺术设计3.6:运用遮罩打造焦点效果
Flash AS 3.0实例教程:Main类打造发散效果
Flash cs3仿真艺术设计4.1:阴影的基本运用
Flash cs3仿真艺术设计4.2:阴影之投影的应用
Flash cs3仿真艺术设计4.3:阴影之透视阴影

Flash动画制作 中的 Flash MX 2004新特性实例(1)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-22   浏览: 66 ::
收藏到网摘: n/a

实例一、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};

    

  mcfocus._parent.localToGlobal(mcloc);

  //注释3

  // Move the arrow to point to it

  this._parent.arrow_mc._x = mcloc.x;

  this._parent.arrow_mc._y = mcloc.y;

  } else {

  //注释4

  label.text = "There is no object in focus.";

  this._parent.arrow_mc._x = 0;

  this._parent.arrow_mc._y = 0;

  }

  }

  //注释5

  function onClick (evt) {

  if (evt.target.selectedRadio == radio_single) {

  colorList.multipleSelection = false;

  } else {

  colorList.multipleSelection = true;

  }

  }

  //注释6

  radioGroup.addEventListener("click", onClick);

  radio_single.selected = true;

  2004中的Action跟MX的Action有很大的区别,所以尽量详细的解释。  

   注释1:是版权信息,实例的来源是在Flash MX 2004的帮助文件中,所以保留这样的版权信息。

    注释2:这个函数是根据鼠标选定的组件来更改在Display中显示的内容。

    注释3:将箭头移动到鼠标选定的组件附近。

    注释4:鼠标没有选定如何组件,将箭头放在左上角。

评论 (0) All

登陆 还没注册?