# Please help, elemts wont add to arrays

**URL:** https://forum.kirupa.com/t/please-help-elemts-wont-add-to-arrays/197979
**Category:** Uncategorized
**Created:** [August 21, 2006, 1:54pm UTC](https://forum.kirupa.com/t/please-help-elemts-wont-add-to-arrays/197979 "2006-08-21T13:54:20Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![chevron8653](https://avatars.discourse-cdn.com/v4/letter/c/6f9a4e/32.png) [@chevron8653](https://forum.kirupa.com/u/chevron8653)
#### Post date: [August 21, 2006, 1:54pm UTC](https://forum.kirupa.com/t/please-help-elemts-wont-add-to-arrays/197979/1 "2006-08-21T13:54:20Z")

</div>

Hey guys. well i made a topic about this a week or so ago but no reponce with that one so i thought id try again and this time make my self more clear as to what im wanting my code to do.

Ok well i created an array as show below on frame one in the main timeline.

var dialedsymbols:Array = new Array();

and i have a movie clip called jj\_mc with the following on clip event code.

onClipEvent (keyDown) {  
if ( Key.getAscii() == 47 && this.\_alpha == 100 && \_global.Isjj == 0 ){  
this.gotoAndPlay("\_engaging")  
}  
}

and amoung that i have this code below which i have been trying to intergrate it into the onclipevent code so when they press the key on the keyboard it adds jj\_mc to the dialedsymbols array only once.  
below is the code ive tried arranging different ways with the onclip event

\_root.dialedsymbols.push(“jj\_mc”)

but nothing i try works.

here are some examples ive tried.

onClipEvent (keyDown) {  
if ( Key.getAscii() == 47 && this.\_alpha == 100 && \_global.Isjj == 0 ){  
this.gotoAndPlay("\_engaging") && \_root.dialedsymbols.push(“jj\_mc”)  
}  
}

theres also this one ive tried.

onClipEvent (keyDown) {  
if ( Key.getAscii() == 47 && this.\_alpha == 100 && \_global.Isjj == 0 ){  
this.gotoAndPlay("\_engaging")  
\_root.dialedsymbols.push(“jj\_mc”)  
}  
}

and also to see if that worked i tried adding a trace action in like this

onClipEvent (keyDown) {  
if ( Key.getAscii() == 47 && this.\_alpha == 100 && \_global.Isjj == 0 ){  
this.gotoAndPlay("\_engaging")  
\_root.dialedsymbols.push(“jj\_mc”)  
trace (dialedsymbols)  
}  
}

but the trace in the code does work but in the output box it says undefined.

so does ne one know how i can get this to work.  
now remember i only want it to add the element jj\_mc once to the dialedsymbols array when the user press the key assigned to it in the on clip event.

thanks in advanced hope someone outthere can help.
