Flex to HTML : How to convert actionscript - javascript

I'm converting a big application in Flash/Flex to HTML5/CSS/JS. I tried to translate AS classes but it's a bit difficult.
Do you know if I can find a JS equivalent to the natives AS classes?
Or if there is a reliable converter able to cross every classes of my app?
I can use ES6 format with the tags class, constructor, etc...
Thank's a lot.

Try to find some information here, actually this is not ready-to-use solution, but seems like someone tried to solve you problem: https://cwiki.apache.org/confluence/display/FLEX/FlexJS

Related

Using JSON to generate HTML elements, multiple class names and id. - Without JQuery

I've been building a virtual rubik's cube on codepen using JS and CSS only. - Forgive me any apparent stupidity, I have been coding less than 3 months, and less than 1 month in JS.
I currently have made two versions, but for version 3 I need to generate as much of my HTML as possible using JSON and JS loop structures. Despite doing tonnes of reading on JSON, I can't quite get my head around the concept of using it to generate HTML like I have been with standard JS arrays. See codepen link-- http://codepen.io/Peachey_A/pen/hEcDH
Whilst I have used a little bit of JQuery to add class attributes in version 2; I would like to steer clear of it in the generation process as my goal is to understand JS before getting too involved with libraries.
Any advice of specific websites or code snippet examples would be greatly appreciated.
Thanks
As far as manipulating JSON I recommend using a library (if your browser doesn't support it natively), but if you are trying to get away from jQuery you should take a look at http://youmightnotneedjquery.com/
JSON is a transport format and not a layout language/markup language. You need some JS to parse and understand the data that comes with it and some HTML building tool to turn it to HTML.
You could build a parser if you want to but that takes too much time. That will not help you much in learning the language. Besides, jQuery has a built-in parser which would be of great help already.
var div = $('<div/>',{id : 'foo'})[0]; // instant <div id="foo"></div>
Other tools that generate HTML from JS objects are templating libraries like Mustache and Handlebars.
On a side-note, don't learn the language itself. Learn how to use the language. Eventually, you'll know the other quirks which you have jumped over when using libraries. Also, don't foster the "Not Invented Here" Philosophy. It just wastes your time. Spend more time on things that metter.
First I believe you will need to convert that JSON into Javascript. Take a look at this great answer Parse JSON in JavaScript?. Now, for browsers that don't support the conversion a library is suggested. If you want to do it by hand, a JSON parser is a project on it's own.
Once you are done with that you can manipulate the objects, iterate through them
and start spitting the html based on the data of your JSON.

Javascript, any clean up tools written in javascript itself?

I'm basically looking for a javascript library that accepts an arbitrary string which may be valid javascript and returns a "cleaned up" version based on javascript indention rules. It would be nice if the library also did css and html.
Barring that, if someone has an interesting idea for doing it from javascript I'd love to hear it.
you can use https://beautifier.io/ .
But you can also use node-beautifier in node js :P

jQuery compatible JavaScript documentation generator

I need to choose a documentation generator (similar to jdoc in java or rdoc in ruby) for my javascript project that (built with jquery, underscore and backbone)
Candidates:
jsdoc toolkit
pdoc
natural docs
docco
YUI doc
doctool http://jquery.bassistance.de/docTool/docTool.html
other ?
Requirements
should work with jquery, underscore and backbone. that means object-literal methods etc
I really like pdoc but its too centered around prototype, poorly documented, and I don't want to make extra files (sections?) to make it work (not sure about this)
docco is nice but I want structured output (as in menu + class/func structure like jdoc)
must be command line/makefile compatible (not web pastie)
Tips, tricks, tutorials, success stories, advice greatly welcomed.
Why Doesn't jQuery use JSDoc?
I would rate jsduck from Sencha on top. I have used it on many projects. Simple to use
https://github.com/senchalabs/jsduck
A single command will generate docs like this http://docs.sencha.com/touch/2-0/
You could also look at Dox by TJ Holowaychuk; it's a fork of Docco, but adds some jsDoc syntax support. I personally find that jQuery code often lends itself to looser style of inline documentation like Docco, but I'm currently in the same situation of trying to decide what doc system to use.
I am going through the same exercise at the moment, and from what I've seen YUI Doc is the best. I love the fact that you can run it in "server" mode and view the documentation as you write it. Much better than having to execute a build each time you change the documentation. Also, the documentation that is generated is very easy to read and very well organized.
This is new so it may not fit your output requirements, but you might find njsdoc interesting. Unlike most JS documenters it tries to build documentation by executing the code and investigating the stack rather than just parsing the files for annotations.
https://bitbucket.org/nexj/njsdoc
There is DocumentJS*
*I haven't used it and I am not sure how well it will integrate with Backbone.

JavaScript tree functionality without framework

I'd like to display a tree on a Facebook page with JavaScript. Therefore there can be no dependencies on frameworks such as jQuery or Ext which won't run on Facebook, at least as far as I know when I last worked on that platform (April 2009). Can anybody recommend a "framework-free" JavaScript/tree library? I have ported some fairly complex JavaScript to Facebook so I'm sure I'll be able to port just about any existing pure JavaScript library.
Clarification points:
I am targeting FBJS
I too can (and did) google for JavaScript/tree engines but am seeking recommendations as to which one(s)
Look at this implementation... http://www.destroydrop.com/javascripts/tree/
You didn't describe the requirements for your JS tree, so I would suggest you write one yourself. It's a relatively simple task unless you need more complex functionality.
A simple tree is just a matter of having a bunch of DOM nodes that have other DOM nodes inside them that can be toggled on and off (display block/none)
Even if you work mostly in FBML and FBJS, you can use <fb:iframe/> to render raw HTML and JavaScript without the FB munging going on.
What kind of page are you targeting? <fb:iframe/> works on canvas pages but not on a user's profile page.
I looked at the munging in FBJS. Not sure why it would make jQuery not work, but if someone has some insight, I'd love to hear it.
I do know that you probably can't use jQuery's $ due to conflicts. But that can be changed from $() to jQuery() easily enough.
I could tell you what treeview I like, but without trying it in Facebook it might fail for the same reasons as jQuery.
You really should write and test your own to get exactly what you want, and you didn't describe exactly what you want from a tree, but perhaps you could try the free version of treeview.
I've used http://sortablejs.github.io/Sortable/#nested with great success. The default UI might throw you off (it doesn't look like a tree) but when you consider mobile users this look actually works much better.

Open Source Actionscript 3 or Javascript date utility classes?

I was wondering if anyone could point to an Open Source date utility class that is fairly robust. I find myself rolling my own when I want to do a lot of things I take for granted in C# and Java. For instance I did find a decent example of a DateDiff() function that I tore apart and another DatePart() function. Another examples would be parsing different date/time formats. I'm trying to avoid reinventing something if it's already built.
Another possibility may be a nice set of Javascript files that I can convert to ActionScript 3. So far I've found DateJS but I want to get a good idea of what is out there.
as3corelib has the DateUtil class and it should be pretty reliable since it's written by some Adobe employees. I haven't encountered any problems with it.
There is also DP_DateExtensions, though I believe DateJS is more robust.

Categories