Flex 2 Typed Array Example using Templates

Here is an example of using the ArrayElementType with templates in Flex 2:

// File: ButtonRow.as
package {

import mx.containers.HBox;
import mx.containers.VBox;
import mx.controls.Button;
import mx.controls.Label;
import mx.events.FlexEvent;

public class ButtonRow extends VBox {

 public var buttons:Array;
 public function ButtonRow() {
 private function onCreationComplete(event:FlexEvent):void {
  var label:Label = new Label();
  label.text = this.label;
  var buttonRow:HBox = new HBox();                
  for(var i:int = 0; i < buttons.length; i++) {    buttonRow.addChild(buttons[i]);   }   addChild(buttonRow);  }    } } [/as] [xml]

http://www.adobe.com/2006/mxml” xmlns:local=”*”>

Leave a Reply

Your email address will not be published. Required fields are marked *