Top / Flex / 覚え書き

デバッグの為のダイアログ

mx.controls.Alert.show('デバッグ文', 'メッセージ');

DataGrid?の選択しているオブジェクトを取得する。

別途hogeItem変数は定義しておきます。

 <mx:DataGrid id="list" width="100%" height="100%" dataProvider="{dataObject}" change="hogeItem=event.target.selectedItem">
   <mx:columns>
   <mx:Array>
     <mx:DataGridColumn headerText="Name" columnName="name"  width="300"/>
     <mx:DataGridColumn headerText="Price" columnName="price" textAlign="right" marginRight="4"/>
   </mx:Array>
   </mx:columns>
   </mx:DataGrid>
 <mx:Label text="{hogeItem.name}" />

グリッド内で行を選択するとchangeイベントが発生するので、

event.target.selectedItem

プロパティで選択しているオブジェクトを取得できます。

TileList?で選択しているオブジェクトを取得する。

<mx:TileList id="myTile" dataProvider="{dataObject}" height="100%" width="100%" 
  itemHeight="116" itemWidth="120" cellRenderer="ProductThumbnail" borderStyle="none"
  change="selectedItem=dataObject[myTile.selectedIndex];">
  ↑選択している場所(selectedIndex)を使って配列からオブジェクトを取得する。
</mx:TileList>

この記事は

選択肢 投票
おもしろかった 9  
そうでもない 16  
  • デバッグだけなら、trace()使うと簡単ですよ。Flash Playerがデバッグ版である必要がありますが、Flex Builderを入れると自動で入るはず。 -- 2007-11-06 (火) 17:30:28

Top / Flex / 覚え書き

現在のアクセス:9201


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2012-05-16 (水) 14:57:06 (4356d)