我有几个库中的影片剪辑将添加到舞台,影片剪辑内部有一些我想控制它的 mc,这是我的脚本。
if (selectDiffText.text == "Collection 1 Easy")
{
var c1_easy:cartoonEasy = new cartoonEasy();
addChild(c1_easy);
c1_easy.x = 412;
c1_easy.y = 400;
TweenMax.from(c1_easy, 0.5, {alpha:0, ease:Expo.easeOut});
}
else if (selectDiffText.text == "Collection 1 Medium")
{
var c1_medium:cartoonMedium = new cartoonMedium();
addChild(c1_medium);
c1_medium.x = 412;
c1_medium.y = 400;
TweenMax.from(c1_medium, 0.5, {alpha:0, ease:Expo.easeOut});
}
else
{
trace("ERROR!");
}
如果selectDiffText发生变化,上面的代码将从库中加载特定的影片剪辑。
var movieList:Array = [cartoonMedium1,cartoonMedium2,cartoonMedium3,cartoonMedium4,cartoonMedium5,cartoonMedium6];
function getRandomMovie():MovieClip
{
var index:int = Math.floor(Math.random() * movieList.length);
var mcClass:Class = movieList.splice(index,1)[0];
return new mcClass();
}
playGame = getRandomMovie();
addChild(playGame);
假设如果将 c1_medium 添加到舞台,c1_medium 也会从库中随机添加 1 个影片剪辑。
在playGame mc 里面,我有mouseTarget.alpha = 0; ...如何从根级别控制它?c1_easy 也有 mouseTarget.alpha=0 。