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

So I did an ActionScript 3.0 game in CC animate using files as with packages and classes rather than use actions for example

There 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 the commands > convert to other Formats of Document and you select HTML5 Canvas. When I run the project all the code does not work because the .as files are not related to the project (because it is a HTML5 Canvas). So, how can I convert my project an ActionScript 3.0 for a HTML5 Canvas so that the scripts work in the game? Should I use. JSFL files? How to bind the?

Thanks in advance.

There is no external class in HTML5 Canvas Javascript file. Also, the variables are not typed. Symbols belong to the library, which will be shortened to 'lib '. You can define listeners on the createjs. Ticker, but using setTimeout() is a simple alternative.

In view of this, your AS3 could be something like this:

boat var = new lib. Ship();

Ship.x = 200;

Ship.y = 100;

stage.addChild (ship);

setTimeout (spawn, 3000);

spawn() {} function

enemy of the var = new lib. Enemy();

Enemy.x = Math.random () * 500;

Enemy.y = Math.random () * 400;

stage.addChildAt (enemy, 1);

setTimeout (spawn, 3000);

}

Tags: Adobe Animate

Similar Questions

  • How to convert a PDF into a jpeg file

    How to convert a PDF into a jpeg file

    Hello

    If you use the drive, would not be possible because it is not apt software to convert PDF to any other form of file including jpeg.

    You would need either to pack PDF, which is an online service to export PDFS for some file formats, or you would need Acrobat to perform this action.

    Please follow the steps to convert pdf to word.


    Launch Acrobat > open the PDF > navigate to file > export to > Image > Jpeg.

    Concerning

    Sukrit diallo

  • How to convert an old PageMaker 7.0 file (2006) to a *.pdf file?

    How to convert an old PageMaker 7.0 file (2006) to a *.pdf file?

    Do you still have Pagemaker 7? If this isn't the case, you have InDesign (which may or may not be able to open the file)?

    You first have to open the file. Even if you do, you will need something to convert the file to PDF. Adobe Acrobat Reader can not do.

  • How to create the script to compile procedure files in oracle - urgent deadline...

    How to create the script to compile procedure files in oracle.    about to go live and have much .prc pkg in a directory usr/tmp/ar... Po... human resources etc. need to create a script to compile all the files in the folder, then do not open all necessary .prc suggestions on how to do it.   Thank you Tom.

    (1) an urgent need, ASAP,... are words that do not in a forum of volunteer. We are here to help if you need it now, for free, open a SR.

    (2) oracle procedures are not files.

    (3) I think you are trying to run operating system packages, no Oracle procedure. right?

  • How to convert a PDF into a pdf file to fill

    How to convert a PDF into a pdf file

    Hi jpschrom

    Please see: http://www.adobe.com/content/dam/Adobe/en/products/acrobat/pdfs/adobe-acrobat-xi-convert-f ORM you in fillable pdf - tutorial_ue.pdf

    http://www.Adobe.com/au/products/Acrobat/convert-existing-forms-to-fillable-PDFs.html

  • How to convert a txt to a graphic file using labview 2011

    Hi all

    Please help me on how to convert the .txt file to graph in labview. the txt file is the input file. I've attached the txt file. ITI consist of 7 data according to the date and time. Thank you.


  • How to convert an Adobe Reader Document Microsoft file

    Hello friends and guys for several days, I am worried about how to convert the PDF file to microsoft word is any software to convert it please tell me in thank you comments recently I tried [removed spam link] quote site providing pdf files microsoft how I don't know thanks in advance because I have a lot of PDFs on [removed spam links] this is why.

    Hi nobithas18434703,

    You can use export to PDF, pack Adobe PDF format or other subscription Acrobat for PDF export to file in Word format.

    For more information, see this link: price | Export of Adobe PDF

    Also see this KB doc for help: convert or export PDF files to the file formats, Adobe Acrobat

    Kind regards

    Meenakshi

  • How to convert a Web page into pdf file into Microsoft Edge?

    How to convert a webpage to PDF in Microsoft Edge?

    Hi maganlakeway,

    Microsoft edge does not support ActiveX plugins, so Acrobat plugin can not be used with it. In this scenario, you will need to use MS IE 11 to use the Acrobat ActiveX plugin.

    Thank you

    Abhishek

  • How to convert WMV to MP3 or SWF file in Adobe Media Encoder?

    Try to load a video file wmv in my PDF but Acrobat says that I need to convert the first SOUL to an MP3 or SWF file. How to make this cause what SOUL says file format is not supported?

    Hello

    Please tell us when you have found this info on the format not supported? When you try to put wmv to SOUL, when you try to convert it to mp3?

    You should be able to convert your wmv in mp3 file - mp3 simply choose formats and convert. But it must be remembered that the mp3 is only audio file so you will have only the audio of your wmv - I guess that video - file. To convert your file wmv to swf video (which is A / V format) you need to use an earlier version of SOUL (adobe removing support for flv in SOUL CC 2014: Media Encoder help |) News summaries). If you have a previous version of yu have to convert your WMV to FLV and then use Flash Professional who convert to SWF - unfortunatelly SOUL cannot convert directly to swf format.

    But... as far as I know you can use other video formats to PDF-dependent format which version of Acrobat you are using. Knowing that you have not to convert your flv to swf - you can just use mp4 format flv of SOUL or really popular (and present in all versions of the SOUL).

    You can find more on what you can put in PDF here: taken supported file formats. Acrobat, Reader

  • How to convert mp4 to flv or swf file using programs cloud creatives?

    I'm trying to integrate a video like HTML5 with Flash of relief in my Dreamweaver site and only the video swf file.

    Please let me know if you have any ideas on how to convert an mp4 to flv, or swf file without losing the pixels and the quality of the swf file.

    Thank you!

    Flash comes with a video encoder/converter. However it will not convert SWF to FLV files.  You must have the native video file to MOV, MPEG4, AVI, WMV... format.

    You will need to use an application of part 3 for this.  What operating system do you use?

    Nancy O.

  • How to load SQL scripts from a text file.

    Hi, I tried several times to load a script file/SQL text with 10 different tables and the data, but 10g Express doesen't allows me to do that, can someone direct me or tell me what I do or what I need to adopt a special method to achieve this. I'm sure there must be something where you can download SQL scripts from a text file (in the SQL command editor!). Thank you

    Hello

    Yes, as Aust replied, you must use SQL Workshop/SQL Script, instead the command SQL Editor.

    Sqlplus can also do so, I think, as well as SQL Developer, now it is 1.5.

    sqlplus: (the window command line, black of sql)

    SQL > @path /--(l'extension devrait être.sql) filename.sql.

    Peter

  • Converted file from Flash to HTML5 Canvas does not publish

    Hello

    • I use a Mac.

    • I have an existing Flash file, operation which publishes fine.

    • Convert to HTML5 Canvas using the command-> convert to other Document Formats-> HTML5 Canvas

    • Do not make any changes to the settings of the HTML5 Canvas publication

    • Select "publish."

    ... The .html file displays only a blank white block, the size of the Flash file.

    I tried:

    • Create a new HTML5 Canvas file and paste the existing content in this

    • Copy the script action layers of the original in the Web a Flash file

    • Check the settings of publication for something unusual

    Any help is appreciated.

    Looks like the JSON file which poses problem. You can disable the spritesheet option in settings of publication, and then your multiple bitmap files can operate locally as well.

    Regarding Javascript errors, those that are produced inside the code CreateJS, you wouldn't want to be messing around with it! They are only security errors, or the consequence of something that does not not due to security restrictions. You will not get the errors when files are online, or if you can disable the sprite sheets, I suspect.

  • How to make a text box in the scroll bar custom FlashCC HTML5 Canvas?

    Hello

    I need to make a scroll for a long text box bar. I wonder how can I achieve this with HTML5 canvas in Flash CC2014?

    Thank you

    Rodrigo

    No, the code is exactly the same except instead of changing the property y of a textfield object, you change the property y of a movieclip (which contains an image of the text your want to display).

  • How to convert the scripts in CS3 to CS5?

    I made several scripts when using CS3. Now that I got the CS5 version, how can I convert these previous scripts? Thanks for your help.

    Are you sure you're talking about scripts? You say that you created them? Maybe you mean actions? If Yes, go to the Action Palette, make sure that it is not in button Mode, select each actionset in turn, then save them as much as you want. These will be .atn files. The scripts are .jsx files.

  • How to convert a graphic .jpg or .wmf file in a file .ico icon?

    I would like to use some of my graphic files as icons (.ico) for shortcuts in Windows XP. How can I convert .jpgs or other graphics compatible Windows icons?

    Image Converter online free
    http://www.coolutils.com/online/image-converter/

Maybe you are looking for