我看过的每个地方都指示我下载插件和插件,因为它们“优越”。当我添加/删除一个孩子时,我只是在寻找一个简单的淡入/淡出(如果我可以获得fadein,我会接受它。)这是我正在调用的函数...
var trashbagFrame:MovieClip = new menu_trashbag_mc_frame();
trashbagFrame.x = 900;
trashbagFrame.y = 0;
menu_trashbag_mc.addEventListener(MouseEvent.MOUSE_UP, trashbagContent);
function trashbagContent(event:MouseEvent):void {
if(MovieClip(root).currentFrame == 850) {
while(MovieClip(root).numChildren > 2)
{
MovieClip(root).removeChild(MovieClip(root).getChildAt(MovieClip(root).numChildren - 1));
}
MovieClip(root).addChild(trashbagFrame);
MovieClip(root).addChild (closeBtn);
}
else {
MovieClip(root).addChild(trashbagFrame);
MovieClip(root).addChild (closeBtn);
MovieClip(root).gotoAndPlay(806);
}
}
答案 0 :(得分:0)
这些网站很可能意味着像Tweener这样的插件,当您经常需要转换时,它们会更灵活/更简单。
ActionScript 3.0库在fl.transitions包中有一个名为Fade的类。
import fl.transitions.*;
import fl.transitions.easing.*;
TransitionManager.start(img1_mc, {type:Fade, direction:Transition.IN, duration:9, easing:Strong.easeOut});
https://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/fl/transitions/Fade.html
其中
img1_mc
将是您要应用转换的对象(在您的情况下是子项)。
答案 1 :(得分:0)
您可以使用enterFrame随时间更改属性。类似的东西:
var trashbag:MovieClip = new MovieClip();
trashbag.alpha = 0;
addChild(trashbag);
trashbag.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
var closeBtn:MovieClip = new MovieClip();
closeBtn.alpha = 0;
addChild(closeBtn);
closeBtn.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
function enterFrameHandler(e:Event):void
{
var targetMC:MovieClip = e.currentTarget as MovieClip;
if(targetMC.alpha >= 0.9)
{
targetMC.alpha = 1;
targetMC.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
else
{
targetMC.alpha += 5;
}
}
希望示例代码有所帮助。我没有测试过,但这个想法很有效。