• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

bring object to front air for ios

Explorer ,
Jul 26, 2019 Jul 26, 2019

Copy link to clipboard

Copied

i have mc on stage called team which has 11 children "(players[myNum])" that are randomly  triggered by button called "caller".

what script do i have to add to function"calling" in order to bring the randomly child to front?

stop()

var players:Array = [team.christian,team.danny,team.davinson,team.dele,team.harry,team.heung,team.hugo,team.jan,team.kieran,team.moussa,

team.tanguy]

var chosen

var picture

Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;

team.addEventListener(TouchEvent.TOUCH_BEGIN, BeginHandler);

team.addEventListener(TouchEvent.TOUCH_END, EndHandler);

caller.addEventListener(TouchEvent.TOUCH_BEGIN, calling);

var orech:Number=11;

var DragBounds:Rectangle = new Rectangle(0, 0, stage.stageWidth, stage.stageHeight);

function calling(event:TouchEvent):void

{

var myNum:Number = Math.floor(Math.random()*orech);

orech= orech-1;

players[myNum].x=200;

players[myNum].y=750;

this is the place i want to add the bring to front script

caller.x=1200

........

    chosen=players[myNum];

players.splice(myNum,1)

if (orech==0)

{

gotoAndStop(2)

}

}

function BeginHandler(event:TouchEvent):void

{

event.target.startTouchDrag(event.touchPointID, false, DragBounds);

event.target.width=135

event.target.height=135

}

function EndHandler(event:TouchEvent):void

{

event.target.stopTouchDrag(event.touchPointID);

if (chosen.hitTestPoint(picture.x,picture.y)) { 

      

......

      

melel.text="wrong"

chosen.x=200;

chosen.y=750;

chosen.width=290

chosen.height=295

    }

}

Views

277

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 26, 2019 Jul 26, 2019

function calling(event:TouchEvent):void

{

var myNum:Number = Math.floor(Math.random()*orech);

orech= orech-1;

players[myNum].x=200;

players[myNum].y=750;

bringTo FrontF(players[myNum]);

.

.

.

}

function bringToFrontF(mc:MovieClip):void{

if(mc.stage){

mc.parent.addChild(mc);

}

}

Votes

Translate

Translate
Community Expert ,
Jul 26, 2019 Jul 26, 2019

Copy link to clipboard

Copied

function calling(event:TouchEvent):void

{

var myNum:Number = Math.floor(Math.random()*orech);

orech= orech-1;

players[myNum].x=200;

players[myNum].y=750;

bringTo FrontF(players[myNum]);

.

.

.

}

function bringToFrontF(mc:MovieClip):void{

if(mc.stage){

mc.parent.addChild(mc);

}

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 27, 2019 Jul 27, 2019

Copy link to clipboard

Copied

thank you

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 27, 2019 Jul 27, 2019

Copy link to clipboard

Copied

LATEST

you're welcome.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines