Thank you and sorry - I've missed the "Color" type in Flash help.

But what is the role of __hasInitialized in your example? Why can't I just:

        [Inspectable(defaultValue="#FFFF66",type="Color")]
        public function get bgcolor():Number {
                return __bgcolor;
        }
        
        public function set bgcolor(val:Number):Void {
                __bgcolor = val;
                invalidate();
        }

(full source code in Bubble.* files @ http://preferans.de/flash/ )?

On 3/20/07, Muzak <[EMAIL PROTECTED]> wrote:
[Inspectable(defaultValue="#FFFF66",type="Color")]
 public var bgcolor:Number = 0xFFFF66;

You might be better off using a getter/setter since you will have to redraw the 
rect_mc each time the color changes.


private var rect_mc:MovieClip;
private var __bgColor:Number = 0xFFFF66;
private var __hasInitialized:Boolean = false;

private function draw() {
    setBgColor();
    __hasInitialized = true;
}

private function setBgColor():Void {
    // draw stuff, using __bgColor
    rect_mc.clear();
    rect_mc.beginFill(__bgColor);
    // etc..
    rect_mc.endFill();
}

[Inspectable(defaultValue="#FFFF66",type="Color")]
public function get bgColor():Number {
    return __bgColor;
}
public function set bgColor(val:Number):Void {
    __bgColor = val;
    if(__hasInitialized) setBgColor();
}

Regards
Alex
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to