Essential Actionscript 3 - Essential !

19 July, 2007

The great chapters.ca boat sailed into port - last week Essential Actionscript 3.0 by Colin Moock arrived on my doorstop. First impressions this is by far the biggest tech book to grace my shelves. 900+ pages worth, it dwarfs O'Reillys recently released Programming Flex 2 book. This book really does cover everything from general programming skills to the nitty gritty of E4X useage. The work that has gone into this book by Mr Moock shows. Approximately the first ~350 pages of the book is devoted to Core Actionscript & OOP principles in general, the second half Flash/Flex features such as XML, Drawing API, Security etc. Coupled with the Programming Flex 2 book I really think that's all you need for your bookshelf. My learning style is to learn by example (I skim read text - but thoroughly read code to understand) which is covered off really well, the vast majority of pages have a short code fragment or diagram to complement the text along with longer full code examples where applicable. Essential AS3 has depth to each and every topic, the ones I've read thus far anyway, going through example after example illustrating different facets of the topic - the XML chapter was particularly impressive. Too often you read a book and feel like you have to go back to the great Google Gods to discover more, whereas with this book I feel like that's all I need right there. All in all, the best tech book I've purchased (even over the famous Agile Web Development with Rails book). Value for money can't be beat, cost me about $55CAD to my doorstep - and illustrates how thankful I am living in Canada now, after being used to New Zealand book prices! It's already taken pride of place by the keyboard as I'm working on our new widget seller solution. 10|10

Read More

Getting started with Flex - what you should know.

10 July, 2007

Okay, so like me you've done a lot of web development with scripting languages ala Ruby, PHP, Perl etc and you've decided to try out Flex for a front end. What do you need to know ? This is just my own humble opinion - take it with a grain of salt, but for those looking to jump in you should find something valuable. This is all encompassed with the caveat that you are using the right tool for the right job, now what ? We know the advantages of using Flex - I'm not going to reiterate them. What I am going to tell you is the things to be aware of - not critiscims. Be prepared to invest time. Considering I had a working app with rails in one all night code marathon, I feel that I've only just waded in with Flex - granted this is apples to oranges comparison - however of everything I've jumped into, Flex is the one that takes the most time - mainly because it is developing interfaces, not yet another scripting language/framework stack. Beyond the basics you will spend a lot of time figuring out the nuances of what you need to do to get something working. You will have moments of happiness, and moments of wanting to heft your computer off a cliff.... Flex is not flash. Flex is a very real grown up interface language / architecture. Sure Flex is rendered via the Flash Player, and gets compiled down to a SWF but thats where the similarities start and end. [As a side note, I personally can't help but wonder if they just rebranded the flash player etc whether that would help Flex adoption...] Flex requires compilation of the runtime swfs. No biggie, but if you happen to be in Mac land on a Dual Core G5 (or worse) machine you might want to talk to your tech department about an upgrade. Compared to pure web scripting it can put a dent in your workflow, code-compile-refresh vs the time honoured code-refresh. If you're not going to break out the cash for Flex Builder lookup the Flex Compiler Shell (FCSH) on adobe labs. This dramatically cuts compilation time. Break out your OO skills. You're going to need them.. Actionscript 3 is strongly typed. If you've come from a dynamically typed background ala Ruby, this can hinder you - you have to consistently be aware of the types of objects your dealing with and what they can/can't do. Time and experience will render this issue obsolete. Event based programming - say hello to your new friend dispatchEvent. Everything is event based, and a solid part of learning flex, is realising when and where to send events and listen to events. You have to change your mindset to look at every possible combination of things the user can do in your app. Learn how to get events into your custom components and use them wisely. Learn how to use the Flex Builder Debugger. This is exceedingly powerful and useful for figuring out why your apps aren't doing what you expected them to do. Adobe can expect my money when they release Moxie for this feature alone. Code Completion. Again another life saving feature of Flex Builder is the code completion / inspector. An advantage of the strong typing this helps in your coding by seeing the correct properties/methods on objects - which in turn saves a lot of time referring back to the livedocs. More than one way to a skin a cat. For everything you try to achieve there normally multiple of ways of doing so. Keep persevering and find the one that works and is most suitable for the problem at hand.  You're not on your own - Adobe developer support is fantastic. Case in point the giant wall posters that I scored from Adobe for free - great for me but scary for the general populous walking into my office. You can see that Adobe want this to succeed and they're doing all they can to do so. A free SDK, good documentation, free PDF book downloads (for AIR), onAIR tour events, videos.onflex.org, open sourcing... you name it they're trying to do it - which gives me the warm fuzzies about investing my time in this technology. Above all, keep persisting it all pays off ! You can produce beautiful works of interface-art, that work as you expect them to, consistently and repeatedly. Pixel perfect and cross platform, beyond any interactivity possible with AJAX (unless you're a sadomasochist)

Read More

Working AIR / SQLite DataGrid example

12 June, 2007

!!!August 24 - The following code is for example only - DON'T copy and paste... the lovely little syntax highlighter screwed up casing and tag names. Just pay attention to the methods noted above and general structure.. I'll post up the correct files later on Okay so in my excitement to check out AIR/Apollo I tried to get the SQLite connection working. The sample code in the livedocs on one of the initial Flex Builder builds (the online docs have since been corrected), had a few errors in it ... So I reworked an example from start to finish to: 1. Open a connection 2. Create a table 3. Populate the table 4. Fetch from the table 5. Put results into a dataprovider. A couple of errors that will set you wrong in the docs, I've highlighted them below **. (Adobe ... feel free to put this into your examples and tidy it accordingly) 1. The example accesses SQLDBStatement, which doesn't exist - it's called SQLStatement 2. Instead of the method .db on SQLStatement it's .sqlConnection. Which will get you a working connection. Application File - test.mxml

	

Datagrid component - com/rowanh/components/Customers.mxml (note watchout for the cdata tags when you copy and paste... syntax highlighting isn't perfect)


	
		
           
	   
	   
        

Read More

First hours with Flex 3 / AIR

11 June, 2007

Small step for man, big step for RIA-kind ! I had to stay up past midnight to be one of the questionably committed few to read the words of joy spread by Ted Patrick. Not more than 2 seconds later I download Flex 3 builder. So far I've managed to spend a good solid 3-4 hrs in Builder 3 without any hiccups or crashes. A little gem of a resource, missed out on the various announcements, are the videos on onflex.org. Check out in particular the refactoring one. Looks like some serious goodness to be toyed with there. Something tells me Adobe is on a war path with this one, going for bigtime developer buy in and I'm pretty much sold. Good stuff Adobe! Top marks.

Read More

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License.