Not sure if this is something I should be worried about, but I noticed that
when extending UIComponent (or other visual classes)
that during initaliazation the styleChanged method is called twice, with a null
argument.
When running the simple test code below, I get the following output.
TestComponent ::: CONSTRUCTOR
- className: TestComponent
TestComponent ::: styleChanged
- style: null
TestComponent ::: createChildren
TestComponent ::: styleChanged
- style: null
TestComponent ::: measure
TestComponent ::: updateDisplayList
- unscaledWidth: 100
- unscaledHeight: 100
Is this something we should be worried about, unnecessary method calls?
regards,
Muzak
// test component
package com.muzakdeezign.test {
import mx.core.UIComponent;
public class TestComponent extends UIComponent {
//====================================
// CONSTRUCTOR
//====================================
public function TestComponent() {
trace("TestComponent ::: CONSTRUCTOR");
super();
trace(" - className: "+this.className);
}
//----------------------------------------------------------------
//
// createChildren()
//
//----------------------------------------------------------------
override protected function createChildren():void {
trace("TestComponent ::: createChildren");
super.createChildren();
}
//----------------------------------------------------------------
//
// measure()
//
//----------------------------------------------------------------
override protected function measure():void {
trace("TestComponent ::: measure");
super.measure();
this.measuredWidth = this.measuredMinWidth = 100;
this.measuredHeight = this.measuredMinHeight = 100;
}
//----------------------------------------------------------------
//
// updateDisplayList()
//
//----------------------------------------------------------------
override protected function updateDisplayList(w:Number, h:Number):void {
trace("TestComponent ::: updateDisplayList");
trace(" - unscaledWidth: "+w);
trace(" - unscaledHeight: "+h);
super.updateDisplayList(w, h);
}
//----------------------------------------------------------------
//
// styleChanged()
//
//----------------------------------------------------------------
override public function styleChanged(styleProp:String):void {
trace("TestComponent ::: styleChanged");
trace(" - style: "+styleProp);
super.styleChanged(styleProp);
}
}
}