Dzwebs.Net

撰写电脑技术杂文十余年

Button._name 属性、MovieClip._name、TextField._name 属性、Video._name

Admin | 2012-1-15 7:37:18 | 被阅次数 | 6045

温馨提示!

如果未能解决您的问题,请点击搜索;登陆可复制文章,点击登陆

  一、_name(Button._name 属性)

  public _name : String

  由 my_btn 指定的按钮的实例名称。

  可用性:ActionScript 1.0;Flash Player 6

  示例

  下面的示例跟踪 SWF 文件的当前时间轴内所有 Button 实例的所有实例名称。

  for (i in this) {
      if (this[i] instanceof Button) {
      trace(this[i]._name);
      }
  }

  二、_name(MovieClip._name 属性)

  public _name : String

  影片剪辑的实例名称。

  可用性:ActionScript 1.0;Flash Player 4

  示例

  下面的示例允许您右键单击 (Windows) 或按住 Control 键并单击 (Macintosh) 舞台上的影片剪辑,然后从上下文菜单中选择 Info 以查看有关该实例的信息。添加几个具有实例名称的影片剪辑,然后将以下ActionScript 添加到 AS 或 FLA 文件:

  var menu_cm:ContextMenu = new ContextMenu();
  menu_cm.customItems.push(new ContextMenuItem("Info...", getMCInfo));
  function getMCInfo(target_mc:MovieClip, obj:Object) {
      trace("You clicked on the movie clip '"+target_mc._name+"'.");
      trace("\t width:"+target_mc._width+", height:"+target_mc._height);
      trace("");
  }
  for (var i in this) {
      if (typeof (this[i]) == 'movieclip') {
      this[i].menu = menu_cm;
      }
  }

  三、_name(TextField._name 属性)

  public _name : String

  文本字段的实例名称。

  可用性:ActionScript 1.0;Flash Player 6

  示例

  以下示例演示驻留在不同深度的文本字段。在舞台上创建一个动态文本字段。请将以下 ActionScript 添加到 FLA 或 AS 文件,这样就会在运行时动态创建两个文本字段,并在"输出"面板中显示它们的深度。

  this.createTextField("first_mc", this.getNextHighestDepth(), 10, 10, 100, 22);
  this.createTextField("second_mc", this.getNextHighestDepth(), 10, 10, 100, 22);
  for (var prop in this) {
      if (this[prop] instanceof TextField) {
      var this_txt:TextField = this[prop];
      trace(this_txt._name+" is a TextField at depth: "+this_txt.getDepth());
      }
  }

  四、_name(Video._name 属性)

  public _name : String

  指示指定的 Video 对象的实例名称。


该杂文来自: 动画制作杂文

上一篇:MovieClip._lockroot 属性

下一篇:Button._parent 属性、MovieClip._parent、TextFi

网站备案号:

网站备案号:滇ICP备11001339号-7

版权属性:

Copyright 2007-2021-forever Inc. all Rights Reserved.

联系方式:

Email:dzwebs@126.com QQ:83539231 访问统计