|
Posted by SpaceGirl on 10/07/07 00:09
Ben C wrote:
> On 2007-10-06, SpaceGirl <nothespacegirlspam@subhuman.net> wrote:
>> Ben C wrote:
>>
>>> If I understood SpaceGirl it's a superset of ECMA-262 (which _is_
>>> JavaScript) with some new bits bolted on recently that look a bit like
>>> Java.
>>>
>>> http://en.wikipedia.org/wiki/ActionScript:
>>>
>>> With ActionScript 2.0, developers could constrain variables to a
>>> specific type by adding a type annotation so that type mismatch
>>> errors could be found at compile-time. ActionScript 2.0 also
>>> introduced class-based inheritance syntax so that developers could
>>> create classes and interfaces, much as they would in class-based
>>> languages such as Java and C++. This version conformed partially to
>>> the ECMAScript Fourth Edition draft specification.
>> AS2 has been superseded. AS3 is a very strict/typed language, properly
>> structured and consistent. It feels a lot more like Java than JavaScript
>> (especially when when using classes, and the way you use objects).
>
> For better or for worse.
For better, as it really encourages reuse and superclasses (classes of
classes etc).
> I like JavaScript more than either Java or C++.
> Static typing and excessive object-orientation are over-rated-- they're
> not the silver bullets they're sold as that automatically make programs
> more robust and easier to maintain.
Okay, keep in mind non-programmer writing this here:
I agree but you can easily re-type (is it called casting?) an object if
you need to, or use the generic object type of... Object :) It makes it
SO much easier to trace errors, and keeps the overheads down (AS3 is
much more efficient with correct typing, apparently, compared to AS2's
fairly loose approach).
OOPL does lead to somewhat easier to maintain code... as everything is
inherited, you can create your own classes for special objects - for
example extending a MovieClip object to add your own functionality. This
is externalized in as class file. So, you can reuse that class in as
many projects as you like, and if you improve that class or add new
functionality, all the other projects inherit the new functionality too.
also makes it much easier to break a project up into pieces if you are
working in a team. Of course the downside of this... it takes a little
longer to compile, and you have a lot more files to version control! (of
course, after compile, you just have the one .swf file)
The Event model has been seriously improved now. There are hundreds of
events that you can capture using a really nice new syntax:
objectName.addEventListener(EVENT_NAME, listenerHandler);
function listenerHandler(evt:Event):void {
// gets passed the event, now we can do anything we want with it
}
....which for someone like me who is not a hardcore programmer is SO much
easier to comprehend. There are now many, many EVENT_NAMEs that make sense.
They fixed the way you draw things now... none of the getLevel rubbish.
You can now build everything in a virtual space, and when you are ready
add it to the display object as a child. This means NOTHING is EVER
drawn without you telling it. Eg;
// start
myFancyClip:Sprite = new fancyClipFromLibrary();
myContainer:MovieClip = new MovieClip();
function createSomeClips():void {
with (myFancyClip) {
x = 100;
y = 100;
alpha = 0.5;
}
//...
myContainer.addChild(myFancyClip);
this.addChild(myContainer);
}
createSomeClips();
// end
Sooooooooo cool. Love it.
>>> C++ is quite a bit different: it's a machine-oriented language with
>>> mostly value semantics and manual storage management.
>> To an extent AS3 is like this, although you are abstracted from memory
>> management and direct hardware calls - you can only work within the API
>> that AVM2 (the Flash Virtual Machine, inside Flash Player 9) so you are
>> restricted in that respect.
>
> Those are both good restrictions though.
Yep. You do have access to some hardware; sound, web cams and
microphones. If they are present on the machine viewing the Flash movie,
you should be able to access them.
--
x theSpaceGirl (miranda)
http://www.northleithmill.com
-.-
Kammy has a new home: http://www.bitesizedjapan.com
[Back to original message]
|