

Adobe Flash API ported to Dart - cnp
https://github.com/bp74/dartflash

======
gauravk92
AS3 -> Dart -> JS, a bit much don't you think? I'm not sure who is trying to
use a web stack three levels deep and dart based no less. I'm skeptical of how
long dart is going to last at google, but this is definitely an impressive
piece of work regardless. If it was AS3 -> JS and worked as well as it does
now, i feel the web would collectively lose its shit. Unfortunately though
this is tied to google, and i don't think many people want to be stuck being
supported solely by google anymore.

~~~
frenchfries
agreed. Dart even though it has some awesome features, is still a technology
preview, so I also wonder when it will be "stable" (some apis aren't
"finished" yet) and it's a Google only thing. On the project's github page,
you can read "The problem with JavaScript is that it sucks." ... JavaScript
sucks if you don't know how it works, just like another language ... and
what's the point of writting this when Dart itself compiles to JavaScript (who
the fuck uses Dartium as their primary browser), finally the demo throws 18
errors ... fail.

~~~
detst
> so I also wonder when it will be "stable"

It should be out of technology preview later this year.

> JavaScript sucks if you don't know how it works

It's possible to understand JS and want better. I think the people behind V8
and Dart know how JS works.

> what's the point of writting this when Dart itself compiles to JavaScript

What's the point of writing anything in any language? The Dart VM will be
included with Chrome and other browsers are free to include one, too; Dart->JS
is for browsers that don't and the goal is that it'll perform similar to hand-
written JS.

> who the fuck uses Dartium as their primary browser

Nobody. It's for development until the Dart VM is included with Chrome.

~~~
cnp
Exactly -- that's why this is exciting, particularly the Flash / interactive
part. The authors have done a very good job with what they have to work with,
with the assumption that they're only working with a preview and that the
primary medium will be a VM with a JS fallback. The performance, all said, is
very, very good.

------
bp74
Thanks for sharing the link! I'm the author of the library and the demos. It's
great to see some positive feedback. You can also check out some samples (i
like the mask sample most):

Samples: <http://www.dartflash.com>

Source: <https://github.com/bp74/dartflash/tree/master/samples>

Some words about the Dart language. It's great to work with this new langauge
and much more fun compared to javascript which is a pain when you come from
the ActionScript/Java/C# world. In Dart you feel at home right from the start.
Google is very much committed to the project and we will see pretty amazing
things in the future. Of course the Chrome browser (Desktop and Android) will
support the Dart VM in the future. The dart2js compiler allready works great
and has improved a lot over the last weeks.

------
wwweston
Makes sense; Dart is a closer heir to Flash/AS3 and Java than it is to
JavaScript, and there's still a lot of people out there with Flash skills
who're experienced building RIAs. It's a fairly natural place for them to go.

------
DanielRibeiro
Easeljs does this pretty well, but in pure js:

<http://easeljs.com/>

~~~
joneil
Haxe (www.haxe.org) also has ported a decent subset of the API, and can
simultaneously target Flash, JS and C++ (native). Not sure about who has
better coverage of the full API.

~~~
chipsy
Haxe itself is pretty solid and is gaining steam almost every day now.

NME is not as easily recommended. It has very high coverage, and it's shipped
a few products as demonstrated in the showcase, but the build process still
shows immaturity; the Flash target is wonderfully consistent, but other
targets remain pretty fragile. The general trend is "better with time" though.

------
esbwhat
The example game keeps crashing for me after playing a bit in Firefox.

if you want to code html5 flash, I hear another alternative is jangaroo

------
TazeTSchnitzel
I'm not a big fan of Dart. From what I've seen, Dart code is far more ugly
than JS or AS3, and it produces absolutely massive JS output.

~~~
pjmlp
Agreed, JavaScript can have its quirks, but at least you don't need to read
tons of generated code underneath, when trying to debug code.

~~~
bp74
Well, you should see it from another point of view. You write and debug(!)
your application in Dart, later you compile it to JavaScript. The dart2js team
tries very hard to generate code that runs just like the Dart code does in the
VM. Look at the JS-code like the binary code you get from a c++ compiler.
There are hardly any people debuging the generated machine code in c++ right?

I have allready written tons of Dart code, and i have to admit there were a
few issues with the JS-code regarding cross browser compatibilty (btw. it is
easy to read the generated js-code). Those issues were problems in the dart2js
compiler because it's a alpha-version right now. The dart2js team fixed all
those bugs. As soon as the compiler will finally ship we will rely on the
generated output - no need to debug "assembly language".

~~~
TazeTSchnitzel
That's not my gripe with Dart's JS output. It's just that Dart is so different
from JavaScript and has so many thick layers of abstraction that tiny programs
can have thousands of lines of JS outputted, a lot coming from having to
include Dart's own standard libraries.

~~~
bp74
You are right that small programs compile to pretty big JS-files, but noone
should really care. I can do my "hello world" apps in javascript without a
problem, the point of Dart is to write big apps! For those apps the footprint
of the compiled JS-code doesn't matter at all. And you can work with nice
structured source code.

~~~
TazeTSchnitzel
Well, personally I don't want to use a language that compiles to a
representation around 50 times larger than the source code.

~~~
munificent
The JS output that gets generated from a Dart program isn't just "dart_size *
multiplier", it's "dart_size * multiplier + constant". So, when you see a tiny
Dart program being compiled to a large amount of JS, that doesn't mean a large
Dart program will compile to a _huge_ amount of JS, it just means that the
constant is dwarfing the multiplier.

The constant is coming from the runtime library (or, more accurately, the
portions of the runtime library that your program uses). That's relatively
fixed so as your Dart program gets larger, the overhead of that becomes
relatively smaller. The actual code-size multiplier when going from Dart ->
JavaScript is actually fairly small and getting smaller over time.

In some cases, we may actually compile Dart code to _less_ JavaScript code
because of things like dead code elimination and constant folding.

JavaScript code size is something that we consider a core metric for dart2js
and we're constantly working to reduce it.

~~~
TazeTSchnitzel
Of course. I'm just a little concerned about how easy it is to inflate a
program's size in Dart by including another core library.

~~~
munificent
That's true of every language, though, isn't it? If you use libraries, your
app gets bigger.

~~~
TazeTSchnitzel
I suppose so, I guess I'm too used to dynamic, interpreted languages that
don't need to include the standard library in the output.

------
89a
Just what we need, a way for Flash developers to be even more lazy.

~~~
andrewfelix
What's lazy about Flash development?

~~~
cnp
Yeah, please elaborate?

