Highlighted

for/loop question..

Explorer ,
Feb 20, 2018

Copy link to clipboard

Copied

hey guys, im kinda new with flash, i used it long time ago and still learning few tricks..

i created this nice looking UI with DYNAMIC buttons

example:

BTN_Exit

BTN_Order

BTN_New

etc..

now, i want with in a script to make all those buttons dissapear with an effect..

something like;

for each (var Btn in MyObj)

{

     Print Btn.Name;

}

so my 1st step is to list all the buttons that i created dynamicly on main page..

any ideas how to do that?

TOPICS
Development

Views

210

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

for/loop question..

Explorer ,
Feb 20, 2018

Copy link to clipboard

Copied

hey guys, im kinda new with flash, i used it long time ago and still learning few tricks..

i created this nice looking UI with DYNAMIC buttons

example:

BTN_Exit

BTN_Order

BTN_New

etc..

now, i want with in a script to make all those buttons dissapear with an effect..

something like;

for each (var Btn in MyObj)

{

     Print Btn.Name;

}

so my 1st step is to list all the buttons that i created dynamicly on main page..

any ideas how to do that?

TOPICS
Development

Views

211

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
Feb 20, 2018 0
Advocate ,
Feb 20, 2018

Copy link to clipboard

Copied

Add those buttons in an array (or Vector if you can use that) then just loop through it and start your effect on each button with a delay. Many tween engine give the option to delay the tween so increment a delay variable in the loop and pass it along with the tween, if you can't do that then use a timer to delay the start of the tween with same principle of incrementing timing variable then pass it to a new timer, ect .... Or you can do sequential also, when one effect finishes the next one start (gives you less freedom in timing the whole thing). Make a copy of your array (or Vector): mycopy = mymainarray.concat() then start your effect with the first button: startEffect(mycopy.shift()), when the effect is over start again until the array copy is empty:

function endOfEffect():void

{

     if(mycopy.length)

     {

          startEffect(mycopy.shift())

     }

}

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...
Feb 20, 2018 0
GogetaX LATEST
Explorer ,
Feb 20, 2018

Copy link to clipboard

Copied

thank you for your faster reply.. but aint there a way to get my compoennt name?

like

if (this.Name == "BTN_Exit"){..}

and also aint there a way to read check for all components that on my parent?

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...
Feb 20, 2018 0