Skip to main content
April 23, 2014
Answered

Flash AS3.0 to Html Canvas convertion

  • April 23, 2014
  • 1 reply
  • 680 views

Hello Again,

I am in a bit of fix here.

I have converted my Flash project to Html Canvas in Flash CC.

But my actions in timeline got commented out and have created a js file.

Its not working as per the actions I have created.

Done a bit of research and have known that the actions would be commented out and js has to be written for the actions wehave given.

As I have no knowledge in programming Java Script, any help in this would be highly appreciated.

This is the script I have been working on...

Thanks in Advance..

import flash.events.MouseEvent;

 

Wall1.stop();

 

Wall1.RedCove.visible = false;

Wall1.PearlGrey.visible = false;

Wall1.Boulder.visible = false;

Wall1.Lava.visible = false;

 

RedCove_btn.visible = false;

PearlGrey_btn.visible = false;

Boulder_btn.visible = false;

Lava_btn.visible = false;

   

Wall_btn.addEventListener(MouseEvent.CLICK,panels);

function panels(event:MouseEvent):void

{

          RedCove_btn.visible = true;

          PearlGrey_btn.visible = true;

          Boulder_btn.visible = true;

          Lava_btn.visible = true;

}

 

RedCove_btn.addEventListener(MouseEvent.CLICK, redcove);

function redcove(event:MouseEvent):void

{

          Wall1.RedCove.visible = true;

          Wall1.PearlGrey.visible = false;

          Wall1.Boulder.visible = false;

          Wall1.Lava.visible = false;

}

PearlGrey_btn.addEventListener(MouseEvent.CLICK, pearlgrey);

function pearlgrey(event:MouseEvent):void

{

          Wall1.PearlGrey.visible = true;

          Wall1.RedCove.visible = false;

          Wall1.Boulder.visible = false;

          Wall1.Lava.visible = false;

}

Boulder_btn.addEventListener(MouseEvent.CLICK, boulder);

function boulder(event:MouseEvent):void

{

          Wall1.Boulder.visible = true;

          Wall1.RedCove.visible = false;

          Wall1.Lava.visible = false;

          Wall1.PearlGrey.visible = false;

}

Lava_btn.addEventListener(MouseEvent.CLICK, lava);

function lava(event:MouseEvent):void

{

          Wall1.Lava.visible = true;

          Wall1.RedCove.visible = false;

          Wall1.Boulder.visible = false;

          Wall1.PearlGrey.visible = false;

}

Original_Image.addEventListener(MouseEvent.CLICK, hide);

function hide (event:MouseEvent):void

{

          RedCove_btn.visible = false;

          PearlGrey_btn.visible = false;

          Boulder_btn.visible = false;

          Lava_btn.visible = false;

}

This topic has been closed for replies.
Correct answer moccamaximum

Doing this manually implies code has to be rewritten?

Yes, you have to edit the js file that  flash generates after you publish to canvas

EaselJS is a entirely different from AS 3.0 right?

EaselJS is basically a framework which enables you to write JavaScript with classes (similar to actionscript).

A functionality you need to make all the MovieClips/Sprites in your library available to javascript

Check out this tutorial to get a basic understanding:

http://code.tutsplus.com/articles/getting-started-with-easeljs-a-flash-like-interface-for-the-html5-canvas--active-10382

1 reply

Inspiring
April 23, 2014

if the autoconversion dosen`t work for your project you will have to do it manually.

The framework you need to look into is documented here:

http://www.createjs.com/Docs/EaselJS/modules/EaselJS.html

click events are handled like this:

Wall_btn.addEventListener("click", panels);

function panels(event){

          RedCove_btn.visible = true;

          PearlGrey_btn.visible = true;

          Boulder_btn.visible = true;

          Lava_btn.visible = true;

}

April 24, 2014

Hello moccamaximum,

Doing this manually implies code has to be rewritten?

Or the .js file can be edited??

But the EaselJS is a entirely different from AS 3.0 right??

Please do help me understand.

Thank you.

moccamaximumCorrect answer
Inspiring
April 24, 2014

Doing this manually implies code has to be rewritten?

Yes, you have to edit the js file that  flash generates after you publish to canvas

EaselJS is a entirely different from AS 3.0 right?

EaselJS is basically a framework which enables you to write JavaScript with classes (similar to actionscript).

A functionality you need to make all the MovieClips/Sprites in your library available to javascript

Check out this tutorial to get a basic understanding:

http://code.tutsplus.com/articles/getting-started-with-easeljs-a-flash-like-interface-for-the-html5-canvas--active-10382