Internet Explorer 6 is not supported.
Upgrade to view this site.

Blog Archive

Results for January, 2009.

TransitionManager Events

I recently used the TransitionManager class to get some ready-made animation in a project I am working on. The problem was I needed to know when the tween ended so I could dispatch an event to tell my application to allow user interfacing again. I checked the Adobe API on TransitionManager and there were no events to respond to be found there. Not even a useful inherited event. So I decided to poke around in the class file itself just to see what was going on in there. In case you don’t know, never edit these classes. They are essentially part of the Flash application. If you need extra functions it’s always better to make a subclass extending the class and write your own methods and properties. That what OOP is all about.

There are 2 events that can be responded to in their without editing the code to do so. The two strings that you can add a listener for are these.

1
2
const ALL_TRANSITIONS_IN_DONE:String = "allTransitionsInDone";
const ALL_TRANSITIONS_OUT_DONE:String = "allTransitionsOutDone";

Of course, these events don’t carry any TransitionManager specific properties, it just dispatches the generic Event telling the application that it happened. I don’t know why this wasn’t included in the API, as it is something that is useful for this the implementation of this class. Maybe I’ll get around to writing a TransitionManagerEvent class one day. Until then, this works.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import fl.transitions.*;
import fl.transitions.easing.*;
 
const ALL_TRANSITIONS_IN_DONE:String = "allTransitionsInDone";
const ALL_TRANSITIONS_OUT_DONE:String = "allTransitionsOutDone";
 
var currentSlide:Slide = new Slide();
addChild(currentSlide);
 
var tm:TransitionManager = new TransitionManager(currentSlide);
tm.startTransition({type:Blinds, direction:Transition.OUT, duration:2, easing:None.easeNone, numStrips:10, dimension:0});
tm.addEventListener(ALL_TRANSITIONS_OUT_DONE, outTransitionsDone);
 
function outTransitionsDone(event:Event):void
{
	trace("done");
}

You can get the FLA example file here.

Photoshop CS4 and OpenGL

pixelgridThis is the new Photoshop CS4 sleeper feature. It doesn’t quite have the bling-bling of the 3D features added or the groundbreaking content aware scaling feature but it subtly affects the way you interact with the application. OpenGL runs off your video card (if your card has it) and allows for these new interface upgrades.

The pixel grid makes the division between pixels more obvious at higher magnifications. I think this could be very useful for creating pixel icons. I personally map out my pixel icons out in Illustrator. It is really tedious, using the move command to move and duplicate a 1 pixel square rectangle to make the shape. I like pain. I must. I guess I just like the idea of them being scalable vector icons. Even though they’ll never be larger than 100% size. This feature may make me rethink my pixel icon workflow. Read more …

Associative Arrays

An Associative Array can be made in ActionScript 3 by using an Object instead of an Array. You use the Object to make a name/value pair. Name/Value pairs consist of a name and a value and are separated by a colon. The name is what you use to reference the value. When you reference what is in the Associative Array you just write the name as if it was a property on the Object. Here is an example of how to make an Associative Array.

1
2
3
var info:Object = {name:"Tony", occupation:"Bouncer", iq:80};
 
trace("My name is " + info.name + " and I am a " + info.occupation + " with an IQ of " + info.iq + "." );

You could also write it out long-handed and the effect would be the same. Below is the same thing but the names are added as dynamic properties of the newly instantiated Object.

1
2
3
4
5
6
var info:Object = new Object();
info.name = "Tony";
info.occupation = "Bouncer";
info.iq = 80;
 
trace("My name is " + info.name + " and I am a " + info.occupation + " with an IQ of " + info.iq + "." );

They only problem with this is that you lose the length property on this Associative Array. If you try getting the length property it will come up as undefined. I looked this up and found that Senocular actually has a class that fixes this. That class is called AssociativeArray and it can be found here. When I first tried it I got an error at line 32. I didn’t read the class to figure out what was wrong, but I commented out the line throwing the error and it seems to work fine. Here is an example of that class in action. Read more …

Illustrator Spirograph

Remember when you were a kid? Doing kid stuff like eating paint chips and huffing glue. Do you remember when you got caught doing that stuff and Mom told you to play with something that didn’t make you see Jesus Christ in your Fruity Pebbles? Sometimes she would ask you to play with Spirograph instead.

It seems that the Illustrator team at Adobe got caught with a lot of paint in their mouths because they decided to add the game they grew up with as a little known feature in Illustrator. So now it’s really simple to make these kind of designs free-form and a lot faster than with some plastic gear template.

First, select pretty much any drawing tool: Line Segment, Rectangle, Ellipse, etc. I chose the Star tool. Now drag a star out and while doing that hold the tilde (~) key and the shift key. You will see the edge hinting stick as you drag. When you release, the edge hinting will remain as artwork. The shift modifier allows the shape to be constrained at center. Holding option with the Line Segment tool will allow free movement at center instead of at the end of the line. Holding shift with a circle can make a quick tunnel effect.

The modifiers is what makes this interesting. Try every combination you can think of. If you want to go for extra credit try this finger-cramping configuration. Try starting the shape then pressing the space bar. It will make a trail across the screen. If  you have a star going it becomes a shooting star. Go ahead, make a wish, you paint-licking dreamy-dreamers.

Zoom and Doom

When you use the keyboard shortcut to zoom in (command +) or zoom out (command -) in Photoshop the window scales along with the image. If you haven’t gotten used to this quirky default behavior yet there is a one-click fix to get it out of your life forever.

Well, at least until the next time you have to drop your preference file. Go to Photoshop > Preferences > General (command K) and click off “Zoom Resizes Windows”. Now the keyboard commands behave the same as the zoom tool. If your missing the good times you used to share with this behavior, take solace in knowing that you can bring it back just by moving your thumb over. You can use the alternate zoom behavior by adding option to the key command. Simply press (option command +) for zoom in and (option command -) for zoom out to bring back the glory days of window scale and zoom.

You'll Get No Help From Flash CS4

I got the new Creative Suite 4 at work the other day. My boss tells me I am one of four who got it this early. He was one that got it too. I asked him why they wasted a copy on him. From what I gathered, so he could open the program and then say he’s got mad skills.

Disc 1, Disc 2. Once it installed I was on my way to going through all the new features. Still had to setup. I can’t touch a new version of CS without setting up all my panels just like the previous one. Then I think about how the new feature panels fit into it. As I went to put the Help panel where it goes in my workspace I am redirected to Safari! I thought I was in Flash a second ago? I looked all over for a new place for the Help panel and came up with squat. Then (because Flash so generously opened my browser for me) I looked for others that were up-in-arms about this change as well. Google let me know I wasn’t alone.

I found this post where there is some kind of workaround for it. This doesn’t keep it in the IDE though. It just makes the help be local instead of on the internet. Which is faster, but doesn’t address the real problem. I like to look at the help and the code the same time, my Workspace is based on the premise that the Help panel is on my right side.

Apparently, Adobe has no intention of putting this back in the IDE. Looks like they are making the big push to get developers out of Flash and into Flex. Sure, it’s more money. Hey Adobe, I’ll use Flex because it is a better editor, not because you hack shit out of other programs to corral me into using it. All I can hope for now is that someone will develop an extension for Flash, basically an internal web browser like Flex, that can display help.