【发布时间】:2010-08-19 17:19:08
【问题描述】:
我一直在尝试用不同的影片剪辑在 Flash 中创建一个画廊。
Timeline
-back button
-next button
-stop button
-play button
-Main Movie
(these are inside Main Movie)
--Animation 1
--Animation 2
--Animation 3
我在 Main Movie 中设置了动画,其实例名称和帧名称如“Animation 1”。我让它播放和停止,但我不能用后退和下一个按钮来回浏览每个动画。什么是我可以解决这个问题的正确方法?
---2010 年 8 月 20 日更新
我让它工作了,但是有一个小错误。每当我单击下一步或后退按钮时,它都会转到第一个帧名称,然后是另一个。我进行了跟踪,发现它计数“ad-1、ad-2、ad-3 等”或“ad1、ad2、ad3 等”。
var currentAnimationIndex:int;
var currentAnimation:int;
var animeOstart:Number = 1;
var animeOend:Number = 3;
function playAnimation(frameIndex:int):void
{
var frameName:String = "ad" + frameIndex.toString();
trace(frameName)
ads.gotoAndPlay(frameName);
ads.movie.gotoAndPlay(1);
currentAnimationIndex = frameIndex;
}
function playBack(event:MouseEvent):void
{
--currentAnimationIndex;
if(currentAnimationIndex < animeOstart)
currentAnimation == 1;
playAnimation(currentAnimationIndex);
}
function playNext(event:MouseEvent):void
{
++currentAnimationIndex;
if(currentAnimationIndex > animeOend)
currentAnimation == 3;
playAnimation(currentAnimationIndex);
}
【问题讨论】:
-
你能提供更多细节吗?请告诉我你期望的行为和你实际得到的行为
-
抱歉耽搁了,我被困在医生办公室,明天就生病了。我试图做的是当你开始 Flash 电影时,第一个动画开始,如果你点击下一个按钮,你会转到第二个动画,当你到达最后一个动画时,它会回到第一个动画,同样为背面在反面。我希望有帮助。再次抱歉,如果我说得不对。我一直感觉不舒服。 :(
-
对不起,我现在才看到你的评论!我已经编辑了代码,所以它应该可以按预期工作,但我看到你也找到了解决方案。抱歉回复延迟!
标签: flash actionscript-3