title: Haxe: Calling a function from and outside Class within Main Class
body: <p>I would like to call a function that is located outside the <code>Main</code> class of my Haxe game.</p>
  
  <p>I am able to add bubbles to the game using: <code>addChild(new Bubble(player.x, player.y));</code></p>
  
  <p>I would like to update the game without using an <code>EventListener</code> in each added object.</p>
  
  <p>The follow code: <code>Bubble.tick();</code></p>
  
  <p>Yields this error when run from main:</p>
  
  <blockquote>
    <p>Bubble has no field tick</p>
  </blockquote>
  
  <p>Bubble Class:</p>
  
  <pre><code>package;
  
  import flash.Lib;
  import flash.display.Bitmap;
  import flash.display.BitmapData;
  import flash.display.Sprite;
  import flash.display.MovieClip;
  import openfl.Assets;
  import flash.events.Event;
  
  class Bubble extends Sprite
  {
      private var newBubble:Bitmap;
      private static var gameBubble:Array&lt;Sprite&gt; = new Array&lt;Sprite&gt;();
      public function new (xpos:Float,ypos:Float) {
          super ();
          this.x = xpos;
          this.y = ypos;
          newBubble = new Bitmap (Assets.getBitmapData ("img/sprite_bubble_16x16.png"));
          newBubble.x = -12.5;
          newBubble.y = -12.5;
          addChild(newBubble);
          gameBubble.push(this);
          trace("Bubble");
      }
  
      private function tick2(e:Event) {
          this.y -= 5;
          checkPop();
      }
  
      public function tick() {
          this.y -= 5;
          checkPop();
      }
  
      private function checkPop() { 
          if(this.y &lt; 0) {
              this.parent.removeChild(this);
          }
      }
  }
  </code></pre>