Highlighted

bring object to front air for ios

Explorer ,
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

    }

}

Adobe Community Professional
Correct answer by kglad | Adobe Community Professional

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);

}

}

Views

101

Likes

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

bring object to front air for ios

Explorer ,
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

    }

}

Adobe Community Professional
Correct answer by kglad | Adobe Community Professional

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);

}

}

Views

102

Likes

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
Jul 26, 2019 0
Adobe Community Professional ,
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);

}

}

Likes

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
Reply
Loading...
Jul 26, 2019 1
Explorer ,
Jul 27, 2019

Copy link to clipboard

Copied

thank you

Likes

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
Reply
Loading...
Jul 27, 2019 1
kglad LATEST
Adobe Community Professional ,
Jul 27, 2019

Copy link to clipboard

Copied

you're welcome.

Likes

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
Reply
Loading...
Jul 27, 2019 0