Help needed to convert ActionScript 3 for HTML5 javascript

I'm looking for help conversion code actionscript 3 in javascript for a platform of HTML5.  I'm a developer flash by trade but I am not familiar on how to 'translate as js code.  I had recently downloaded CC animate, thinking that he take the existing .fla file and republish on a html5 format.  Well I was wrong.  All of my code that I used in flash gives me hundreds of errors & I have not even know where to begin. the question I have is: all my flash documents I created over the years must now be converted to html5.  Where do I go, who can help you? is there an easy way to do this? is there an online converter...  I need help! Thank you.  Here's an actionscript exsisting code that I need to convert: sorry for the copy and past of the script.

ActionScript code below

Stop();

import flash.utils.Timer;

Here comes the string of numbers (rootLoader.parameters)

var generatedNums:String is MovieClip (parent.parent). WinningNumbers;

creates an array of numbers generated

var chosenNums:Array = generatedNums.split("-");

convert text to numbers

var n = chosenNums.length;

While (n)-{}

chosenNums [n] = Number (chosenNums [n])

}

/ / call funtion to remove 0 from the list of numbers

function remove(list:Array,callback:Function):Array {}

for (var i: int = list.length - 1; i > = 0; i--) {}

{if (! callback (list [i]))}

List.splice (i, 1);

}

}

back list;

}

remove the 0 from the list of numbers

function removeCallback(item:Number):Boolean {}

return item > = 1;

}

Remove (chosenNums, removeCallback);

keeps track of what element of the array to use to create balls

(first and second and third)

var chosenNumsIndex:uint = 0;

creates array of the coordinates of the numbers on the card.

var kNum:Array = new Array();

var bottomArray:Array = new Array ("", "", "", "", "", "", "", "", "", "","", "","", "","", "","", "","", "","" ");

kNum [0] is a dummy, because there is no 0 to the Board of Directors.

kNum [0] = {x: 0, y: 0};

/

Array of movieclips

var mcArray:Array = new Array();

mcArray.push (n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14, n15, n16, n17, n18, n19, n20, n21, n22, no. 23, n24, n25, no. 26, no. 27, no. 28, n29, n30, n31, n32, n33, n34, n35, n36, n37, n38, no. 39, no. 40, n41, n42, n43, n44, n45, n46, n47, no. 48, n49, n50, n51, n52, 53, n54, n55, n56, no. 57, n58, n59, n60 n61 n62, n63, n64, F65, no. 66, n67, n68, n69, n70, n71, n72, n73, n74, n75, n76, n77, n78, n79, n80);

creates a timer that executes every 3 seconds.  Number of times it runs

is determined by the length of the array of chosenNums (which corresponds to the number

selected numbers)

var: timer = new Timer (3000, chosenNums.length);

Timer is tuned to itself trigger, calls chuckBall()

timer.addEventListener (TimerEvent.TIMER, chuckBall);

timer.addEventListener (TimerEvent.TIMER_COMPLETE, ballChuckingComplete);

chuckBall generates coins

function chuckBall(event:TimerEvent):void

{

generates the new coin - currency is the name of MovieClip in the library

don't forget to export for Actionscript

var c1:Coin = new Coin();

coin is placed in the appropriate x and y coords

C1.x = kNum [chosenNums [chosenNumsIndex]] .x;

C1.y = there kNum [chosenNums [chosenNumsIndex]];

addChild tells the main timeline to display the piece once it is generated.

this.addChild (c1);

trace (chosenNums [chosenNumsIndex])

Pull the movieclip appropriate off-table and play to darken.

mcArray [chosenNums [chosenNumsIndex] - 1] () .play;

fill the low numbers

chosenNumsIndex increments for the next time chuckBall works

He draws the element next to the chosenNums table.

chosenNumsIndex ++;

bottomArray [chosenNumsIndex - 1] = chosenNums [chosenNumsIndex-1];

trace ("value bottomArray" + bottomArray [chosenNumsIndex]);

firstWinningNumB.text = bottomArray [0];

twoWinningNumB.text = bottomArray [1];

threeWinningNumB.text = bottomArray [2];

fourWinningNumB.text = bottomArray [3];

fiveWinningNumB.text = bottomArray [4];

sixWinningNumB.text = bottomArray [5];

sevenWinningNumB.text = bottomArray [6];

eightWinningNumB.text = bottomArray [7];

nineWinningNumB.text = bottomArray [8];

tenWinningNumB.text = bottomArray [9];

elevenWinningNumB.text = bottomArray [10];

twelveWinningNumB.text = bottomArray [11];

thirteenWinningNumB.text = bottomArray [12];

fourteenWinningNumB.text = bottomArray [13];

fifteenWinningNumB.text = bottomArray [14];

sixteenWinningNumB.text = bottomArray [15];

seventeenWinningNumB.text = bottomArray [16];

eighteenWinningNumB.text = bottomArray [17];

nineteenWinningNumB.text = bottomArray [18];

twentyWinningNumB.text = bottomArray [19];

var lastNumber:Timer = new Timer (60000: 1);

lastNumber.addEventListener (TimerEvent.TIMER, lastNumDone);

lastNumber.start ();

chosenNumsIndex increments for the next time chuckBall works

He draws the element next to the chosenNums table.

chosenNumsIndex ++;

}

function ballChuckingComplete(event:TimerEvent):void

{

trace ("ballchuckingcomplete is working");

var thirtySeconds:Timer = new Timer (15000: 1);

thirtySeconds.addEventListener (TimerEvent.TIMER, thirtyDone);

thirtySeconds.start ();

}

function thirtyDone(event:TimerEvent):void

{

trace ("thirty seconds to the top");

Stop();

gotoAndStop (2);

}

function lastNumDone(event:TimerEvent):void

{

trace ("last number completed");

twentyWinningNumB.text = chosenNums [19];

}

fill the low numbers

manually, start the timer.

Timer.Start ();

The severe and simple truth is that you will have to re - write everything from the beginning in JavaScript (aka ECMAScript).

The good news is that JS syntax and functions are 99% identical to AS2. Transition to AS3 will be slightly more difficult due it it is a little more similar to Java.

The bad news is that all the APIs are completely different. Flanimate in canvas mode uses CreateJS for all rendering, animation and preload. Another thing is the basic JS functionality, or it either library third you import yourself.

For example, instead of:

var thirtySeconds:Timer = new Timer (15000: 1);

thirtySeconds.addEventListener (TimerEvent.TIMER, thirtyDone);

You would do:

var thirtySeconds = this.setTimeout (thirtyDone, 15000);

And instead of trace(), you must use console.log (), since all code must run in a web browser.

Tags: Adobe Animate

Similar Questions

  • Need help to write an actionscript stop for mp3

    Has managed to learn how to write an actionscript game for mp3. Now need assistance in the drafting of a judgment actionscript. And a gotoAndPlay also.

    play_btn.addEventListener (MouseEvent.CLICK, playMusic);

    function playMusic(e:MouseEvent):void {}
    var myMusic:Sound = new Sound();
    var soundFile:URLRequest = new URLRequest ("custodiansofkingdom.mp3");
    myMusic.load (soundFile);
    myMusic.play ();

    Thank you

    If not restart from where it stopped, use:

    var sc:SoundChannel;

    var myMusic:Sound = new Sound()

    start_btn.addEventListener (MouseEvent.CLICK, startMusic);

    stop_btn.addEventListener (MouseEvent.Click, pauseMusic);

    restart_btn.addEventListener (MouseEvent.Click, continueMusic);

    function startMusic(e:MouseEvent):void {}
    var soundFile:URLRequest = new URLRequest ("custodiansofkingdom.mp3");
    myMusic.load (soundFile);
    SC = myMusic.play ();

    }

    function pauseMusic(e:MouseEvent):void {}

    SC. Stop();
    }

    function continueMusic(e:MouseEvent):void {}

    var pos:Number = sc.position;

    SC = myMusic.Play (POS);

    }

    p.s. Please mark this thread as answered.

    PPS.  Please start another thread for a new topic.

  • Help needed to convert the ArrayList collection ArrayCollection


    I am converting an ArrayList (Java) to the collection of Flex ArrayCollection.
    Please help me in this, I don't know whether there is a correct approach

    I have a created a class user VO ActionScript Flex with two properties as uname, pass.

    [Bindable]
    var result: ArrayCollection collection

    private void displayDetails(event:ResultEvent):void
    {
    result = event.result as ArrayCollection collection;
    }


    < mx:DataGrid dataProvider = "{result}" >
    < mx:columns >
    < mx:DataGridColumn headerText = "UserName" dataField = "uname" / >
    < mx:DataGridColumn headerText = "Password" dataField = "pass" / >

    < / mx:columns >
    < / mx:DataGrid >

    It's my DAO of Java file:


    ResultSet rs = stmt.executeQuery ("select NAME, PAST by users");
    list = new ArrayList();
    While (RS. Next {}
    User user = new User();
    user.setUname (rs.getString (1));
    user.setPass (rs.getString (2));
    List.Add (User);

    }


    back list;

    With the code below, the DataGrid displays is empty without data, please help me where I am wrong doung

    I have to do something more? The data comes on the lcds Server console.

    Help, please.

    Hi Kiran,

    Try this once...

    private void displayDetails(event:ResultEvent):void
    {
    result = new collection ArrayCollection (event.result as Array);

    }

    Just try to debug by placing the stop point and make sure that you have found event.result as array... If not, then change your code accordingly.

    Thank you

    Jean Claude

  • Sweeping gestures animate CC HTML5 / JavaScript

    I'm trying to implement the touch events in my document HTML5 Canvas in CC animate using JavaScript.

    What I want is for a function that will be fired when the user slides to the left or to the right. It would be nice to have a few qualifiers as 30px with 2 fingers shot is when the service goes off too but is not entirely necessary at this stage.

    Initially, I was counting on using jQuery Mobile, but who is the origin of errors.

    Then, I was counting on the use of the jQuery plugins but they do not seem to work - perhaps that my application is disabled.

    I already have jQuery in my work file.

    Can someone help me please use CC animate / Canvas HTML5 / JavaScript (jQuery or CreateJS or something)? My camera is a Microsoft Surface Pro 4.

    Thank you

    Eric

    Discovered that I have still need activate touch on the scene using CreateJS before I can use jQuery plugins of touch stating:

    createjs. Touch.Enable (internship);

    EaselJS v0.8.2 API Documentation: Touch

  • Need help with coding for HTML5 with emergency Flash video

    Hello, need help with my coding in Dreamweaver CS5.5 for HTML5 with emergency Flash video. Not sure if the coding is correct. Do I need any other JavaScript etc.?

    code.jpg

    Another thing is that you don't have to include SWF as aid manual if you provide all 3 ogv, webm & mp4 video formats as one of these formats will certainly be played in any browser that is fully compatible HTML5.

    Still one thing you could do if you don't mind hosting your video on Youtube is to get an embed code for Youtube - in this way, you don't have to convert all the files. YouTube will do it for you and it will play on devices of HTML5 as well as supports Flash player of relief for devices that cannot play HTML5.

  • can someone help me convert actionscript 2.0 to actionscript 3.0 for my interactive sketch notebook?

    If anyone can come back to me, I'd be grateful help.

    I worked on the provision of an interactive drawing buffer but started from a model that was in actionscripts 1 & 2. but when I converted to actionscript 3.0, there are errors.

    I understand not really good coding and hoped someone could help me to make it work for actionscript 3.0.

    Here is the code for actionscript 2.0 (it works perfectly when in the right format)

    lineThickness = 0;

    selectedColor = "0x000000";

    _root. OnMouseDown = startDrawing;

    _root. OnMouseUp = stopDrawing;

    startDrawing() {} function

    If (_xmouse < 455) {}

    _root. LineStyle (lineThickness, selectedColor);

    _root. MoveTo (_root._xmouse, _root._ymouse);

    _root. OnMouseMove = drawLine;

    }

    }

    drawLine() {} function

    _root. LineTo (this ._xmouse, this ._ymouse);

    }

    stopDrawing() {} function

    delete this.onMouseMove;

    }

    line0.onPress = function() {}

    lineThickness = 0;

    };

    line3.onPress = function() {}

    lineThickness = 3;

    };

    Line6.onPress = function() {}

    lineThickness = 6;

    };

    colorRed.onPress = function() {}

    selectedColor = "0xFF0000";

    };

    colorGreen.onPress = function() {}

    selectedColor = "0x00FF00";

    };

    colorBlue.onPress = function() {}

    selectedColor = "0x0000FF";

    };

    colorYellow.onPress = function() {}

    selectedColor = "0xFFFF00;

    };

    colorMagenta.onPress = function() {}

    selectedColor = "0xFF00FF";

    };

    colorCyan.onPress = function() {}

    selectedColor = "0x00FFFF";

    };

    colorBlack.onPress = function() {}

    selectedColor = "0x000000";

    };

    eraser_btn.onPress = function() {}

    _root. Clear();

    };

    use:

    var lineThickness:int = 0;

    var selectedColor:int = 0 x 000000;

    this.addEventListener (MouseEvent.MOUSE_DOWN, startDrawing);

    this.addEventListener (MouseEvent.MOUSE_UP, stopDrawing);

    function startDrawing(e:MouseEvent):void {}

    If (mouseX<455)>

    {with (this.) Graphics)}

    lineStyle (lineThickness, selectedColor);

    moveTo (mouseX, mouseY);

    this.addEventListener (MouseEvent.MOUSE_MOVE, drawLine);

    }

    }

    }

    function drawLine(e:MouseEvent):void {}

    {with (this.) Graphics)}

    lineTo (mouseX, mouseY);

    }

    }

    function stopDrawing(e:MouseEvent):void {}

    this.removeEventListener (MouseEvent.MOUSE_MOVE, drawLine);

    }

    for (var i: int = 0; i<>

    This ["Line" + i] .addEventListener (MouseEvent.MOUSE_DOWN, downF);

    This ["line" + i] .ivar = i;

    }

    function downF(e:MouseEvent):void {}

    lineThickness = MovieClip (e.currentTarget) .ivar;

    }

    var colorA: Array = [[colorRed, 0xff0000], [colorGreen, 0x00ff00],..., [CouleurJaune, 0x000000]];

    for (i = 0; i<>

    colorA [i] [0] .addEventListener (MouseEvent.MOUSE_DOWN, colorF);

    colorA [i] [0] .ivar = i;

    }

    function colorF(e:MouseEvent):void {}

    selectedColor = MovieClip (e.currentTarget) .ivar;

    }

    erase_btn.addEventListener (MouseEvent.MOUSE_DOWN, eraseF);
    function eraseF(e:MouseEvent):void {}
    This.Graphics.Clear ();
    }

  • How to convert swf Actionscript 3 in HTML5

    Hi guys,.

    I have experience with Flash/Animate but not HTML5. I was under the impression that Animate has the ability to export or convert any project of HTML5 or even Android or iOS. However, I could not find a way to do it. Whenever I try to convert or export, my project loses all its features interactivity Actionscript like buttons or drop-down list boxes.

    Do what I have to start a project as an HTML5 project from the outset? I need to program in JavaScript instead of Actionscript?

    You can convert your AS3 FLA to be an HTML5 Canvas in Florida who has to keep all the layers and symbols, but it will comment all ActionScript. JavaScript have usually the classes and packages, so more likely, you will need to rewrite all the code in Javascript in the timeline panel.

    There are other changes you will have to do too much, for example, sound should be the event and cannot be Stream and numerous color effects and filters do not work.

  • I want to convert windows 7 for xp professional can someone help me?

    I want to convert windows 7 for xp professional can someone help me?

    Hello

    Thank you for contacting Microsoft Community.

    Unfortunately, you can not convert Windows 7 to Windows XP. You will need to perform a new installation of Windows XP (for example formatting partition of Windows 7 and then installing Windows XP).

    Try the Windows XP Mode, which requires Windows 7 Professional or ultimate or business (32-bit or 64-bit, both are supported) where a copy of Windows XP must be installed through Windows Virtual PC. You can install and access the applications in Windows XP Mode.

    Note that the support (currently extended support, support mainline has been terminated already) for Windows XP will end soon.

  • I need to convert a file wps as a PDF using my old compaq pasrio it seems imposible can anyone help

    I created this book on my compaq pasario sr1303wm, this boy is 7 years old. Then, Unbeknowest to me, anyone who wants to look impossible. Open it, because I did it by using wps format. I put on a flash drive and walked over to my friends House who has windows 7, and we could not open it. I need to convert it to PDF as well as others can open it. I tried to convert, but it seems impossible. Its 700 MB of information. I do not have the knowledge to do this, can anyone help?

    You google a converter?  You can convert online .pdf .wps to FreePDF Convert.   I've never used this program so I can't vouch for it, but you can watch over and maybe give it a try.

    Rosie

  • I work with word 2003. I need to convert a .doc .jpg file can it be done, any help would be really appreciated. Thank you!!!

    I work with Word 2003.  I need to convert a .doc .jpg file...  Can it be done?  Any help would be greatly appreciated.  Thank you!!!

    You posted just the simplest way, take a picture of him,

    You can try,

    Open the doc,

    Click the Office logo at the top left,

    Save slot, below, you will see other file types.

    JPEG / jpg is not an option for me, it could be for you?

    Or try this,.

    http://Windows.Microsoft.com/en-us/Windows-Vista/use-Snipping-Tool-to-capture-screen-shots

  • Do I need a converter for my Macbook when traveling in Ireland or just a form of adaptation?

    Do I need a converter for my Macbook when traveling in Ireland or just a form of adaptation?

    Just a form of adaptation.

  • Need help with the launching track pack for forza code 4

    Bought new Forza 4 and the lancer Track Pack code does not work, how do I get a code that is generated in the form I've already paid for it. Rank of loads of numbers and sent 10 s of emails but cant seem to get help.

    This is the help I get when the cat to an Ambassador xbox on xbox.com

    Terry wrote:
    Need help with the launching track pack for forza code 4
    The Xbox Ambassador says:
    Location of Ambassador of the community...
    The Xbox Ambassador says:
    Location of Ambassador of the community...
    The Xbox Ambassador says:
    Your question will be answered by an Ambassador of the Xbox. You have been connected to the Ambassador as a user Xbox [3]
    The Xbox Ambassador says:
    Hello
    Terry wrote:
    Hello
    The Xbox Ambassador says:
    Hey
    Terry wrote:
    just to be on the phone to xbox live support and was told to come here
    The Xbox Ambassador says:
    ok\
    The Xbox Ambassador says:
    What is your problem?
    Terry wrote:
    I bought the 4 for forza ansd 360 new sealed Christmas...
    Terry wrote:
    has got 2 codes that accompanies the game but the pack track code does not work
    The Xbox Ambassador says:
    Wow good
    Terry wrote:
    whenever I put in the code it says code redeemed
    The Xbox Ambassador says:
    I think the code is used. You must return to the retailer
    Terry wrote:
    I tried to, but since I already opened the case they will not accept
    The Xbox Ambassador says:
    Oh. No,
    Terry wrote:
    the code had been used or defective as I am the only person who has touched the game once opened, tried to enter the code when it is open
    The Xbox Ambassador says:
    Maybe it was auto bought?
    Terry wrote:
    so, how do I get another code generated track Pack if defective?
    The Xbox Ambassador says:
    I do not know.
    Terry wrote:
    bought the game new, so I get the track pack
    The Xbox Ambassador says:
    Oh. It's bad.
    The Xbox Ambassador says:
    I think that if you Exchange 1 code it will buy it
    Terry wrote:
    car pack code worked, starter pack did not work
    The Xbox Ambassador says:
    Oh.
    The Xbox Ambassador says:
    It's a bad
    The Xbox Ambassador says:
    BTW you have an evolution of the tests?
    Terry wrote:
    Yes, I want to? but more anxious to get a code object generated for this pack
    The Xbox Ambassador says:
    Hey if I help can u give me this game too?
    Terry wrote:
    ?????????????????
    Terry wrote:
    So is it possible to get a code for that time?
    The Xbox Ambassador says:
    Hey
    The Xbox Ambassador says:
    Yes.
    The Xbox Ambassador says:
    you need to contact them
    The Xbox Ambassador says:
    and tell them that the code is used.
    Terry wrote:
    I was told to come here? where can I go to get the code?

    Hi Terryg76,

    ·         What version of the operating system is installed on the computer?

    I suggest you to contact the game manufacturer for more help and information.

  • HTML5: Convert Actionscript reference Javascript or resource?

    Not there at - there no guideline anywhere repository?

    Code snippets do not appear to cover simple things like the filling of a dynamic text within an instance of symbol with a text string, such as:

    SymbolX.DynamicText.text = "show this text."

    I tried:

    This. SymbolX.DynamicText.text = 'show this text';

    Even simple "If Else" functions are not covered in the extracts of...

    Is anyone aware of a certain type of resource of reference to deal with CONVERSION?

    Thank you!

    Here is a general guide to translate as JS/CreateJS:

    Convert your ActionScript code to HTML5 in Adobe animate CC

  • Since the upgrade to CS6, I see is no longer how to convert files from, for example, a PDF to JPEG and vice versa.  It used to be so simple.  Can anyone help with this?

    Since the upgrade to CS6, I say is no longer how do to convert files from, for example, a PDF file as a JPEG or another type (gif, png, etc.).  When I look at the file in the Finder it simply brings me directly to my original in inDesign document, rather than to appear on the left side of the screen with the save option under sub folder as it did before.  Does anyone know how I can convert the files, I need to do a lot!

    ???? Conversion of files with InDesign? Never have been possible. The only thing you could and can do is to export an InDesign document. You can export to PDF, jpg, etc. just like before.

  • Hello! I need help! I have the dvd for lightroom 5 and when I put it in my cumputer it dosent see DVD... What can I do?

    Hello! I need help! I have the dvd for lightroom 5 and when I put it in my cumputer it dosent see DVD... What can I do?

    You can try to download instead of using the drive...

    Lightroom - all versions

    Windows

    http://www.Adobe.com/support/downloads/product.jsp?product=113&platform=Windows

    Mac

    http://www.Adobe.com/support/downloads/product.jsp?product=113&platform=Macintosh

Maybe you are looking for

  • Add the problem

    Add on the list, there is a message that says "you must have firefox installed" to use the addon functionality. But now iam on FF. And recently synced everything. The problem came 30 minutes ago... Hmmm

  • Somehow my Facebook picture appears on my mail out in the upper right. How can I remove the image?

    Somehow my photo Facebook will appear in the upper right of my outgoing mail. How can I remove it?

  • Several timer objects

    Hi all I'm working on a VI for the monitoring and control of several sensors/actuators, which of course is included inside a large loop that continues to run continuously. I tried to create several independent counters, which must lock on a 'REAL' sp

  • Polar trace turn angle scale

    Hello Is there an easy way to manipulate the angle scale on a ground of polar?  Specificaly I want to 0 degrees where 90 degrees is and then fill in the counterclockwise around the circle. Thank you Dan

  • Ultiboard - components in Place on the two layers

    Aloha, I'm trying to go through components of hole on both sides of my Board. When I share a component from the top of the bottom layer, everything is blurred. I can't stack components on the same axis Z. No work around? Thank you Aya.