flash

Flash CS4 Gotchas

I've been banging my head against Flash for the last few days and started trying to document a few things.

Can't import fl.controls

For some reason Adobe didn't include them by default so you'll need to add the path to the project.

  1. Open the File > Publish Settings... menu item
  2. Click the Flash tab
  3. Click the Settings... button
  4. Click the Source Path tab
  5. Click the + button and paste in: $(AppConfig)/Component Source/ActionScript 3.0/User Interface

Can't use a Tween on a scrollRect

The Tween class can only change a simple property and the scrollRect need to be changed and the reassigned before it will update. The solution is to add new property to the class and Tween that instead:

  
public function get scrollX():Number {
  if (this.scrollRect) {
    return this.scrollRect.x;
  }
  return 0;
}   

public function set scrollX(value:Number) {
  var r:Rectangle = this.scrollRect;
  if (r) {
    r.x = value;
    this.scrollRect = r;
  }
}

Then you can use a Tween:

  tween = new Tween(this, "scrollX", Strong.easeOut, scrollX, scrollX + 100, 1, true);

Also, you'll want to keep a reference to the Tween object so that it doesn't get garbage collected half way through the animation.

Can't use named HTML entities

Flash's TextField only supports a small subset of named HTML entities (< > & " '). If you're displaying HTML from users or a CMS you'll find that things like ° slips by so you'll need to convert the named entities to their numeric versions.

jjjjj.... j Fay Kaaaaa

This is one of my favorite flash videos. You might need to watch it ten times before you really appreciate it.

Syndicate content