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的帮助文件中,所以保留这样的版权信