# Arghh possibly undefined..cant access function

**URL:** <https://forum.kirupa.com/t/arghh-possibly-undefined-cant-access-function/309301>\
**Category:** flash\
**Created:** [May 11, 2010, 6:44pm UTC](https://forum.kirupa.com/t/arghh-possibly-undefined-cant-access-function/309301 "2010-05-11T18:44:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rimacy](https://avatars.discourse-cdn.com/v4/letter/r/839c29/32.png) [@rimacy](https://forum.kirupa.com/u/rimacy)\
**Post date:** [May 11, 2010, 6:44pm UTC](https://forum.kirupa.com/t/arghh-possibly-undefined-cant-access-function/309301/1 "2010-05-11T18:44:47Z")

</div>

Here’s my code

```auto
          
 package
 {
     import flash.display.MovieClip;
     import flash.events.*;
     import flash.utils.Timer;
     
     
     public class Game extends MovieClip
     {
         public var ship:Ship = new Ship;
         public var gameTimer:Timer;
         
         
         public function Game()
         {
             gameTimer=new Timer(25);
             gameTimer.addEventListener(TimerEvent.TIMER,onTick);
             gameTimer.start();
             trace ("game on line");
             addChild(ship);
            
         }
         
         public function onTick(timerEvent:TimerEvent):void
         {
             trace("onTick")
             moveTheShip(); [U]//I also Tried “ship.moveTheShip();”[/U]
             
         }
     }
 }
 

```

and…

```auto
package  
 {
     import flash.display.MovieClip;
     import flash.events.*;
     import flash.ui.Keyboard;
     import flash.utils.Timer;
     import game;
 

     
     public class Ship extends MovieClip
     {    
         
         
         public function Ship()
         {
             trace("ship checking in");
             
             function moveTheShip():void
             {
                 
                   trace("soFarSoGood");
                 
             }
         }
     }
 }
 

```

it seems simple enough but I’m getting

1180: Call to a possibly undefined method moveTheShip.

What the… can someone help

Cheers,  
The Noooooest Nooob In Noooobland
