title: ActionScript compilation error: The name of definition 'Main' does not reflect the location of this file
body: <p>Can someone tell me what I am doing wrong with this?</p>
  
  <p>I have a movie clip called turret that is on the screen and is instanced as Turret,
  I have a movie clip called bullet and that is in the library exported for AS "bullet" no quotes.</p>
  
  <p>Here is the website <a href="http://wonderfl.net/c/du34" rel="nofollow">http://wonderfl.net/c/du34</a></p>
  
  <p>My frame (main) class is called du34</p>
  
  <p>My code for du34 is:</p>
  
  <pre><code>package 
  {
      import flash.display.Sprite;
      import flash.events.Event;
      import flash.events.MouseEvent;
  
      [SWF(width=1000, height=1000, framerate=24)]
      public class Main extends Sprite 
      {
          private static const SCREEN_WIDTH: int = 1000
          private static const SCREEN_HEIGHT: int = 1000
  
          private var turret: Turret = null
          private var me: MouseEvent = null
          private var trigger: Boolean = false
  
          private var bullets: Array = []
  
          public function Main():void 
          {
              graphics.beginFill(0x0)
              graphics.drawRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)
              graphics.endFill()
  
              turret = new Turret(SCREEN_WIDTH / 2, SCREEN_HEIGHT)
              turret.addEventListener(Turret.ADD_BULLET, onAddBullet)
              addChild(turret)
  
              addEventListener(Event.ENTER_FRAME, onEnterFrame)
              stage.addEventListener(MouseEvent.MOUSE_DOWN, function(): void { trigger = true } )
              stage.addEventListener(MouseEvent.MOUSE_UP, function(): void { trigger = false } )
          }
  
          private var nextAddBullet: Bullet = null;
          private function onAddBullet(e: BulletEvent): void {
              nextAddBullet = new Bullet(turret.x + e.pos, turret.y, mouseX, mouseY)
          }
  
          private var frameProcessing: Boolean = false
  
          private function onEnterFrame(e: Event): void {
              if (frameProcessing) return
              frameProcessing = true
  
              if (null != nextAddBullet) {
                  bullets.push(nextAddBullet)
                  addChild(nextAddBullet)
                  nextAddBullet = null
              }
  
              turret.frameAction(trigger)
              var i: int
              for (i = 0; i &lt; bullets.length; i++) {
                  var bullet: Bullet = bullets[i]
  
                  if (null != bullet) {
                      if (bullet.frameAction()) {
                          removeChild(bullet)
                          bullets[i] = null
                      }
                  }
              }
  
              i = bullets.length
              while (0 &lt; i--) {
                  if (null == bullets[i]) bullets.splice(i, 1)
              }
              frameProcessing = false
          }
      }
  }
  
  import flash.events.Event
  import flash.display.Sprite
  import flash.geom.Point
  
  class BulletEvent extends Event {
  
      private var _pos: int = 0
      public function get pos(): int { return _pos }
  
      public function BulletEvent(type:String, pos: int, bubbles:Boolean = false, cancelable:Boolean = false) {
          super(type, bubbles, cancelable);
          _pos = pos;
      }
  }
  
  // 弾丸
  class Bullet extends Sprite {
      private var t: Point
      private var d: Point
  
      private static const BULLET_SIZE: int = 3
      public function Bullet(_x: int, _y: int, _tx: int, _ty: int): void {
          graphics.beginFill(0xFFFFFF)
          graphics.drawEllipse(-BULLET_SIZE/2, -BULLET_SIZE/2, BULLET_SIZE, BULLET_SIZE)
          graphics.endFill()
  
          x = _x
          y = _y
          t = new Point(_tx, _ty)
          d = t.subtract(new Point(x, y))
          d.normalize(10)
          frameAction()
      }
  
      public function frameAction(): Boolean {
          x += d.x
          y += d.y
  
          var cx: Boolean = (0 &lt;= d.x) ? t.x &lt;= x : x &lt;= t.x;
          var cy: Boolean = (0 &lt;= d.y) ? t.y &lt;= y : y &lt;= t.y;
  
          return (cx &amp;&amp; cy)
      }
  }
  
  // 砲身
  class Barrel extends Sprite {
  
      private static const BARREL_LENGTH: int = 20
  
      private var _pos: int = 0
      private var _loading: int = 0
      public function get pos(): int { return _pos }
      public function loading(): Boolean { return 0 &lt; _loading }
  
      public function Barrel(pos: int = 0) { _pos = pos }
  
      public function frameAction(): void {
          if (0 &lt; _loading) _loading -= 2
  
          var d: Point = new Point(mouseX, mouseY)
          d.normalize(BARREL_LENGTH - _loading)
  
          graphics.clear()
          graphics.lineStyle(2, 0xc0c0c0)
          graphics.moveTo(_pos, 0)
          graphics.lineTo(d.x + _pos, d.y)
      }
  
      public function shot(): void {
          _loading = 8
      }
  }
  
  // 砲塔
  class Turret extends Sprite {
      public static const ADD_BULLET: String = "addBullet"
  
      private static const SIZE: int = 25
  
      private var barrels: Array = []
      private var actionIndex: int = 0
      private var _loading: int = 0
  
      public function Turret(_x: int, _y: int): void {
          x = _x
          y = _y
  
          barrels.push(new Barrel(-3))
          barrels.push(new Barrel(0))
          barrels.push(new Barrel(+3))
          for each (var barrel: Barrel in barrels) addChild(barrel)
  
          var armor: Sprite = new Sprite()
          with (addChild(armor)) {
              graphics.beginFill(0xe0e0e0)
              graphics.drawEllipse(-SIZE/2, -SIZE/2, SIZE, SIZE)
              graphics.endFill()
          }
      }
  
      public function loading(): Boolean { return 0 &lt; _loading }
  
      public function shot(): void {
          if (loading()) return
  
          actionIndex = (actionIndex + 1) % barrels.length
          var barrel: Barrel = barrels[actionIndex]
          if (barrel.loading()) return
          barrel.shot()
          _loading = 3;
  
          dispatchEvent(new BulletEvent(ADD_BULLET, barrel.pos))
      }
  
      public function frameAction(trigger: Boolean): void {
          if (0 &lt; _loading) _loading -= 1
  
          if (trigger) shot()
          for each (var barrel: Barrel in barrels) barrel.frameAction()
      }
  }
  </code></pre>
  
  <p>I keep getting the compiled error </p>
  
  <blockquote>
    <p>5008: The name of definition 'Main' does not reflect the location of this file. Please change the definition's name inside this file, or rename the file.du34.as</p>
  </blockquote>