开发者

Movie Clip Keeps Appearing Behind

I have two movie clips called mc_England and mc_Scotland they are on separate layers but placed on the stage in the same position.

When I click the close button on one of the clips I can't tell which close button I'm clicking.

If I move the two movie clips onto different parts of the stage the code below works correctly.

I'm probably missing something simple but I cant see what?

Any help would be great.

UPDATE:

As the Close button being in the same position was causing the problem.

I decided to set the position of each Movie clip to come on and off stage.

This works apart from the FinishTween not completing befo开发者_如何学Pythonre re positioning the movie clip.

Is there a way to set the position after a tween has completed?

import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
import flash.display.MovieClip;

//Buttons Open
btn_England_Open.addEventListener(MouseEvent.CLICK, England_Open);
btn_Scotland_Open.addEventListener(MouseEvent.CLICK, Scotland_Open);


//Button Close
mc_England.btn_England_Close.addEventListener(MouseEvent.CLICK, England_Close);
mc_Scotland.btn_Scotland_Close.addEventListener(MouseEvent.CLICK, Scotland_Close);


//Open Functions
function England_Open(e:MouseEvent){
    StartTween(mc_England);
}
function Scotland_Open(e:MouseEvent){
    StartTween(mc_Scotland);
}

//Close Function
function England_Close(e:MouseEvent){
    FinishTween(mc_England);
}
function Scotland_Close(e:MouseEvent){
    FinishTween(mc_Scotland);
}


//Tween Function
useSeconds);
function StartTween(target:MovieClip){
    target.x = 386.90;
    target.y = 195.00;
    var myTween:Tween = new Tween(target, "alpha", Strong.easeIn, 0, 1, 0.5, true);
    //myTween.start();
}

//Tween Function
function FinishTween(target:MovieClip){
    var myTween:Tween = new Tween(target, "alpha", Strong.easeOut, 1, 0, 0.5, true);
    //myTween.start();
    target.x = -100;
    target.y = -100;
}


What specifically do you mean by "breaks" the FinishTween function?

Are the close buttons in the same location as well? I would take a look to confirm that the object you expect to be dispatching the MouseEvent is really the one doing it. Even if the close button is tweened to 0 alpha, it is still listening for MouseEvents if it's area is clicked on.


if the problem is that when you click the close button of one clip you get both FinishTweens started (the only one i can imagine after reading the question):

function England_Close(e:MouseEvent){
    e.stopPropagation();
    FinishTween(mc_England);
}
function Scotland_Close(e:MouseEvent){
    e.stopPropagation();
    FinishTween(mc_Scotland);
}

or else i need more details

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜