Monday, August 20, 2007

Colin Moock's guide to Flash for Flex programmers

One of the things that makes me laugh (and cry) about the Flex 2 documentation is that it implicitly assumes that the reader is familiar with Flash. Given that Flex is supposed to be a development environment targeted at traditional developers (familiar with Eclipse and source code control and the like), you'd think that it would be a fair assumption that at least a significant share of the readers of the Flex 2 doc set would be Java, C++ or C# programmers (like me) who are keen to understand how to build rich clients in Flex.

I guess that other newcomers to Flash will probably have the same frustrating time as I did trying to figure out how (and when) the AVM2 dispatches mouse, focus and keyboard events, how to refer to the instance's properties of a symbol created with
Flash CS3 using the Flex Component Kit for Flash CS3, and how to write programmatic skins etc...

So I thought a guide to Flash for Flex programmers was needed and I even though about writing one. That is until I read Colin Moock's recently published Essential AS3 book. Section 2 is
the essential "missing manual" on the AVM for Flex developers who don't come from a Flash background and Chapter 29 is the perfect introduction to the Flash IDE for Flex programmers.

One day there might be a book on the Flex class library of the same thoroughness and quality.

7 comments:

Darth Sidious said...

Ya another thing I feel like doing is writing a set of AS classes that mimic Coldfusion's functions, which are super awesome.

AS totally blows when it comes to managing lists, and Dates.

Btw... your comment feature doesn't work in IE - it continually keeps reloading.

Graeme Harker said...

Thanks for the heads up about IE

Ahad Bokhari said...

Karachi Pakistan
Hey I am just getting started with Flex. I would like to use php as the server side scripting...I have bought a book on Flex and they recommend that I use CF, however it can be expensive to host CF. Any recommendations?? Thanks

Graeme Harker said...

I recommend you study the (free) documentation that comes with Flex as there are plenty of (free) alternatives to using ColdFusion on the server (including .NET, Java and PHP)

Ahad Bokhari said...

Thanks Graeme...Yeah there is alot of info out there...Well worth it for me to go open source! If you set your mind to it its all there for the taking....

And thanks again for your informative blog.

Flex programming said...

I’ve tried several examples of using the flex component kit for Flash AS3 and none of them are working for me. Whenever I run the “Convert Symbol to Flex Component Command,” I get the following output:

Command made the following changes to the FLA:
Turned on Permit Debugging
Turned on Export SWC
Set frame rate to 24
Imported FlexComponentBase component to library
Symbol “BallComponent” can be used as a Flex component.
Select File > Publish to create the SWC file for use in Flex.

This appears to be correct but after adding the SWC to the flex library, my flex application does not seem to “see” the new component. I’ve managed to pull in components that others have made with Flash AS3 and the component kit so I don’t think I’m doing anything wrong on the flex side.

I noticed that in Flash, FlexComponentBase does not show up in my library after converting my symbol to a flex component. Additionally, nothing happens when I drag FlexComponentBase into my library. It just doesn’t show up. When I go to the properties dialog for my exported component and try to validate mx.flash.UIMovieClip, I get the following message:

A definition for the base class could not be found in the classpath. Please enter the name of a class that is defined in the classpath, or enter the default base class ‘flash.display.MovieClip’.

I suspected there was something wrong with my installation of Flash CS3 or the Component Kit so I just uninstalled and reinstalled Flash CS3, Flex Builder, and the component kit with the same results.

I’ve now seen the same behavior with Flash CS3 9.0.2, Flex Builder 3 (tried both beta 2 and beta 3), and component kit 1.1.2.

Has anyone seen this behavior before?

Thanks in advance!

Graeme Harker said...

What's the "Base class" of your BallComponent in "Linkage properties"? It should be mx.flash.UIMovieClip. If it isn't then either the Component Kit's not installed or the Component Kit's SWC isn't on your project's "class path" (see Publish settings, Flash, AS3, settings).