状況
パーツをコード側で生成する部分はできた。以下のような感じ。
protected function OnComp_EnemyActionGrid():void{ for(var i:int = 0; i < ENEMY_ACTION_GRID_NUM; ++i){ var row:GridRow = new GridRow(); { //type { var item_type:GridItem = new GridItem(); //combo_box { var cb:ComboBox = new ComboBox(); { cb.dataProvider = ENEMY_ACTION_TYPE_ITEMS; cb.id = "enemy_val_action_type_"+i; //change //complete } item_type.addChild(cb); } row.addChild(item_type); } //time { var item_time:GridItem = new GridItem(); //numeric_stepper { var ns_time:NumericStepper = new NumericStepper(); { ns_time.id = "enemy_val_action_time_" + i; ns_time.value = 60; ns_time.minimum = 0; ns_time.maximum = 99999; ns_time.width = 60; ns_time.addEventListener(Event.CHANGE, OnEvent_EnemyVal2Enemy); //!!creationComplete } item_time.addChild(ns_time); } row.addChild(item_time); } //param { var item_param:GridItem = new GridItem(); //numeric_stepper { var ns_param:NumericStepper = new NumericStepper(); { ns_param.id = "enemy_val_action_param_" + i; ns_param.addEventListener(Event.CHANGE, OnEvent_EnemyVal2Enemy); ns_param.value = 60; ns_param.minimum = 0; ns_param.maximum = 99999; ns_param.width = 60; //!!creationComplete } item_param.addChild(ns_param); } row.addChild(item_param); } } enemy_action_grid.addChild(row); } }
dataProviderは別にarrayを入れても良い点や、Comboboxは「fl.controls」じゃなくて「mx.controls」を使う点などははまったものの、生成はできた。
あとは、これらを参照する方法がわかればOK。メンバとして保持してもいいけど、どうせだから文字列から指定する方法を調べておきたい。今日はここまで。