Flexでは、スーパークラスがあるとしましょう...次のようなものです:
class SuperComponent extends DragStack {
private var _childReference:UIComponent;
public function SuperComponent() {
// ???
addEventListener(FlexEvent.CREATION_COMPLETE, onCreationComplete);
}
private function onCreationComplete(e:FlexEvent):void {
//The 'this[]' technique doesn't seem to work and causes run-time errors:
//trace("Component found: " + this["myButton"]);
}
}
次に、アプリケーションで次の派生クラスを使用します (例として MXML のモックアップのみ)。
<!-- Component ChildComponent.mxml -->
<mx:SuperComponent>
<mx:Button id="myButton" label="Press Me!" />
</mx:SuperComponent>
SuperComponent クラスから「myButton」の存在を確認し、それを参照するにはどうすればよいですか? getChildByName( ... ) を使用する必要がありますか?