ã¯ããã«
ããã®ãã¥ã¼ããªã¢ã«ã§ã¯Flexã®ããã²ã¼ã·ã§ã³ã³ã³ãããã¬ã¤ã¢ã¦ãã³ã³ãããå©ç¨ãã¦ãè¤æ°ã®ãã¥ã¼ãåãã£ãã¢ããªã±ã¼ã·ã§ã³ãä½æãã¾ããããã§ã¯ãã¬ã¤ã¢ã¦ãã³ã³ããã®ããã¤ãã®ä½¿ç¨æ³ã«å ãããã¼ã¿ã®é
åãæè»ã«è¡¨ç¤ºãããã¨ãã§ããTileList
ã³ã³ããã¼ã«ã®ä½¿ç¨æ³ã解説ãã¾ããã¾ããMacromedia Flex 1.5ã«æ°ãã«æè¼ããããã£ã¼ãç¨ã³ã³ãã¼ãã³ãã®ä½¿ç¨æ³ãç´¹ä»ãã¾ãã
ããªãããã®ãã¥ã¼ããªã¢ã«ã¯Macromediaã«ã¹ã¿ãã¼ãã¬ã¼ãã³ã°ã°ã«ã¼ãã«æå±ãããRobert Crooksãå·çãã4é¨æ§æã®ãã¥ã¼ããªã¢ã«ã®ãã¼ã3ã§ãã
- Flexåºç¤è¬åº§ï¼ãã¼ã1ï¼:ã¯ããã¦ã®Flexã¢ããªã±ã¼ã·ã§ã³éçº
- Flexåºç¤è¬åº§ï¼ãã¼ã2ï¼:Flexé»åã¢ããªã±ã¼ã·ã§ã³ã®ä½æ
- Flexåºç¤è¬åº§ï¼ãã¼ã4ï¼:ãã¼ã¿ã¢ãã«ã®å©ç¨
æ¬ãã¥ã¼ããªã¢ã«ã®å 容
Application
ã¿ã°ã®ä½¿ãæ¹TabNavigator
ã®ä½¿ãæ¹ViewStack
ã®ä½¿ãæ¹LinkBar
ã®ä½¿ãæ¹Panel
ã³ã³ããã®ä½¿ãæ¹HBox
ã®ä½¿ãæ¹VBox
ã®ä½¿ãæ¹TileList
ã³ã³ããã¼ã«ã®ä½¿ãæ¹LineChart
ã³ã³ãã¼ãã³ãã¨ãã®ãµãã³ã³ãã¼ãã³ãã®ä½¿ãæ¹Label
ã³ã³ããã¼ã«ã®ä½¿ãæ¹Button
ã³ã³ããã¼ã«ã®ä½¿ãæ¹- ActionScriptã§ã®é åã®ä½ãæ¹
- ActionScriptã§ã®ãªãã¸ã§ã¯ãã®é åã®ä½ãæ¹
- ä¸è¦§ã¢ã¤ãã ã®ã¤ãã³ãã«å¯¾ããActionScriptã®ã¤ãã³ããã³ãã©ã®ä½ãæ¹
ãã®è¨äºã«å¿ è¦ãªãã®
ããã®ãã¥ã¼ããªã¢ã«ããã©ãã¼ããã«ã¯ãã¤ãã«æããã½ããã¦ã§ã¢ããã¡ã¤ã«ãã¤ã³ã¹ãã¼ã«ããå¿ è¦ãããã¾ãã
Macromedia Flex
ãFlexã®ãã©ã¤ã¢ã«çã«é¢ãã詳細ã«ã¤ãã¦ã¯ãFlex FAQãåç §ãã¦ãã ãããã¾ãããã©ã¤ã¢ã«çã®å ¥ææ¹æ³ã«ã¤ãã¦ã¯ããã¡ããåç §ãã¦ãã ããã
ããã¹ãã¨ãã£ã¿
ãFlex Builderããããã¯Dreamweaver MX 2004ããããã¯XMLã¨ActionScriptã®ã³ã¼ããè¨è¿°ã§ããã³ã¼ãã¨ãã£ã¿ï¼Notepadã®ãããªç°¡åãªããã¹ãã¨ãã£ã¿ã§ãå¯ï¼ãå¿ è¦ã§ãããªãFlex Builderã¯Flexãµã¼ãã¼ã¨ã¨ãã«ãã¦ã³ãã¼ãã§ãã¾ããã¾ããDreamweaver MX 2004ã®ãã©ã¤ã¢ã«çã®å ¥ææ¹æ³ã«ã¤ãã¦ã¯ããã¡ããåç §ãã¦ãã ããã
ãã®ãã¥ã¼ããªã¢ã«ã®ããã®ã½ãªã¥ã¼ã·ã§ã³ãã¡ã¤ã«
ãcontainer.zipã«ã¯ããã®ãã¥ã¼ããªã¢ã«ã§ç´¹ä»ããcontainers.mxmlã®ã½ã¼ã¹ã³ã¼ããåé²ããã¦ãã¾ãã
ãã®è¨äºã®ããã«å¿ è¦ãªäºåç¥è
- ãFlexã®æ¦è¦ã®ç´¹ä»ããèªã¿çµãã¦ãããã¨
- Flexã¢ããªã±ã¼ã·ã§ã³ã®ãã©ã¦ãºæ¹æ³ãææ¡ãã¦ãããã¨
- ãFlexåºç¤è¬åº§ï¼ãã¼ã1ï¼:ã¯ããã¦ã®Flexã¢ããªã±ã¼ã·ã§ã³éçºãã¨ãFlexåºç¤è¬åº§ï¼ãã¼ã2ï¼:Flexé»åã¢ããªã±ã¼ã·ã§ã³ã®ä½æããèªã¿çµãã¦ããããFlexã¢ããªã±ã¼ã·ã§ã³ã®ä»çµã¿ã«é¢ããåºç¤ç¥èããããã¨
ã¢ããªã±ã¼ã·ã§ã³ã®ä½æ
ããã®ãã¥ã¼ããªã¢ã«ã§ã¯ããã²ã¼ã·ã§ã³ã³ã³ããã¨ã¬ã¤ã¢ã¦ãã³ã³ããã®ä½¿ç¨æ³ã«ç¦ç¹ãç½®ããç°¡åãªã¢ããªã±ã¼ã·ã§ã³ãæ§ç¯ãã¾ããããã§ã¯ãTabNavigator
ã³ã³ãããå©ç¨ãã¦ããã¥ã¼ã2ã¤æã¤ã°ãã¼ãã«ããã²ã¼ã·ã§ã³ã·ã¹ãã ãä½æãã¾ããã¾ãããã¥ã¼ã®1ã¤ã«ã¯ãLinkBar
ã¨ViewStack
ããã²ã¼ã·ã§ã³ã³ã³ãããå©ç¨ãã¦ã2ã¤ã®ãµããã¥ã¼ãåãã£ããã¼ã«ã«ããã²ã¼ã·ã§ã³ã·ã¹ãã ãä½æãã¾ãã
ãåãã¥ã¼ã«ã¯Panel
ãHBox
ãForm
ãªã©ã®ãã¾ãã¾ãªã¬ã¤ã¢ã¦ãã³ã³ãããå©ç¨ãã¾ããã¢ã¤ãã ã®éåãã¬ã¤ã¢ã¦ãããããã®TileList
ã³ã³ããã¼ã«ãããã¼ã¿ãè¦è¦åããããã®LineChart
ã®ä½¿ç¨æ³ã«ã触ãã¦ããã¾ãã
Applicationãªãã¸ã§ã¯ãã®ä½æ
ãFlexã¢ããªã±ã¼ã·ã§ã³ã®éçºã¯ãã¾ãXMLã®å®£è¨ã¨Application
ãããã¯ãè¨è¿°ãããã¨ããå§ã¾ãã¾ããApplication
ã¿ã°ã®ä¸ã«ã¯ãã¤ãã«ç¤ºãMX
ã¯ã©ã¹ã©ã¤ãã©ãªã®åå空é宣è¨ãè¨è¿°ãã¾ãã
xmlns:mx="http://www.macromedia.com/2003/mxml"
ããªããæ¥é è¾ã®mx
ã¯ãã®ã©ã¤ãã©ãªã®ãã¹ã¦ã®ã¿ã°ã«å¯¾ãã¦ä½¿ç¨ãã¾ãã
- æ°è¦ãã¡ã¤ã«ãéãã¦ããã®ãã¡ã¤ã«ããflex_tutorialsããã£ã¬ã¯ããªã«ãcontainers.mxmlãã¨ãã¦ä¿åãã¾ãã
- ãã¡ã¤ã«ã®æåã«ãã¤ãã®XML宣è¨ã追å ãã¾ãã
- XML宣è¨ã®ã¤ãã«ãMXMLåå空éã®æå®ã®å
¥ã£ã
Application
ã¿ã°ã追å ãã¾ãã
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"> </mx:Application>
ãã¼ã¿é åã®ä½æ
ããã®ãã¥ã¼ããªã¢ã«ã®ãã¼ã1ã§ã¯ã¿ã°ã®æ§æã§é åãä½æããæ¹æ³ãç´¹ä»ãã¾ããããããã§ã¯ActionScriptã§ä½æããæ¹æ³ãç´¹ä»ãã¾ãã
Application
ãããã¯ã®ä¸ã«Script
ãããã¯ã追å ãããã®ä¸ã«CDATA
ã»ã¯ã·ã§ã³ãè¨è¿°ãã¦ãXMLãã¼ãµã¼ãã¹ã¯ãªãããXMLã®ã³ã¼ãã¨ãã¦è§£æããªãããã«ãã¦ããã¾ããScript
ãããã¯ã®ä¸ã§é åå¤æ°ã®myArray
ãå®ç¾©ãããã®å¤æ°ã®å¤ã«é åãã¼ã¿ã®[0,1,2,3,4,5,6,7,8,9]
ãä»£å ¥ãã¾ãã
<mx:Script> <![CDATA[]]> </mx:Script>
var myArray=[0,1,2,3,4,5,6,7,8,9];
ãªãã¸ã§ã¯ãã®é åã®ä½æ
ããªãã¸ã§ã¯ãã®é
åãä½æãã¾ãããªãã¸ã§ã¯ãã®é
åã¯å¾ã»ã©ä½æããã³ã³ããã¼ã«ã§ä½¿ç¨ããã¨ã¨ãã«ããã£ã¼ãç¨ã³ã³ãã¼ãã³ãã«ãã¼ã¿ãä¾çµ¦ããããã«ã使ç¨ãã¾ãããã®ãã¥ã¼ããªã¢ã«ã®ãã¼ã1ã§ä½æãããªãã¸ã§ã¯ãã®é
åã§ã¯ã<mx:Object>
ã¿ã°å
ã«ã¿ã°ããã¹ããããã¨ã§ãªãã¸ã§ã¯ãã®ããããã£ã宣è¨ãã¾ããããããã§ã¯<mx:Object>
ã¿ã°ã®å±æ§ãå©ç¨ãã¦ããããã£ãä½æããæ§æã使ç¨ãã¾ãã
Script
ãããã¯ã®å¾ã«<mx:Array>
ãããã¯ã追å ãã¾ãã<mx:Array>
ãããã¯ã®ä¸ã«<mx:Object>
ã¿ã°ã4ã¤è¿½å ããããããã®ã¿ã°ã«ã次ã«ç¤ºãlabel
ãvolume
ãrevenue
ããããã£ã追å ãã¾ãã
<mx:Array id="myArrayOfObjects"> </mx:Array>
<mx:Object label="Q1" volume="1600" revenue="10000"/> <mx:Object label="Q2" volume="1500" revenue="9000"/> <mx:Object label="Q3" volume="1900" revenue="12000"/> <mx:Object label="Q4" volume="2300" revenue="14000"/>
ã°ãã¼ãã«ããã²ã¼ã·ã§ã³ç¨ã®TabNavigatorã³ã³ããã®è¿½å
ãTabNavigator
ã³ã³ããã¯ããã®ã³ã³ããå
ã«å®£è¨ãããã¬ã¤ã¢ã¦ãç¨ã³ã³ããã®label
å¤ããã¨ã«ãã¦ãããã²ã¼ã·ã§ã³æ©è½ãèªåçã«çæãã¾ãã
Array
ãããã¯ã®å¾ã«TabNavigator
ã³ã³ããã追å ãããã¼ã¸ã³ãªã©ã®ããããã£ã次ã®ããã«è¨å®ãã¾ãã
<mx:TabNavigator id="tabNav" marginLeft="10" marginTop="20"> </mx:TabNavigator>
ã¡ã¤ã³ãã¥ã¼ç¨ã®HBoxã¬ã¤ã¢ã¦ãã¨Panelã³ã³ããã®è¿½å
ãFlex
ã¯ã©ã¹ã©ã¤ãã©ãªã«ã¯ãç»é¢ä¸ã®è¦è¦è¦ç´ ãæ´åãããããã«æ°ã
ã®ã¬ã¤ã¢ã¦ãã³ã³ããã¯ã©ã¹ãåé²ããã¦ãã¾ããããã§ã¯ããããã®ãã¡2ã¤ãã¡ã¤ã³ããã²ã¼ã·ã§ã³ãã¥ã¼ãæ§ç¯ããããã«å©ç¨ãã¾ãã
HBox
ã¬ã¤ã¢ã¦ãã³ã³ããï¼ã³ã³ãã³ãã横並ã³ã«æ´åPanel
ã³ã³ããï¼ãã¼ã1,2ã«ã¦ä½¿ç¨æ¸ã¿)ï¼ã³ã³ãã³ãã縦ã横ã両æ¹åã«æ´åããã¨ã¨ãã«ã¿ã¤ãã«ãã¼ã表示
ããªããPanel
ã®å ´åããã¼ã¿ãã¤ã³ãã£ã³ã°ãå©ç¨ãã¦ãPanel
ã³ã³ããã®é«ãã¨TabNavigator
ã³ã³ããã®é«ãããªã³ã¯ããã¨è¯ãã§ãããããã®ãã¯ããã¯ãå©ç¨ããã°ãç¸å¯¾çã«ãµã¤ãºãæå®ã§ããããã«ã³ã¼ãã§ãµã¤ãºãæå®ããéãæ¸ããUIããªãã©ã¼ã ããéããã£ã¹ãã¬ã¤ãµã¤ãºã®ç°ãªãããã¤ã¹ã«ã¢ããªã±ã¼ã·ã§ã³ã移æ¤ããéãªã©ã«ä¾¿å©ã§ãããã®å ´åããã¼ã¿ãã¤ã³ãã£ã³ã°ãå©ç¨ããé¨åãæ³¢æ¬å¼§ï¼{ }
ï¼ã§å²ã¿ã¾ãããã®æ³¢æ¬å¼§ã¯ãFlexã³ã³ãã¤ã©ã«å¯¾ãã¦ãæ¬å¼§å
ã®ã³ã³ãã³ããActionScriptã®è¡¨ç¾å¼ã¾ãã¯å¤æ°ã¨ãã¦è©ä¾¡ãããã¨ãæ示ãã¾ãã
TabNavigator
ã³ã³ããã®ãããã¯ã®ä¸ã«HBox
ã³ã³ããã追å ããlabel
ããããã£ã«ãView 1: Form/Tileããè¨å®ãã¾ããHBox
ã³ã³ããã®ãããã¯ã®å¾ã«Panel
ã³ã³ããã追å ããlabel
ããããã£ããView 2: Pseudo Bar Chartããid
ãheight
ãtitle
ããããã£ã次ã«ç¤ºãããã«ãããããè¨å®ãã¾ãã
<mx:HBox label="View 1: Form/Tile" width="500" height="400"> </mx:HBox>
<mx:Panel label="View 2: Sales Trends Chart"
title="Sales Trends"> </mx:Panel>
ãµããã¥ã¼ç¨ã®ViewStackãLinkBarãPanelã³ã³ããã®è¿½å
ãTabNavigator
ã³ã³ããã®ãã¼ã¹ã®ã¯ã©ã¹ã¨ãªãã®ããã³ã³ããã®é
åãå«ãViewStack
ããã²ã¼ã·ã§ã³ã³ã³ããã§ãããªããã³ã³ããã®é
åéã®ããã²ã¼ã·ã§ã³ã«ã¯selectedIndex
ãããã¯selectedItem
ããããã£ï¼selectedIndex
ã¯é
åå
ã®ã³ã³ããã®ä½ç½®ãselectedItem
ã¯ã³ã³ããã®id
å¤ãããããå©ç¨ãã¦åç
§ï¼ãå©ç¨ãã¾ããTabNavigator
ã³ã³ããã¯ViewStack
ã¯ã©ã¹ãç¶æ¿ãããã®ãªã®ã§ãViewStack
ãæ¢ã«å
èµããã¦ãã¾ãããã®ä»ã®ããã²ã¼ã·ã§ã³ã³ã³ããã¯ãæ示çã«å®ç¾©ããViewStack
ã³ã³ãããdataProvider
ã¨ãã¦ä½¿ç¨ãã¾ããããã®å ´åã§ãããã²ã¼ã·ã§ã³ã®è©³ç´°ã¯ã·ã¼ã ã¬ã¹ã«å¦çããã¾ãã
ãViewStack
ã³ã³ããã®å¹
ã¨é«ããè¨å®ããéã«ã¯ãFlex 1.5ã®æ°æ©è½ã§ãããã¼ã»ã³ãã¼ã¸ã§ã®ãµã¤ãºæå®ãå©ç¨ãã¾ããFlex 1.5ããã¯ãå¹
ãé«ãããã¯ã»ã«å¤ã ãã§ãªãã親ã³ã³ããã¨ã®ãã¼ã»ã³ãæ¯çã§ãæå®ãããã¨ãã§ãã¾ãã(ãã®éãã³ã³ããå
ã®ä»ã®ã³ã³ãã³ãã®ããã«å
åãªã¹ãã¼ã¹ã確ä¿ããã¦ãããã¨ãåæã¨ãªãã¾ãã)
ãLinkBar
ããã²ã¼ã·ã§ã³ã³ã³ããã«ã¯ç¸¦ã横ãã¨ããããã«æ¹åãæå®ããããã®ããããã£ãããã®ã§ãã°ãã¼ãã«ããã²ã¼ã·ã§ã³ã¨ãµãããã²ã¼ã·ã§ã³ã®ãããã®å ´é¢ã§ã便å©ã§ããããã§ã¯ããµãããã²ã¼ã·ã§ã³ã®ããã«LinkBar
ããã²ã¼ã·ã§ã³ã³ã³ãããå©ç¨ãã¾ãã
HBox
ã³ã³ããã®ä¸ã«ViewStack
ã³ã³ããã追å ããid
ããããã£ããvStackãã«è¨å®ãã¾ããHBox
ã³ã³ããå ã®ViewStack
ã³ã³ããã®åã«LinkBar
ã³ã³ããã追å ããdataProvider
ããããã£ãViewStack
ã³ã³ããã«ãã¤ã³ãããdirection
ããããã£ããverticalãã«è¨å®ãã¾ããViewStack
ã³ã³ããã®ä¸ã«Panel
ã2ã¤è¿½å ãã1ã¤ç®ã®Panel
ã®title
ã¨label
ããããã£ããFormãã«è¨å®ãã¾ãã2ã¤ç®ã®Panel
ã«ã¯ãtitle
ã¨label
ããTileãã«è¨å®ããid
ããtilePanelãã«è¨å®ãã¾ãã- ãã¡ã¤ã«ãä¿åããã¢ããªã±ã¼ã·ã§ã³ããã©ã¦ãºãã¦ã¿ã¾ããç»é¢ä¸ã®2ã¤ã®ã¿ãã¨ã
LinkBar
ã³ã³ããã®2ã¤ã®ãªã³ã¯ãã¯ãªãã¯ãããããã®ããã²ã¼ã·ã§ã³ãèªåçã«å¦çããã¦ãããã¨ã確èªãã¦ãã ãããã¾ãããã©ã¦ã¶ã®ï¼»æ»ãï¼½ãï¼»é²ãï¼½ãã¿ã³ãã¯ãªãã¯ãã¦ã¿ã¦ãã ãããããã²ã¼ã·ã§ã³ã³ã³ããã¯ãããã²ã¼ã·ã§ã³æã®ã¤ãã³ãããã©ã¦ã¶ã®å±¥æ´æ©è½ã¨é£æºãããã®ã§ããã©ã¦ã¶ã®ï¼»æ»ãï¼½ãï¼»é²ãï¼½ãã¿ã³ã¯é常ã®Webãã¼ã¸åæ§ã«åä½ãã¾ãã
<mx:ViewStack id="vStack"> </mx:ViewStack>
<mx:LinkBar dataProvider="{vStack}" direction="vertical"/>
<mx:Panel title="Form" label="Form"> </mx:Panel> <mx:Panel id="tilePanel" title="Tile" label="Tile"
width="220" height="210"> </mx:Panel>
Formã³ã³ããã®è¿½å
ãããã¾ã§ã§ã¢ããªã±ã¼ã·ã§ã³ã®ããã²ã¼ã·ã§ã³ãå®æããã®ã§ãããããã¯ã¬ã¤ã¢ã¦ãã³ã³ããã®ä½¿ç¨æ³ã«éç¹ãç½®ãã¾ããããã§ã¯ãã¾ãããã©ã¼ã ã®ã³ã³ããã¼ã«ç¾¤ãèªåçã«æ´åããããã«ãã©ã¼ã ã®ãã¼ã¿å¦çãæ¯æ´ããForm
ã³ã³ãããå©ç¨ãã¾ãã(ãã®ãã¥ã¼ããªã¢ã«ã§ã¯ãã¼ã¿å¦çã®æ¯æ´æ©è½ãå©ç¨ãã¾ããã詳細ã«ã¤ãã¦ã¯ãFlexããã¥ã¡ã³ãã¼ã·ã§ã³ãåç
§ãã¦ãã ããã)ãã©ã¼ã ã®ãã¼ã¿ã«å¯¾ãã¦ã¯ãããã§ç´¹ä»ããããã«ãä¸è¬çãªã¤ãã³ããã³ãã©ã使ç¨ã§ãã¾ãã
ãForm
ã³ã³ããå
ã«ã¯æ¬¡ã®2ã¤ã®ã³ã³ããã¯ã©ã¹ããã¹ãã§ãã¾ãã
FormHeading
ï¼1ã¤ã¾ãã¯è¤æ°ã®è¦åºããä½æï¼ãªãã·ã§ã³é ç®ã代ããã«Label
ã使ç¨ãããã¨ãå¯ï¼FormItem
ï¼1ã¤ã®ã³ã³ããã¼ã«ãã¾ãã¯ã³ã³ããã¼ã«ç¾¤ã¨ãã®ã©ãã«ãä½æ
ãForm
ã®ä¸ã«ã¯ãHTMLã®select
ã³ã³ããã¼ã«åæ§ã®æ©è½ãæä¾ããComboBox
ã使ç¨ãã¾ããComboBox
ã®è©³ç´°ã«ã¤ãã¦ã¯ãFlexåºç¤è¬åº§ï¼ãã¼ã1ï¼:ã¯ããã¦ã®Flexã¢ããªã±ã¼ã·ã§ã³éçºãåç
§ããããã«ãã¦ãã ãããComboBox
ã®ä¸ã«è¡¨ç¤ºããã¢ã¤ãã ã¯ãåãªãå¤ã®é
åã¾ãã¯ãªãã¸ã§ã¯ãã®é
åã¨ãã¦ç¨æãã¾ããããã§ã¯ãå
ç¨Script
ãããã¯ã®ä¸ã§ä½æããé
åã使ç¨ãã¾ãã
ãã¾ãããã®ã»ã¯ã·ã§ã³ã§ã¯ãControlBar
ã³ã³ãããä½æãã¾ããControlBar
ã¯æ¨ªæ¹åã«é
ç½®ãè¡ãPanel
ã®ããã¿ã¼ã«ãªããªãã·ã§ã³ã®ã³ã³ããã§ãã
- ãFormãã¨ããã¿ã¤ãã«ã®ã¤ãã
Panel
ã³ã³ããã®ä¸ã«Form
ã³ã³ããã追å ãã¾ãã Form
ã³ã³ããã®ä¸ã«FormHeading
ã追å ããlabel
ããMy Formãã«è¨å®ãã¾ããFormHeading
ã®å¾ã«FormItem
ã³ã³ããã追å ããlabel
ããPick a Numberãã«è¨å®ãã¾ããFormItem
ã®ä¸ã«ComboBox
ã追å ããid
ããmyComboãã«ãdataProvider
ããããã£ããmyArray
ãã¸ã®ãã¤ã³ãã«ããããè¨å®ãã¾ããForm
ã³ã³ããã®å¾ï¼å¼ãç¶ãPanel
ã®ä¸ï¼ã«ControlBar
ã³ã³ããã追å ãã¾ããControlBar
ã³ã³ããã®ä¸ã«Label
ã追å ããtext
ããããã£ã«ã¯æååã®ãYou chose: ãã¨ComboBox
ã®selectedItem
ããããã£ã¸ã®ãã¤ã³ãã£ã³ã°ãè¨å®ãã¾ãã- ãã¡ã¤ã«ãä¿åãã¦ããã©ã¦ã¶ã§ãã©ã¼ã ã®åä½ã確èªãã¾ãã
ComboBox
ã§ã¢ã¤ãã ãé¸æããã¨ãControlBar
ã³ã³ããã®ã©ãã«ãå¤åããã®ã確èªã§ãã¾ãã
<mx:Form> </mx:Form>
<mx:FormHeading label="My Form"/>
<mx:FormItem label="Pick a Number"> </mx:FormItem>
<mx:ComboBox id="myCombo" dataProvider="{myArray}"/>
<mx:ControlBar></mx:ControlBar>
<mx:Label text="You chose: {myCombo.selectedItem}"/>
TileListã®è¿½å ã¨ããªãã¸ã§ã¯ãã®é åã®è¡¨ç¤º
ã1ã¤ç®ã®ä¸»è¦ãã¥ã¼ã®ç¬¬2ãã¥ã¼ã«ã¯ãdataProvider
ããä¾çµ¦ãããã¢ã¤ãã ãã¿ã¤ã«ç¶ã«é
ç½®ããTileList
ã³ã³ããã¼ã«ã使ç¨ãããã¨ã«ãã¾ããTileList
ã¯ã¢ã¤ãã ãã°ãªããç¶ã«è¡¨ç¤ºããããã¨ãé¤ãã°ã以åã«ä½¿ç¨ããList
ãComboBox
ã³ã³ããã¼ã«ã¨ã»ã¼åãã§ãããªãTileList
ã«ã¯MouseOver
ãMouseDown
ããã¤ãã¢ï¼ã«ã¹ã¿ãã¤ãºå¯è½ï¼ãçµã¿è¾¼ã¾ãã¦ãããchange
ã¤ãã³ããå©ç¨ãããã¨ã§ã¤ãã³ããã³ãã©ãå¼ã³åºããã¨ãã§ãã¾ãã
- ãTileãã¨ããã¿ã¤ãã«ã®ã¤ãã
Panel
ã³ã³ããã®ä¸ã«TileList
ã³ã³ããã¼ã«ã追å ãã¦ãdataProvider
ããmyArrayOfObjects
ãã«ãã¤ã³ãããããè¨å®ããwidth
ãheight
ãã¨ãã«ã100%ãã«è¨å®ãã¾ããã¾ããchange
ã¤ãã³ãããsetStatus(event.target.selectedItem)
ãã«è¨å®ãã¾ãã - ã¢ããªã±ã¼ã·ã§ã³ã®ã³ã¼ãã®æåã«ãã
script
ãããã¯ã®ä¸ã«ãsetStatus()
é¢æ°ãå®ç¾©ããããã®function
ãããã¯ã追å ãã¾ãããã®é¢æ°ã§ã¯ãObject
åã®å¼æ°ããitemããåãä»ããããã«ããæ»ãå¤ããªãã«è¨å®ãã¾ãã function
ãããã¯ã®ä¸ã§ããTileãã¿ã¤ãã«ã®ã¤ããPanel
ã®status
ããããã£ã«ã"Revenue: "+item.revenue+" Volume: "+item.volume
ããä»£å ¥ãã¾ãã
<mx:TileList dataProvider="{myArrayOfObjects}"
change="setStatus(event.target.selectedItem)" width="100%"
height="100%"/>
function setStatus(item:Object):Void { }
tilePanel.status="Revenue: "+item.revenue+" Volume: " +item.volume;
repeated
ãªãã¸ã§ã¯ãã«é¢é£ã¥ãããããªãªã¸ãã«ãã¼ã¿ã®ã¢ã¤ãã ã§ãã- ãã¡ã¤ã«ãä¿åããã¢ããªã±ã¼ã·ã§ã³ããã©ã¦ãºãã¦ã¿ã¾ãã
TileList
ã«ãã£ã¦ã¿ã¤ã«ç¶ã«è¡¨ç¤ºãããã¢ã¤ãã ãã¯ãªãã¯ããPanel
ã³ã³ããã®ã¹ãã¼ã¿ã¹æ¬ã«åã¢ã¤ãã ã®ãã¼ã¿ã表示ããããã¨ã確èªãã¾ãã
LineChartã³ã³ãã¼ãã³ãã®ä½æ
ããã®ãã¥ã¼ããªã¢ã«ã®æå¾ã®ã¹ãããã§ã¯ãFlex 1.5ææ°ã®ãã£ã¼ãç¨ã³ã³ãã¼ãã³ããå©ç¨ãã¦ããªãã¸ã§ã¯ãã®é
åããç·ã°ã©ããçæãããã¨ã«ãã¾ããLineChart
ã³ã³ãã¼ãã³ãã¯ããã®ã³ã³ãã¼ãã³ãã«åãè¾¼ã¾ããã軸ãç¨ã®ã³ã³ãã¼ãã³ããªã©ã®ä¸é£ã®ã³ã³ãã¼ãã³ããå©ç¨ãããã¨ã§ãã°ã©ãã®å¤è¦³ãå®ç¾©ãã¾ãã
- ãView 2ãã®
Panel
ã®ä¸ã«<mx:LineChart>
ã³ã³ãã¼ãã³ãã追å ããdataProvider
ããmyArrayOfObjects
ãã«ãã¤ã³ãããã¨ã¨ãã«ãheight
ãå¨å²ã®ããã«ã®é«ãã«å¯¾ãã¦ã100%ãã«ãªãããã«è¨å®ãã¾ãã <mx:LineChart>
ã¿ã°ãããã¯ã®ä¸ã«<mx:horizontalAxis>
ãããã¯ã追å ãã¾ãã<mx:horizontalAxis>
ãããã¯ã®ä¸ã«<mx:CategoryAxis>
ã¿ã°ã追å ããdataProvider
ããmyArrayOfObjectsãã«ãã¤ã³ãããã¨ã¨ãã«ãcategoryField
ã«ãªãã¸ã§ã¯ãã®label
ããããã£ãè¨å®ãã¾ãã<mx:LineChart>
ãããã¯å ã®<mx:horizontalAxis>
ãããã¯ã®ä¸ã«ã<mx:series>
ãããã¯ã追å ãã¾ãã<mx:series>
ãããã¯ã®ä¸ã«ã<mx:Array>
ãããã¯ã追å ãã¾ãã<mx:Array>
ãããã¯ã®ä¸ã«ãã°ã©ãã®ç·ãå®ç¾©ããã2ã¤ã®<mx:LineSeries>
ã¿ã°ã追å ãã¾ããç·ç¨®ï¼formï¼ããCurveãã«è¨å®ããyField
ã¨name
ã®å¤ã¯ãdataProvider
ããä¾çµ¦ããããªãã¸ã§ã¯ãã®volume
ããããã£ãrevenue
ããããã£ã«å¯¾å¿ããããã«ãã¦ããã¾ãã- ããã§å®æã§ãããã¡ã¤ã«ãä¿åããã¢ããªã±ã¼ã·ã§ã³ã®åä½ã確èªãã¾ãããããã¿ã³ãã¯ãªãã¯ãã¦ãåä½ã確èªãã ããã
<mx:LineChart dataProvider="{myArrayOfObjects}" height="100%"> </mx:LineChart>
<mx:horizontalAxis> </mx:horizontalAxis>
<mx:CategoryAxis dataProvider="{myArrayOfObjects}"
categoryField="label"/>
<mx:series></mx:series>
<mx:Array></mx:Array>
<mx:LineSeries yField="volume" form="curve" name="Volume"/> <mx:LineSeries yField="revenue" form="curve" name="Revenue"/>
<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" > <mx:Script> <![CDATA[ // ãã¼ã¿é å var myArray=[0,1,2,3,4,5,6,7,8,9]; // ã¿ã¤ã«ç¨ã®ãã³ãã© function setStatus(item:Object):Void { tilePanel.status="Revenue: "+item.revenue +" Volume: "+item.volume; } ]]> </mx:Script> <mx:Array id="myArrayOfObjects"> <mx:Object label="Q1" volume="1600" revenue="10000"/> <mx:Object label="Q2" volume="1500" revenue="9000"/> <mx:Object label="Q3" volume="1900" revenue="12000"/> <mx:Object label="Q4" volume="2300" revenue="14000"/> </mx:Array> <!-- ã°ãã¼ãã«ããã²ã¼ã·ã§ã³ --> <mx:TabNavigator id="tabNav" marginLeft="10" marginTop="20"> <!-- ãã¥ã¼ 1 --> <mx:HBox label="View 1:Form/Tile" width="500" height="400"> <!-- ãµãããã²ã¼ã·ã§ã³ --> <mx:LinkBar dataProvider="{vStack}"
direction="vertical"/> <mx:ViewStack id="vStack" width="80%" height="100%"> <!-- form ãã¥ã¼ --> <mx:Panel title="Form" label="Form"> <mx:Form> <mx:FormHeading label="My Form"/> <mx:FormItem label="Pick a Number"> <mx:ComboBox id="myCombo"
dataProvider="{myArray}"/> </mx:FormItem> </mx:Form> <mx:ControlBar> <mx:Label
text="You chose:{myCombo.selectedItem}"/> </mx:ControlBar> </mx:Panel> <!-- tile ãã¥ã¼ --> <mx:Panel id="tilePanel" title="Tile" label="Tile"
width="220" height="210"> <mx:TileList dataProvider="{myArrayOfObjects}"
change="setStatus(event.target.selectedItem)"
width="100%" height="100%"/> </mx:Panel> </mx:ViewStack> </mx:HBox> <!-- ãã¥ã¼ 2 --> <mx:Panel label="View 2: Sales Trends Chart"
title="Sales Trends"> <mx:LineChart dataProvider="{myArrayOfObjects}"
height="100%"> <mx:horizontalAxis> <mx:CategoryAxis dataProvider="{myArrayOfObjects}"
categoryField="label"/> </mx:horizontalAxis> <mx:series> <mx:Array> <mx:LineSeries yField="volume" form="curve"
name="Volume"/> <mx:LineSeries yField="revenue" form="curve"
name="Revenue"/> </mx:Array> </mx:series> </mx:LineChart> <mx:ControlBar> </mx:ControlBar> </mx:Panel> </mx:TabNavigator> </mx:Application>
ã¤ãã®ã¹ããã
ãæ¯éã¤ãã®ãã¥ã¼ããªã¢ã«ã«é²ã¿ãããã«Flexã®ç¿å¾ãæ·±ãã¦ãã ããã
- Flexåºç¤è¬åº§ï¼ãã¼ã1ï¼:ã¯ããã¦ã®Flexã¢ããªã±ã¼ã·ã§ã³éçº
- Flexåºç¤è¬åº§ï¼ãã¼ã2ï¼:Flexé»åã¢ããªã±ã¼ã·ã§ã³ã®ä½æ
- Flexåºç¤è¬åº§ï¼ãã¼ã4ï¼:ãã¼ã¿ã¢ãã«ã®å©ç¨
ããã®ãã¥ã¼ããªã¢ã«ã®å 容ã«ãé¢å¿ããæã¡ããã ããå ´åã¯ãFlexã«ããã©ã«ãã§å«ã¾ãã¦ãããµã³ãã«ã¢ããªã±ã¼ã·ã§ã³ãªã©ãä¸åº¦ç®ãéãããã«ãã¦ãã ãããFlexã®æè¼æ©è½ããã¢ãããµã³ãã«ãå¤æ°åé²ããã¦ãã¾ãã