alright, so i have a class that is hittesting itself on an object on the stage.
but it keeps returning the object undefined.
[FONT=Courier New]
[/FONT]ActionScript Code:
[LEFT][FONT=Courier New]</p>[/FONT]
[FONT=Courier New]<p>package [COLOR=#000000]{[/COLOR]</p>[/FONT]
[FONT=Courier New]<p> [COLOR=#0000ff]import[/COLOR] flash.[COLOR=#000080]display[/COLOR].;</p>[/FONT]
[FONT=Courier New]<p> [COLOR=#0000ff]import[/COLOR] flash.[COLOR=#000080]events[/COLOR].;</p>[/FONT]
[FONT=Courier New]<p> [COLOR=#0000ff]public[/COLOR] [COLOR=#000000]class[/COLOR] Base [COLOR=#0000ff]extends[/COLOR] [COLOR=#0000ff]MovieClip[/COLOR] [COLOR=#000000]{[/COLOR]</p>[/FONT]
[FONT=Courier New]<p> [COLOR=#0000ff]public[/COLOR] [COLOR=#0000ff]static[/COLOR] [COLOR=#000000]var[/COLOR] cName:[COLOR=#0000ff]String[/COLOR];</p>[/FONT]
[FONT=Courier New]<p> [COLOR=#0000ff]public[/COLOR] [COLOR=#000000]var[/COLOR] speed:[COLOR=#0000ff]Number[/COLOR] = [COLOR=#000080]3[/COLOR];</p>[/FONT]
[FONT=Courier New]<p> [COLOR=#0000ff]private[/COLOR] [COLOR=#000000]var[/COLOR] grav:[COLOR=#0000ff]Number[/COLOR] = [COLOR=#000080]3[/COLOR], grounded:[COLOR=#0000ff]Boolean[/COLOR] = [COLOR=#000000]false[/COLOR];</p>[/FONT]
[FONT=Courier New]<p> [COLOR=#0000ff]public[/COLOR] [COLOR=#000000]function[/COLOR] BaseCOLOR=#000000[/COLOR]:[COLOR=#0000ff]void[/COLOR] [COLOR=#000000]{[/COLOR]</p>[/FONT]
[FONT=Courier New]<p> [COLOR=#0000ff]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]“Main Game Base Has Started…”[/COLOR][COLOR=#000000])[/COLOR];</p>[/FONT]
[FONT=Courier New]<p> [COLOR=#0000ff]stage[/COLOR].[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]KeyboardEvent.[COLOR=#000080]KEY_DOWN[/COLOR], checkKey[COLOR=#000000])[/COLOR];</p>[/FONT]
[FONT=Courier New]<p> [COLOR=#0000ff]this[/COLOR].[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]Event.[COLOR=#000080]ENTER_FRAME[/COLOR], main[COLOR=#000000])[/COLOR];</p>[/FONT]
[FONT=Courier New]<p> [COLOR=#000000]}[/COLOR]</p>[/FONT]
[FONT=Courier New]<p> [COLOR=#0000ff]public[/COLOR] [COLOR=#000000]function[/COLOR] checkKeyCOLOR=#000000[/COLOR]:[COLOR=#0000ff]void[/COLOR] [COLOR=#000000]{[/COLOR]</p>[/FONT]
[FONT=Courier New]<p> [COLOR=#0000ff]if[/COLOR] [COLOR=#000000]([/COLOR]event.[COLOR=#000080]keyCode[/COLOR] == [COLOR=#000080]39[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]</p>[/FONT]
[FONT=Courier New]<p> [COLOR=#0000ff]this[/COLOR].[COLOR=#000080]x[/COLOR]+=speed;</p>[/FONT]
[FONT=Courier New]<p> [COLOR=#000000]}[/COLOR]</p>[/FONT]
[FONT=Courier New]<p> [COLOR=#0000ff]if[/COLOR] [COLOR=#000000]([/COLOR]event.[COLOR=#000080]keyCode[/COLOR] == [COLOR=#000080]37[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]</p>[/FONT]
[FONT=Courier New]<p> [COLOR=#0000ff]this[/COLOR].[COLOR=#000080]x[/COLOR]-=speed;</p>[/FONT]
[FONT=Courier New]<p> [COLOR=#000000]}[/COLOR]</p>[/FONT]
[FONT=Courier New]<p> [COLOR=#000000]}[/COLOR]</p>[/FONT]
[FONT=Courier New]<p> [COLOR=#0000ff]public[/COLOR] [COLOR=#000000]function[/COLOR] mainCOLOR=#000000[/COLOR]:[COLOR=#0000ff]void[/COLOR] [COLOR=#000000]{[/COLOR]</p>[/FONT]
[FONT=Courier New]<p> [COLOR=#0000ff]trace[/COLOR]COLOR=#000000[/COLOR];</p>[/FONT]
[FONT=Courier New]<p> [COLOR=#0000ff]while[/COLOR] COLOR=#000000[/COLOR][COLOR=#000000]{[/COLOR]</p>[/FONT]
[FONT=Courier New]<p> !grounded;</p>[/FONT]
[FONT=Courier New]<p> [COLOR=#000000]}[/COLOR]</p>[/FONT]
[FONT=Courier New]<p> [COLOR=#000000]}[/COLOR]</p>[/FONT]
[FONT=Courier New]<p> [COLOR=#000000]}[/COLOR]</p>[/FONT]
[FONT=Courier New]<p>[COLOR=#000000]}[/COLOR]</p>[/FONT]
[FONT=Courier New]<p>[/FONT][/LEFT]