# Tidying up actionscript

**URL:** <https://forum.kirupa.com/t/tidying-up-actionscript/2816>\
**Category:** flash\
**Created:** [April 3, 2002, 11:37am UTC](https://forum.kirupa.com/t/tidying-up-actionscript/2816 "2002-04-03T11:37:47Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 3, 2002, 11:37am UTC](https://forum.kirupa.com/t/tidying-up-actionscript/2816/1 "2002-04-03T11:37:47Z")

</div>

Does anyone know how I can make the following actionscript tidier? Thanks\r\r\ron (press) {\r&nbsp &nbsp &nbsp &nbsp tellTarget ("/wings") {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp if (thisframe == “1”) {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp gotoAndStop (thisframe+2);\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }\r&nbsp &nbsp &nbsp &nbsp }\r&nbsp &nbsp &nbsp &nbsp tellTarget ("/wings") {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp if (thisframe == “3”) {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp gotoAndStop (thisframe+2);\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }\r&nbsp &nbsp &nbsp &nbsp }\r&nbsp &nbsp &nbsp &nbsp tellTarget ("/wings") {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp if (thisframe == “5”) {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp gotoAndStop (thisframe+2);\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }\r&nbsp &nbsp &nbsp &nbsp }\r&nbsp &nbsp &nbsp &nbsp tellTarget ("/wings") {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp if (thisframe == “7”) {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp gotoAndStop (thisframe+2);\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }\r&nbsp &nbsp &nbsp &nbsp }\rtellTarget ("/wings") {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp if (thisframe == “9”) {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp gotoAndStop (thisframe+2);\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }\r&nbsp &nbsp &nbsp &nbsp }\rtellTarget ("/wings") {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp if (thisframe == “11”) {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp gotoAndStop (thisframe+2);\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }\r&nbsp &nbsp &nbsp &nbsp }\rtellTarget ("/wings") {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp if (thisframe == “13”) {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp gotoAndStop (thisframe+2);\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }\r&nbsp &nbsp &nbsp &nbsp }\rtellTarget ("/wings") {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp if (thisframe == “2”) {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp gotoAndStop (thisframe+1);\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }\r&nbsp &nbsp &nbsp &nbsp }\rtellTarget ("/wings") {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp if (thisframe == “4”) {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp gotoAndStop (thisframe+1);\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }\r&nbsp &nbsp &nbsp &nbsp }\rtellTarget ("/wings") {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp if (thisframe == “6”) {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp gotoAndStop (thisframe+1);\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }\r&nbsp &nbsp &nbsp &nbsp }\rtellTarget ("/wings") {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp if (thisframe == “8”) {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp gotoAndStop (thisframe+1);\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }\r&nbsp &nbsp &nbsp &nbsp }\rtellTarget ("/wings") {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp if (thisframe == “10”) {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp gotoAndStop (thisframe+1);\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }\r&nbsp &nbsp &nbsp &nbsp }\rtellTarget ("/wings") {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp if (thisframe == “12”) {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp gotoAndStop (thisframe+1);\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }\r&nbsp &nbsp &nbsp &nbsp }\rtellTarget ("/wings") {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp if (thisframe == “14”) {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp gotoAndStop (thisframe+1);\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }\r&nbsp &nbsp &nbsp &nbsp }\r}

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 3, 2002, 3:34pm UTC](https://forum.kirupa.com/t/tidying-up-actionscript/2816/2 "2002-04-03T15:34:16Z")

</div>

//assuming you use flash 5/mx\r\ron (press) {\rwith ("/wings") {\rif (\_currentframe %2 == 1) {\rgotoAndStop(\_currentframe+2);\r} else {\rgotoAndStop(\_currentframe+1);\r}\r}\r}\r\rhope that helped

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 3, 2002, 5:02pm UTC](https://forum.kirupa.com/t/tidying-up-actionscript/2816/3 "2002-04-03T17:02:45Z")

</div>

wow… nice usage of the blade there Thoriphes

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 3, 2002, 5:50pm UTC](https://forum.kirupa.com/t/tidying-up-actionscript/2816/4 "2002-04-03T17:50:45Z")

</div>

wuts the % do?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 3, 2002, 6:35pm UTC](https://forum.kirupa.com/t/tidying-up-actionscript/2816/5 "2002-04-03T18:35:11Z")

</div>

modulo was explained before, returns the remainder of first number divided by second number: 14 % 4 = 2 coz 4x3=12, remainder is 2.\rso if you need to check for an even number (true or false), just number % 2, and if it is even, modulo returns 0, easy and usefull check.\r\rbtw, “with”: no need for the slash " arget" here, just the right path…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 3, 2002, 6:59pm UTC](https://forum.kirupa.com/t/tidying-up-actionscript/2816/6 "2002-04-03T18:59:17Z")

</div>

thanks Eyez…thats what i thought it was doin…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 3, 2002, 7:32pm UTC](https://forum.kirupa.com/t/tidying-up-actionscript/2816/7 "2002-04-03T19:32:38Z")

</div>

Just curiosity : when do you have to write the / in /target when you telltarget ?? I always seeed to work for me without…\r\rpom 0]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 4, 2002, 2:06am UTC](https://forum.kirupa.com/t/tidying-up-actionscript/2816/8 "2002-04-04T02:06:37Z")

</div>

they used to use the slash back in flash 4 with referring to movieclips cause 4 didn’t have \_parent or \_root. i just added the slash there anyway cause i wasn’t sure exactly where the movie was located.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 5, 2002, 2:05pm UTC](https://forum.kirupa.com/t/tidying-up-actionscript/2816/9 "2002-04-05T14:05:05Z")

</div>

Thanks, script looks much better now!
