F9 for actions

Some possibly useful and definitely unuseful ActionScript 3.0 code.

Aug 4

Inspectable Parameters Not Showing Up on Custom Components in Flash CS5

So I just upgraded to Flash CS5 this week at work and I found a really finicky problem that does not seem to be documented anywhere. I build a lot of custom components for my job, and if you’ve ever done it you know that building custom components for Flash is a little like an Indiana Jones adventure - you get beaten up a bit, there’s some problem solving, and a whole lot of improvising before you reach the end, oh yeah and snakes too.

Anyway, the problem I came across was that with my custom components moving from CS4 (where they worked great) to CS5, my components no longer had their parameters visible in the component inspector, or in CS5 the properties panel. After an hour of Google searching with no answer to be found I decided it had to be an edge case of some sort.

The way I had previously listed my Inspectable tags in my code had been after my class declaration and before my property declaration - so it looked a little like this:

public class NavigationButton extends UIComponent {
	[Inspectable (name = "Button Type", variable = "ButtonType", type = "List", defaultValue = "Text", enumeration = 'Text,Blank,Hidden')]
	[Inspectable (name = "Disabled", variable = "Disabled", type = "Boolean", defaultValue = 'false')]
	[Inspectable (name = "Label", variable = "ButtonText", type = "String", defaultValue = 'Next')]

In CS4 this was a completely acceptable way to define your inspectable parameters for your custom components. However in CS5 they just do not register. After looking at how a few tutorials organize their Inspectable tags, I found that a few of the more recent tutorials define their Inspectable parameters just before the getter and setter functions for that parameter. So with a little cut and paste I moved the Inspectable tags just above the getters and setters like so:

[Inspectable (name = "Label", variable = "ButtonText", type = "String", defaultValue = 'Next')]
public function set ButtonText( t:String ):void {
	btnlabel = t;
	draw();
public function get ButtonText():String {
	return btnlabel;
}

And viola! The Component Definition now shows all of my Inspectable parameters that I have defined in the component class. Also note that when you make the change, you’ll want to open the Component Definition window twice, because it does not recompile the clip until you hit the OK button on that window. So the parameters won’t show up the first time, but they will after the clip gets recompiled.

Also, if you’re having the problem where your component is blowing up because Flash CS5 can’t find fl.core.UIComponent you need to add in $(AppConfig)/Component Source/ActionScript 3.0/User Interface as a source path in your ActionScript settings.


  1. esther-moore reblogged this from f9foractions
  2. darcie-martinez reblogged this from f9foractions
  3. f9foractions posted this