Are there any good Flash AS3 tutorial books out there?
Before you say O'Reilly's Essential Actionscript 3, let me stop you right there. I am far too stupid to enjoy O'Reilly books.
I want one that is full of tutorials with pretty pictures. I really liked those Training from the source tutorial books that macromedia used to put out, but I don't think they make 'em anymore now that Adobe has taken over... Looks like they have a AS3 Classroom in a book, anyone used that one?
I've got a pretty decent handle on AS2, so something that touches on the differences between AS2 and AS3 would be great.
P, if you're lurking buddy, have you done a Beginner's guide to AS 3 yet?
you know, one of the best resources i've found is actually the "programming actionscript 3" manual by adobe - reading that from begin to end. unfortunately, that is a very theoretical approach, and not so hands on - not much by way of tutorials and pretty pictures, but it is really excellent. a very hands-on type of book is actually one that is put out by o'reilly, but it is the cookbook, which has task/project specific examples in AS3. very useful to get stuff done, without learning all about it necessarily. i know of some other books that are pretty intense, so probably not exactly what you are after, but have you tried checking out the lynda.com video training things at all. they are quite nice too.otherwise, if you want to do things that will teach you and are fun at the same time, bit's book is really wicked (making things move).
[shameless self promotion]Foundation ActionScript 3.0: Making Things Move![/shameless self promotion]
seriously though, it is used in several classrooms as a textbook.
ha! well there you have it...
cool, guys thanks. I'll definitely check those out.
I had a very depressing day telling recruiters I can't code Flash in AS3 or sites in ASP.NET...
EAS3 is a solid all rounder.
Originally posted by: Arsis EAS3 is a solid all rounder.
I hate you.
EAS3
Bits books in great as well.
Originally posted by: pyrogen EAS3
Why do you torture me?!
I bought the friends of Ed "Object-Oriented Actionscript 3.0". I looked for yours bit, but my book store didn't have it. In fact, the friends of Ed one was the only AS 3 book they had in stock -- they didn't even have EAS3! The friends of Ed looks like a good 'un though.
stop your griping and just get EAS3 from Amazon and read the damn thing 
Originally posted by: Arsis stop your griping and just get EAS3 from Amazon and read the damn thing
I can't, it's too hard! It has big words like polymorphism and encapsulation... they make my brain hurt.
Ok newbie to newbie this is my limited take, I recommend getting a few as3 books and skip reading them as you prob already know enough oop to get by to start with and it is just the differences you need help with to me there is little difference between as2 and as3 if you are already doing ok as2. Look at the code often nearer the back, its often down to knowing enough to look for the right thing. Bit's making things move was good to get me just starting then Moock and a design pattern book helped me with stuff like custom events and new ways of doing xml.
1) You have to work out the correct classes to import, things just don't work if you don't have the correct classes, here is a few I have found useful for simplicity I have used * but you need to know about the ones in each group and how they are used and maybe better to specify them separately so you know what you are using, this may have been important in AS2 but in AS3 stuff like movieclips need to be imported or they just don't work or cause errors!
// movieclip/sprite import flash.display.*; import flash.utils.getDefinitionByName;
// these you need all the time for adding listeners the backbone of as3 import flash.events.*;
// textfields import flash.text.*;
// loading external stuff import flash.net.*;
// sound and video import flash.events.; import flash.media.; import flash.net.*;
// tweener import caurina.transitions.Tweener;
2) you have to construct stuff right, here is a basic class in my style.
package net.justinfront {
import flash.display.; import flash.events.;
public function MyClass {
static var MYSTATIC: Int = 1; private var _myVar: String = 'fred'; private var _scope: MovieClip;
public function set myVar( myVar_: Number ) {
_myVar = myVar_;
} public function get myVar():Number {
return _myVar;
}
public function MyClass( scope_: MovieClip ) {
_scope = scope_;
init();
}
// voids are small first letter if you bother with them
private function init():void
{
// do stuff
} } }
2) every one now uses sprites where they can they are just movieclips without timelines, you can still use movieclips if you want, and lets face it once the landscape of as3 starts to look more familiar you will soon switch to what ever everyone is doing but to start with I don't see it matters.
3) where ever you used to access a movieclip's properties remove the '_' for instance _rotation becomes rotation _alpha becomes alpha oh and if something used to go from 0 to 100% it is not 0 to 1.
4) Forget onEnterFrame and onRelease everything now works with listeners.
private function setButton(): mc.addEventListener( MouseEvent.CLICK, mcClicked); } private function mcClicked() { trace('mc clicked'); }
Now its important to realise the the MouseEvent.CLICK is just a static class property and is really just a string, you need to import the class that defines this type of event. you can make your own events, moock explains it well, but basically you need some sort of format like so, where I am passing 4 custom parameters when a ToolTip event is created.
package net.justinfront.customevents {
// see moock 226 for example
// event for change of video that camera is watching.
import flash.events.*;
public class ToolTip extends Event
{
public static const MOUSE_OVER: String = 'showtip';
public static const MOUSE_OUT: String = 'hidetip';
public var _id3d: Number;
public var _name: String;
public var screenX:Number;
public var screenY:Number;
public function ToolTip( type: String,
bubbles: Boolean,
cancelable: Boolean,
id3d_: Number,
name_: String,
screenX_: Number,
screenY_: Number )
{
super( type, bubbles, cancelable );
_id3d = id3d_;
_name = name_;
screenX = screenX_;
screenY = screenY_;
}
public override function clone():Event
{
return new MoveTo3D( type,
bubbles,
cancelable,
_id3d,
_name,
screenX,
screenY );
}
public override function toString():String
{
return formatToString( 'ToolTip',
'type',
'bubbles',
'cancelable',
'eventPhase',
'_id3d',
'_name',
'screenX',
'screenY' )
}
}
}
and then you may use it
private function setupButtons():void { mc.addEventListener( MouseEvent.MOUSE_OVER, showToolTip ); mc.addEventListener( MouseEvent.MOUSE_OUT, hideToolTip ); }
private function showToolTip( e: Event ):void {
dispatchEvent( new ToolTip( ToolTip.MOUSE_OVER,
true,
false,
this._id,
this._subtitles.title,
this._videoHolder.screenX,
this._videoHolder.screenY));
}
private function hideToolTip( e: Event ):void
{
dispatchEvent( new ToolTip( ToolTip.MOUSE_OUT,
true,
false,
this._id,
this._subtitles.title,
this._videoHolder.screenX,
this._videoHolder.screenY));
}
The screenX and Y are related to some 3d stuff so ignore them they are just from something I am working on.
5) setInterval has been replaced with a timer, the help should explain its use, you basically you create it and then setup a listener to it, just rem to 'start' it otherwise it does nothing!
6) biggy you can mostly forget about depth as everything is just addChild.
here is how you attach a movie if you wanted to use a dynamic string rather than the normal as3 way.
_root.addChild(new (getDefinitionByName(_linkage) as Class));
and create empty movieclip
_root.addChild( new MovieClip() );
although you normally do this in two lines or else you won't have easy access to the movie you just created!
7) loading is similar for all things. The way of using XML is much easier. here is an example of a class I am currently extending for my XML processing.
package net.justinfront.utils {
// generic xml loader to be extended for subtitles.
// not sure I need this.
import flash.display.*
import flash.events.*
import flash.net.*
// use EventDispatcher or sprite to get event communication going.
public class XMLloader extends EventDispatcher
{
public static var LOADED: String = "loaded";
public var xml: XML;
private var urlLoader: URLLoader;
private var getting: Boolean = false;
// when this class is extended to process subtitles etc.. this structure is used to make sure the data can not be
public function getXML():XML
{
// only return xml if it is not getting
if( !getting && ( xml != null ) )
{
return xml;
}
return null
}
public function XMLloader()
{
init();
}
private function init():void
{
//add any functionality here!
}
// loadfile is used to load an xml file.
public function loadfile( file: String ):void
{
getting = true;
var urlRequest:URLRequest = new URLRequest( file );
urlLoader = new URLLoader();
urlLoader.addEventListener( Event.COMPLETE, completeListener );
urlLoader.load( urlRequest )
}
// is called when the file is loaded
private function completeListener( e: Event ):void
{
getting = false;
xml = new XML( urlLoader.data );
parseXML();
// dispatches when xml can be used.
dispatchEvent( new Event( XMLloader.LOADED ) );
}
public function parseXML():void
{
trace('parsing!!');
// code to parse xml
}
private function dataType( str: String ):*
{
var no: Number;
no = Number( str );
if( isNaN( no ) )
{
// string
return str;
}
else
{
// number
return no;
}
}
}
}
Holy crap JLM, that is freaking great.
I could've almost gotten away with that post only. Thank you very much!
import every class?! dang.
Well feel free to ask anything about what I posted, but very much a newbie to newbie, I am just waiting for someone to come and tell me I got everything wrong!
.
Nice post JLM.
I bought bit's cookbook and found it very useful for how I worked. It was great to help translate my AS2 skills to AS3 because I was doing very heavy AS2 stuff at the time.
I have to admit though that I also, during that time, picked up FlashDevelop instead of using the Flash IDE. When you're coding everything in AS, FlashDevelop is WAY better than the Flash IDE. I hate to say so, but damn it's not even close once you start coding AS more and more.
As an example, if you're coding a class and forgot to import something, FD will add the import line in for you.
It also adds your variables in the code hinting making things easier as well.
I would recommend it once you start doing a lot of AS3 code.
Well i have to agree with Storm. AS3 has caused me to put ye old timeline in the past. Admittedly there are moments for it, but then you make your timeline anim and load it in using code. Flashdevelop is phenomenal. I feel warm and fuzzy when I open it up. I mean, really, it gives you code hinting for a class you just created and added to the project - that....is wicked. Now if only they ported it to linux - damn, that'd be sweet.
used flash develop alot for as2, great for injection but now I use textmate, which I also like, it has some good features if dig deep into bundles etc.. Lots or dev's seem to use FDT or flex builder, I am not sold on anything based on eclipse, it just seems like an overly complex piece of bloat and something I have to learn every 6 months, but I guess I will have to learn it anyway. Knowing textmate well is an advantage as next week I am at a ruby company they want me to do some flex, I have explained that I can code a graph in no time but they have been reading flexiblerails and are sold on flex so anyone got a run down like above for flex?
flashdevelop, good tip, I'll check it out. I've gotten so used to the Flash IDE that I don't know if I could switch, but it's definitely worth a look.
Most_useful_flash_thread_evar.
hey ewf.... i agree with the others here that bit's book and eas3 are great but you should also check out learning actionacript 3.0: a beginner's guide if you get a chance. it's a nice book and there's even color illustrations in there for ya.
ewf - have u considered a mac? Freelancing it was feasible for me, since switching I rarely miss windows, and ironically I only got a mac so I could run both and learn mac.
Persist, Arsis, Bit-101, Craftymind, DontBogartMe, sakri, tenplus, Storm, Hideaway, ernieweaselfat, doran, mystic_juju, and whoever I missed..
It would be great to create a guide to Modern flash - AS3, Flex, papervision, flashdevelop, textmate, FDT, Flexbuilder.... etc. if it went well we could publish something with extras and share kick backs. I am sure everyone would gain in any event in pure knowledge, one good post can save a day of banging your head against the wall.
So I propose the Twelvestone Guide to flash, to be shortly followed by other subjects of diverse nature such as tatoos!
I guess that everyone would submit stuff and more talented people would keep us on the straight an narrow. But this is just an idea and maybe it is not a good one?
I do think it's a worthwhile book because the more pieces of software utilizing the Flash Player and AIR, it is MIGHTY confusing for basic flashers and even more for beginners. Christ, I have been using and teaching Flash since v.2 and I get confused sometimes! I am always reading about the Flash v. AIR v. Silverlight battle when they aren't even competitors to each other. I consider it a worthwhile idea JLM. We could even do a Blurb book and see if it sells through their site. I just published my first book "Leaving California" through there and it seems to work nicely because you can print only as many as you need and they try to sell it.
I'm going to stink this thread as it some great info.
wayhey, my first stinkified thread! Although I think JLM made it stinkifiable. 
I think that's a great idea about the 12s flash guide, I'm not so sure I'd know enough to contribute, but I'd certainly purchase one. Especially the idea of posting a flash piece and having the code critiqued. I know I can get flash to do pretty much everything I want, I just don't know if it's the best way often.
Especially when it comes to doing complex animations in code... How the fuck can you do a really complicated bendy mask in the code? Surely it would be easier to do it on the timeline and use the code to load it?
Thanks for the other book suggestions as well d'or'an, I'll check that out as well.
Ernieweaselfat when do you think you can do the bendy mask tutorial with code loading? - long live the timeline.
Differences between AS2 and AS3
Good link. I'm sure everyone has already seen it, but good nonetheless.