| Actually a lot of Flash apps are mainly code + assets now, that's certainly the way we make things. I've tried using canvas to replicate some things that we've made in Flash, and quickly ran into some problems: 1) There is no way of interacting with elements drawn to canvas, as it's just a flat image (as someone else mentioned in the comments here, canvas is just a way of drawing bitmaps). You could obviously write your code to deal with mouse and keyboard interaction, but it's even more overhead on something that is already quite slow, and even if you could interact with individual elements it brings me to the other thing... 2) Flash has everything in layers that can be updated independently, when it comes to canvas if you want to change something you have to redraw that section of the image entirely, something that isn't always practical which means you end up redrawing the whole canvas. Essentially Flash does the same thing, but as the compositing is handled by the plugin it is far faster than anything you can do in Javascript at the moment. Also related to the above, the drawImage method that draws bitmap data to the canvas is painfully slow at the moment, so compositing using that is out of the question. If that can be optimised significantly it will certainly help. Basically canvas is too low level to duplicate the kind of functionality Flash offers at the moment. Until manipulating the canvas and Javascript is optimised further it's not possible to layer in the interaction or flexibility of rendering that Flash has. I'm sure a framework offering this will happen one day, but it won't be any time soon. |
Heck, if you wanted, you could literally duplicate OpenGL in its entirety in JS for Canvas. There's nothing preventing this, except lack of threading / parallel processing, though I admit it'd be ungodly slow.
2) Also primarily a problem currently, and likely due mostly to the lack of mature libraries to do just this. With compositing rules (source-over, source-atop, etc) and masks for objects, you can re-render only the displayed portion of any object on a Canvas as well.
Low level: well yeah, it's a thin layer over a bitmap surface. Libraries are needed to abstract away from that. It's kind of like saying that OpenGL isn't fast because it's core is low-level. That low-level feature-set Canvas has will be wrapped in libraries to make specific uses simpler, I guarantee it. Speed will come, especially as Canvas gains focus. It's still very new. Was Flash this fast/capable in pre-1.0 days? I have no idea if it'll catch up / surpass Flash, but it's far from its optimum right now.
I'm not calling for the death of Flash, and I seriously doubt it'll ever supersede Flash on everything, so Flash has it's uses and will continue to do so. Just pointing out that they're not on equal playing grounds in terms of development.