2

我是 Adob​​e Flash CS6 的 Actionscript 3.0 的初学者。我正在尝试为网络作品集制作一个基本的、简单的动画交互式徽标,并且在尝试修复徽标中三角形的翻转问题时遇到了问题。使用我自己学习的当前编码,我能够使用电影剪辑而不是按钮来获得很好的动画和反应。但是,即使您试图将鼠标悬停在其后面的影片剪辑上,执行此方法也会导致舞台上最前面的影片剪辑的“命中框”播放其动画。

这是有问题的网页:

http://inancarrow.wix.com/home

请注意,当您滚动到黄色三角形的左角或底角时,蓝色的“游戏”动画或绿色的“技能”动画会淡入并播放,而不是黄色的“连接”动画。

我试图通过尝试将影片剪辑转换为按钮来解决这个小而烦人的问题,当人们将鼠标悬停在形状上时可以做出准确的响应。结果是所有具有动画的影片剪辑都无法控制地播放并循环播放它们的动画。从我所做的搜索来看,它与嵌套电影剪辑有关......

我花了太多时间试图找出问题所在以及如何自己解决问题,这就是为什么我要寻求帮助、建议或洞察力,以了解如何解决重叠翻转问题,或如何解决修复我的movieClips 无法控制地播放。

这是我一直在使用的代码:

RedIFader.addEventListener(MouseEvent.ROLL_OVER, RedIOver);
RedIFader.addEventListener(MouseEvent.ROLL_OUT, RedIOut);
//RedIFader.addEventListener(MouseEvent.ROLL_OVER, RedIClick);

function RedIOver(event:MouseEvent):void{
    BioFadeIn.gotoAndPlay("BioFadeInOver")
    BlueAFader.gotoAndPlay("BlueAFaderOver")
    GreenAFader.gotoAndPlay("GreenAFaderOver")
    YellowNFader.gotoAndPlay("YellowNFaderOver")
}

function RedIOut(event:MouseEvent):void{
    BioFadeIn.gotoAndPlay("BioFadeInOut")
    BlueAFader.gotoAndPlay("BlueAFaderOut")
    GreenAFader.gotoAndPlay("GreenAFaderOut")
    YellowNFader.gotoAndPlay("YellowNFaderOut")
}

BlueAFader.addEventListener(MouseEvent.ROLL_OVER, BlueAOver);
BlueAFader.addEventListener(MouseEvent.ROLL_OUT, BlueAOut);
//BlueAFader.addEventListener(MouseEvent.ROLL_OVER, BlueAClick);

function BlueAOver(event:MouseEvent):void{
    GamesFadeIn.gotoAndPlay("GamesFadeInOver")
    RedIFader.gotoAndPlay("RedIFaderOver")
    GreenAFader.gotoAndPlay("GreenAFaderOver")
    YellowNFader.gotoAndPlay("YellowNFaderOver")
}

function BlueAOut(event:MouseEvent):void{
    GamesFadeIn.gotoAndPlay("GamesFadeInOut")
    RedIFader.gotoAndPlay("RedIFaderOut")
    GreenAFader.gotoAndPlay("GreenAFaderOut")
    YellowNFader.gotoAndPlay("YellowNFaderOut")
}

GreenAFader.addEventListener(MouseEvent.ROLL_OVER, GreenAOver);
GreenAFader.addEventListener(MouseEvent.ROLL_OUT, GreenAOut);
//GreenAFader.addEventListener(MouseEvent.ROLL_OVER, GreenAClick);

function GreenAOver(event:MouseEvent):void{
    SkillsFadeIn.gotoAndPlay("SkillsFadeInOver")
    RedIFader.gotoAndPlay("RedIFaderOver")
    BlueAFader.gotoAndPlay("BlueAFaderOver")
    YellowNFader.gotoAndPlay("YellowNFaderOver")
}

function GreenAOut(event:MouseEvent):void{
    SkillsFadeIn.gotoAndPlay("SkillsFadeInOut")
    RedIFader.gotoAndPlay("RedIFaderOut")
    BlueAFader.gotoAndPlay("BlueAFaderOut")
    YellowNFader.gotoAndPlay("YellowNFaderOut")
}

YellowNFader.addEventListener(MouseEvent.ROLL_OVER, YellowNOver);
YellowNFader.addEventListener(MouseEvent.ROLL_OUT, YellowNOut);
//YellowNFader.addEventListener(MouseEvent.ROLL_OVER, YellowNClick);

function YellowNOver(event:MouseEvent):void{
    ConnectFadeIn.gotoAndPlay("ConnectFadeInOver")
    RedIFader.gotoAndPlay("RedIFaderOver")
    BlueAFader.gotoAndPlay("BlueAFaderOver")
    GreenAFader.gotoAndPlay("GreenAFaderOver")
}

function YellowNOut(event:MouseEvent):void{
    ConnectFadeIn.gotoAndPlay("ConnectFadeInOut")
    RedIFader.gotoAndPlay("RedIFaderOut")
    BlueAFader.gotoAndPlay("BlueAFaderOut")
    GreenAFader.gotoAndPlay("GreenAFaderOut")
}

感谢您的时间和考虑。

4

2 回答 2

0

对我来说,这似乎来自您的剪辑是三角形的事实,可能使用蓝色、绿色、黄色三角形和红色 i 的图片(PNG 格式图像?...)。

事实是,即使在 PNG 的透明区域滚动时,图片上的翻转也往往会被调度,这显然是在这里发生的事情。

为了解决这个问题,您可以尝试使用例如应该解决此问题的InteractivePNG

如果您不使用 PNG 文件,解决方案就像从影片剪辑的空白部分中删除任何现有的矢量填充,甚至是透明的矢量填充一样简单。

于 2012-12-11T16:55:23.823 回答
0

我不确定我是否理解您的问题,但如果我理解,这是您可以执行的解决方案:

在您的翻转处理程序上,将其他颜色mouseEnabledmouseChildren属性设置为false.

RedIFader.mouseEnabled = false;
RedIFader.mouseChildren = false;

然后在您推出时,将它们全部设置为 true:

RedIFader.mouseEnabled = true;
RedIFader.mouseChildren = true;

这将阻止其他颜色触发鼠标事件,直到鼠标离开当前颜色。


如果这不是您的问题,那么我建议使用虚拟对象:

创建一个虚拟形状(alpha 为 0),将其转换为影片剪辑并将其放在您希望鼠标悬停的位置。然后将翻转/退出侦听器添加到假人。您可能希望在所有颜色对象上将mouseEnabled&设置mouseChildren为 false,这样它们就不会妨碍您。

//disable all the color buttons mouse interactions
RedIFader.mouseEnabled = false;
BlueAFader.mouseEnabled = false;
GreenAFader.mouseEnabled = false;
YellowNFader.mouseEnabled = false;
RedIFader.mouseChildren = false;
BlueAFader.mouseChildren = false;
GreenAFader.mouseChildren = false;
YellowNFader.mouseChildren = false;

//add listeners to the dummys
RedDummy.addEventListener(MouseEvent.ROLL_OVER,btnRollOver);
RedDummy.addEventListener(MouseEvent.ROLL_OUT,btnRollOut);
BlueDummy.addEventListener(MouseEvent.ROLL_OVER,btnRollOver);
BlueDummy.addEventListener(MouseEvent.ROLL_OUT,btnRollOut);
GreenDummy.addEventListener(MouseEvent.ROLL_OVER,btnRollOver);
GreenDummy.addEventListener(MouseEvent.ROLL_OUT,btnRollOut);
YellowDummy.addEventListener(MouseEvent.ROLL_OVER,btnRollOver);
YellowDummy.addEventListener(MouseEvent.ROLL_OUT,btnRollOut);

function btnRollOver(e:Event):void {

    if(e.currentTarget != RedDummy){
        RedIFader.gotoAndPlay("RedIFaderOver");
    }else{
        BioFadeIn.gotoAndPlay("BioFadeInOver")
    }
    if(e.currentTarget != BlueDummy){
        BlueAFader.gotoAndPlay("BlueAFaderOver");
    }else{
        GamesFadeIn.gotoAndPlay("GamesFadeInOver");
    }
    if(e.currentTarget != GreenDummy){
        GreenAFader.gotoAndPlay("GreenAFaderOver");
    }else{
        SkillsFadeIn.gotoAndPlay("SkillsFadeInOver");
    }
    if(e.currentTarget != YellowDummy){
        YellowAFader.gotoAndPlay("YellowAFaderOver");
    }else{
        ConnectFadeIn.gotoAndPlay("ConnectFadeInOver");
    }
}

function btnRollOut(e:Event):void {
    if(e.currentTarget != RedDummy){
        RedIFader.gotoAndPlay("RedIFaderOut");
    }else{
        BioFadeIn.gotoAndPlay("BioFadeInOut")
    }
    if(e.currentTarget != BlueDummy){
        BlueAFader.gotoAndPlay("BlueAFaderOut");
    }else{
        GamesFadeIn.gotoAndPlay("GamesFadeInOut");
    }
    if(e.currentTarget != GreenDummy){
        GreenAFader.gotoAndPlay("GreenAFaderOut");
    }else{
        SkillsFadeIn.gotoAndPlay("SkillsFadeInOut");
    }
    if(e.currentTarget != YellowDummy){
        YellowAFader.gotoAndPlay("YellowAFaderOut");
    }else{
        ConnectFadeIn.gotoAndPlay("ConnectFadeInOut");
    }
}
于 2012-12-06T17:48:11.363 回答