Thursday, August 23, 2007

Getting back the hand cursor in AS3

As I migrate from Flash ActionScript 2 (AS2) to ActionScript 3 (AS3), I'm always finding little differences. In AS2, if you set the onPress event of a MovieClip to a value, your MovieClip will then cause the cursor to switch to the hand cursor when you mose over it. I found in AS3, you need to manually set two properties to get this effect (thanks Colin!):
myClip_mc.buttonMode = true;
myClip_mc.useHandCursor = true;
That's kind of a drag if you have already created a movie with dozens (or more!) of clickable MovieClip instances. I'd done just that so I was hoping I was missing some global way getting back this functionality easily. There wasn't... so I made one :)

Below is a class that extends from MovieClip, and in its constructor it sets the two properties I'm looking to be set:
package {
import flash.display.MovieClip;
class ClickableMovieClip extends MovieClip {
function ClickableMovieClip():void {
this.buttonMode = true;
this.useHandCursor = true;
}
}
}
So all I had to do was go into my library and set the Base Class of each of the Symbols I knew I wanted clickable in my movie. One weird thing I found: after typing that in to the base class field, I needed to click the check mark next to it, it you just clicked "OK" then it'd give you an error.

Sunday, August 19, 2007

Great sites for educational DVDs

I found a couple great resource for educational DVDs. Not educational in the "reading, 'riting, 'rithmetic" sense, but along the lines for learning computer programs, traditional arts and crafts, hobbies, and a variety of "do-it-yourself" training.

The first place is SmartFlix.com. SmartFlix rents these types of DVDs. Unlike the similar sounding NetFlix, SmartFlix does not charge a monthly subscription. You pay $9.99 to rent a DVD for a week, which include shipping (to and from). This is a great way to check out DVDs before buying them (which can be expensive).

The next place to check out is LearningByDVD.com. LearningByDVD was recommended to me by the SmartFlix folks. They sell a huge range of DVDs, like the ones you can rent from SmartFlix. I bought a half-dozen from them already and find the customer service to be outstanding. They even ordered some DVDs they don't normally stock to fill my order. If you don't see something in their inventory, make sure you ask!

A few of my favorite things...

There are a few pieces of software, freely available, that I really like. I like them better than some commercial alternatives. For example, Adobe recently came out with version 2 of their Bridge software. Version 1 was useless, but version 2 is much more usable. Still, I find myself going back to the free XnView for browsing images. It launches and runs significantly faster than the Bridge. I find it useful even as a file browser. You can also use it to convert between file formats and make common adjustments to images like rotating, cropping, contrast and levels. An interesting feature is how it deals with a Photoshop file, it allows you to page through the layers. By default it shows the composite version of the visible layers, but you can click through and look at each individually.

Another nice, free program I keep coming back to is Filezilla. It is a ftp client that has a great user interface.

I was recently introduced to XML Notepad 2007. It is built with .NET and has is a fast, simple, well-designed program for editing XML. It makes ftp operations easy. It amazes me the increasing quality of free and open source software.

While not freeware, I like the inexpensive ZuluPad Pro. It does have a free version, ZuluPad, but I feel the pro version for $15 is worth the price. ZuluPad Pro is a great way to keep a hypertext linked set of notes. I find my document often goes beyond what I intend when I started. It's small and fast and easy to use (Can you see a theme here? I guess it from years of being a Mac user since 1986, though I'm on XP now).

Tuesday, August 14, 2007

Bridging Flash 8 to Flash CS3


I was looking for a book or video to bridge between Flash 8/AS2 and Flash 9/AS3. I found just what I needed with Flash CS3 Professional Advanced: Visual QuickPro Guide by Russell Chun. Chun has done an outstanding job with the use of diagrams to explain concepts as well as providing a generous number of screenshots. I've even learned a few unexpected things along the way. Having co-authored two books myself (Director and Lingo Bible versions 7 and 8), I know he must have put a great deal of work into this and it shows.

Thursday, August 09, 2007

Flash Scenes

One thing that I never used with Flash is the Scene feature. I was always aware of it, I'd just never needed it. Plus, scenes don't get much of an buildup from the online help (the emphasis in bold I added):
  • Scenes can make documents confusing to edit, particularly in multiauthor environments. Anyone using the FLA document might have to search several scenes within a FLA file to locate code and assets. Consider loading content or using movie clips instead.
  • Scenes often result in large SWF files. Using scenes encourages you to place more content in a single FLA file, which results in larger FLA files and SWF files.
  • Scenes force users to progressively download the entire SWF file, even if they do not plan or want to watch all of it. If you avoid scenes, users can control what content they download as they progress through your SWF file.
  • Scenes combined with ActionScript might produce unexpected results. Because each scene Timeline is compressed onto a single Timeline, you might encounter errors involving your ActionScript and scenes, which typically requires extra, complicated debugging.
Not exactly a ringing endorsement for scenes!

I've been doing some Savvy Development, following the Allen Interactions way, using Flash. While I was working on the media prototype in Flash, the media prototype is developing the look of the piece. I was getting frustrated with doing different screens for the app and was about to switch to Photoshop to just do a static bitmap representation of the screens. Then I decided to try the scene feature. WOW! Did that make doing different screens easy! In the Scenes panel you can give the scenes meaningful names and keep it open to quickly switch between scenes. Then I saw the Duplicate Scene and things got even easier!

Now I wouldn't recommend them for the final developing the final product, but I would for when you need to develop a series of screens rapidly. If you're not using them, you should give it a try.

Tuesday, August 07, 2007

SmartStroke doesn't like Classical

The other day I was using the Painter X SmartStroke Autopainting feature and it was running very slowly. I figured it was because I had many big apps open (Photoshop, Flash, Dreamweaver, Illustrator, Outlook), but normally this is not a problem. Regardless, I start exiting them one by one and testing to see if the performance comes back. Finally, all have been exited and the performance was still bad. I'm starting to think I'll have to reboot. Well, there was one last app open... I was listening to the local classical station using Window Media Player, which was in an IE browser window minimized in my Taskbar. That turned out to be the troublemaker! Once I quit that, the SmartStroke was back to speed (even after I launched my "big" apps again). I thought I'd pass this tidbit along.

Sunday, August 05, 2007

FlashDevelop 3.0 Beta

Yes this has been the weekend of Flash technology...

I've been messing with ActionScript 3 today as I read through Essential ActionScript 3.0 and Programming Flex 2. Being one to be easily distracted by shiny objects, I found a shiny object. FlashDevelop 3.0 is in beta and it works pretty nicely. I'd messed with FlashDevelop 2.0 but hadn't used it in quite a few months. I downloaded 3.0 tonight and it works great with Flash CS3! You can create a Flash IDE project from a template. It works better than the Flash code editor (so did the previous version). It makes coming up to speed on the new APIs much easier.

Flex 2 States

I've been learning a little about Flex 2 this weekend while working through O'Reilly's Programming Flex 2 by Chafic Kazoun and Joey Lott. There's always a big gap between working through a book and doing a real project when it comes to technology.

That said, one feature of Flex 2 that I think is implemented quite well is states. From my practice, it seems Adobe has implemented the concept in a straightforward manner. States relate to the view. You create different states for different modes your program is in. A program can only have one current state at a time. I'm impressed at how easy it is to set up a series of states and switch between them. When you do switch between states, the different controls on a state preserves its own state, i.e. a checked CheckBox remains checked whether it is part of the active state or not. I look forward to seeing whether I feel the same in actual practice.

Self-portrait in Flash


In the spirit of the Old Masters (who often did self-portraits for practice), I did this as an exercise to improve my Flash illustration skills. I initially did two self-portraits, one on each weekend, then last week I merged the best qualities of each.

This piece made it into the CartoonSmart.com student gallery. Click on my image above to see the Flash version on my website. The Flash version is under 15KB in size, smaller than the JPG above.

Saturday, August 04, 2007

ActionScript 3.0

I'm finally able to begin getting into ActionScript 3.0 (AS3). As I do, I'm amazed at the Java influence (with some C#).

Funny thing. My first AS3 project started as a very simple click a MovieClip and go to the next frame. No surprises there, right? LOL!

My simple:

stop();
trading.onPress = function(){
this.play();
};
Became:
stop();
function nextScreen(event:MouseEvent):void{
this.play();
}
trading.addEventListener(MouseEvent.CLICK, nextScreen);
trading.buttonMode = true;

While not that much more syntactically, definitely different and a big jump towards the Java way. Having taught Java for two years, I don't mind it. But I am curious how other folks will like it.

This was enough of a change to make me pick up O'Reilly's Essential ActionScript 3.0 by Colin Moock. It's funny that the title says "Essential" and the subtitle is "ActionScript 3.0 Programming Fundamentals". Why is it funny? The book is around 900 pages, and it is not large print. Colin does his usual job of superb thoroughness in covering the topic. If you're working with AS3, it's a must have.