5 Replies Latest reply on May 9, 2016 9:19 AM by ClayUUID

    How to convert .as (Action Script 3.0) files to work on HTML5 Canvas?

    CreativeTurtle

      So I made an ActionScript 3.0 game in Animate CC using .as files with packages and classes instead of using actions e.g.

      This is a Game.as file:

       

      package
      {
        import flash.display.MovieClip;
        import flash.events.Event;
        import flash.utils.Timer;
      
        public class Game extends MovieClip
        {
        static var ship:MovieClip;
      
        function Game()
        {
        ship = new Ship(stage, 200, 100);
        var spawnTimer = new Timer(3000);
        spawnTimer.addEventListener("timer",spawn);
        spawnTimer.start();
        }
      
        function spawn(e:Event):void
        {
        var enemy = new Enemy();
        stage.addChildAt(enemy, 1);
        }
        }
      }
      

       

      I used Commands>Convert to other Document Formats and then chose HTML5 Canvas. When I run the project all of the code doesn't work because the .as files aren't linked to the project (because it's an HTML5 Canvas). So how can I convert my project from an ActionScript 3.0 to an HTML5 Canvas so that the scripts work in the game? Should I use .JSFL files? How do I link them?

       

      Thanks in advance.