Groups | Blog | Home
all groups > flash exchange extensions > october 2005 >

flash exchange extensions : Inspectable tag of an Object type


e-merald
10/27/2005 7:41:51 PM
Hello.

Does anybody know how to solve the following situation...
The component has a property of an object type (?fontNormalStyle?) with the
values like ?fontColor?, ?fontWeight? etc.
These properties should not be displayed in the main Component inspector panel
but in the window box of the fontNormalStyle property (object) and have color
picker and pre-populated list box. So it looks like [Inspectable] tags embedded
in an object property ("fontNormalStyle"). Like "sub-properties"... I have
tried to do something like this but failed.

At present, the user has to type the HEXA value for the fontColor and the
string value ("none" or bold) for the fontWeight parameter. Is there any way to
do it using color picker and pre-populated list box accordingly? The Macromedia
team thinks it possible. As for me - I don't know how...

Hope someone is able to help me.

...
var __fontNormalStyle:Object;
var __fontColor:Number;
var __fontWeight:String;
...
function set fontColor (val:Number) {
__fontColor = val;
invalidate();
}
function get fontColor ():Number {
return __fontColor;
}
...
[Inspectable (defaultValue={"fontColor:0x000000,fontWeight:none,..."},
type="Object")]
function set fontNormalStyle (fObj:Object) {
__fontNormalStyle = fObj;
invalidate();
}
function get fontNormalStyle ():Object {
return __fontNormalStyle;
}
...
taraschuk
10/28/2005 2:58:46 PM
e-merald --

Looks like you need to set "type" of the inspectable property. You can set the
type of an Inspectable property to List, Color, Font...

//Set font weight
[ Inspectable(type="List", defaultValue="normal", enumeration="normal,bold");]
public function set fontWeight(str:String) {
font_weight = str;
invalidate();
}

//Font Color
[ Inspectable(type="Color", defaultValue="#999999");]
public function set fontColor(num:Number) {
font_color = num;
}
AddThis Social Bookmark Button