我想问,
1如何将焦点放在AS3中的TextField中。在AS2中我通常使用
Selection.setFocus("<name of textfield instance>");
fscommand("activateTextField");
2.如何在AS3中复制动画片段。在AS2我正在使用
<name of movie clip>.duplicateMovieClip();
由于
答案 0 :(得分:0)
这是两个单独的问题,这两个问题都可以在线解答:
使用stage.focus
将焦点设置在任何显示对象上:
stage.focus = name_of_textfield;
没有直接等同于duplicateMovieClip
,但您可以通过从原始显示对象类创建new
实例并复制原始属性来执行approximately the same thing: / p>
function duplicateDisplayObject(target:DisplayObject):DisplayObject {
var targetClass:Class = Object(target).constructor;
var duplicate:DisplayObject = new targetClass() as DisplayObject;
// duplicate properties
duplicate.transform = target.transform;
duplicate.filters = target.filters;
duplicate.cacheAsBitmap = target.cacheAsBitmap;
duplicate.opaqueBackground = target.opaqueBackground;
if (target.scale9Grid)
duplicate.scale9Grid = target.scale9Grid;
if (target.parent)
target.parent.addChild(duplicate);
if (target.hasOwnProperty("graphics") && target["graphics"] is Graphics)
Graphics(duplicate["graphics"]).copyFrom(Graphics(target["graphics"]));
return duplicate;
}
duplicateDisplayObject(name_of_movieclip);