bring to front mc
i need certain mc to be brought to front of stage upon clicking on a button, and then instruct that mc to go to frame 2 and play.
thanks
i need certain mc to be brought to front of stage upon clicking on a button, and then instruct that mc to go to frame 2 and play.
thanks
thank you however it still doest work
can you help?
this is my script:
import flash.events.TimerEvent;
import flash.events.TouchEvent;
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
kfir1.addEventListener(TouchEvent.TOUCH_BEGIN, bgn);
kfir1.addEventListener(TouchEvent.TOUCH_END, stp);
var fl_DragBounds_10:Rectangle = new Rectangle(0, 0, stage.stageWidth, stage.stageHeight);
function bgn(event:TouchEvent):void
{
event.currentTarget.startTouchDrag(event.touchPointID, false, fl_DragBounds_10);
}
function stp(event:TouchEvent):void
{
event.currentTarget.stopTouchDrag(event.touchPointID);
if (kfir1.hitTestObject(lion))
{
lion.gotoAndPlay(2)
parent.setChildIndex(lion,1);
kfir1.visible=0
}
}
ב-26 באפר׳ 2019, בשעה 4:33 אח׳, resdesign <forums_noreply@adobe.com<mailto:forums_noreply@adobe.com>> כתב/ה:
bring to front mc
created by resdesign<https://forums.adobe.com/people/resdesign> in Adobe Animate - View the full discussion<https://forums.adobe.com/message/11047815#11047815>
Hi udik
Detect the number of children of the parent container of your event.currentTarget in order to set the highest possible childindex.
Your stp function:
function stp (event:TouchEvent):void {
event.currentTarget.stopTouchDrag(event.touchPointID);
if (kfir1.hitTestObject(lion)) {
lion.gotoAndPlay(2)
parent.setChildIndex(lion,1);
kfir1.visible = 0
}
}
I'm not sure about your event context (Multitouch.inputMode), but things can't work this way. Mainly setting the setChildIndex for the lion just to 1 puts it in the stacking order of the child array into the second lowest position. To set the lion (in this case) to the top position, find out how many children there are in the parent container and set the lion to the top of the range.
My suggestion for the stp function:
function stp (event:TouchEvent):void {
var hiIdx: int; /* to hold numChildren-1 =/= highest occupied index */
var ect = event.currentTarget;
ect.stopTouchDrag(event.touchPointID);
if (kfir1.hitTestObject(lion)) {
ect.gotoAndPlay(2);
// -----------------------------------------
hiIdx = ect.parent.numChildren - 1;
ect.parent.setChildIndex(event.target,hiIdx);
// -----------------------------------------
kfir1.visible = false;
}
}
hope it helps
Klaus
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.