Skip to content
This repository was archived by the owner on Nov 16, 2021. It is now read-only.
This repository was archived by the owner on Nov 16, 2021. It is now read-only.

i got a type error in the AS3JS Live demo #19

Description

@Colly001

The error is : TypeError: Cannot read properties of undefined(reading 'packageName')

The code i am trying to convert is :

package
{
   import flash.display.Sprite;
   import alternativa.tanks.config.Config;
   import alternativa.tanks.Game;
   import flash.events.Event;
   import alternativa.tanks.GameEvent;
   import flash.display.StageScaleMode;
   import flash.display.StageAlign;
   import flash.display.StageQuality;
   
   public class TanksTestingTool extends Sprite
   {
      
      public function TanksTestingTool()
      {
         super();
         stage.scaleMode = StageScaleMode.NO_SCALE;
         stage.align = StageAlign.TOP_LEFT;
         stage.quality = StageQuality.HIGH;
         this.loadConfig("config.xml");
      }
      
      private var config:Config;
      
      private var game:Game;
      
      private function loadConfig(url:String) : void
      {
         this.config = new Config();
         this.config.addEventListener(Event.COMPLETE,this.onConfigLoadingComplete);
         this.config.load(url);
      }
      
      private function onConfigLoadingComplete(e:Event) : void
      {
         trace("Config loaded");
         this.game = new Game(this.config,stage);
         this.game.addEventListener(GameEvent.INIT_COMPLETE,this.onGameInitComplete);
      }
      
      private function onGameInitComplete(e:Event) : void
      {
         trace("Game init complete");
         stage.addEventListener(Event.ENTER_FRAME,this.onEnterFrame);
      }
      
      private function onEnterFrame(e:Event) : void
      {
         this.game.tick();
      }
      
      private function testMapping(n:int) : void
      {
         var r:* = 0;
         var c:* = 0;
         var m:* = 0;
         var i:* = 0;
         r = 0;
         while(r < n)
         {
            c = r + 1;
            while(c < n)
            {
               m = this.mapping(r,c,n);
               trace(r,c,m);
               if(m != i++)
               {
                  throw new Error();
               }
               else
               {
                  c++;
                  continue;
               }
            }
            r++;
         }
      }
      
      private function mapping(r:int, c:int, n:int) : int
      {
         return r * (n - 1) - (r * (r + 1) >> 1) + c - 1;
      }
   }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions