Programmation Flex/Utilisation des composants/Adobe Air
Apparence
Programmation_Flex |
---|
Sommaire |
Liens |
Modifier ce modèle |
FileSystemTree & FileSystemDataGrid
[modifier | modifier le wikicode]<?xml version="1.0" encoding="utf-8"?>
<!-- aircomponents/src/FSDirApp.mxml -->
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="750" height="500">
<s:layout>
<s:VerticalLayout/>
</s:layout>
<mx:HDividedBox>
<mx:FileSystemTree id="tree"
width="200" height="100%"
directory="{new File('C:\\')}"
enumerationMode="directoriesOnly"
change="dataGrid.directory = File(tree.selectedItem);"/>
<mx:FileSystemDataGrid id="dataGrid"
width="100%" height="100%"
directory="{new File('C:\\')}"/>
</mx:HDividedBox>
</s:WindowedApplication>
- new File('c:\\') sort le répertoire c:\
- l'id "tree" alimente l'id "datagrid" avec la liste File() de l'élément sélectionné sur "tree"
FileSystemHistoryButton
[modifier | modifier le wikicode]<?xml version="1.0" encoding="utf-8"?>
<!-- aircomponents/src/FSHistoryBSimple.mxml -->
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<s:layout>
<s:VerticalLayout/>
</s:layout>
<s:HGroup>
<mx:FileSystemHistoryButton label="Back"
dataProvider="{fileList.backHistory}"
enabled="{fileList.canNavigateBack}"
click="fileList.navigateBack();"
itemClick="fileList.navigateBack(event.index)"/>
<mx:FileSystemHistoryButton label="Forward"
dataProvider="{fileList.forwardHistory}"
enabled="{fileList.canNavigateForward}"
click="fileList.navigateForward();"
itemClick="fileList.navigateForward(event.index)"/>
</s:HGroup>
<mx:FileSystemList id="fileList"/>
</s:WindowedApplication>
- enabled contient canNavigateBack et canNavigateForward pour reculer dans la navigation ou avancer
- dataprovider contient les historiques de navigation initialisé par l'itemClick
FileSytemList
[modifier | modifier le wikicode]<?xml version="1.0" encoding="utf-8"?>
<!-- aircomponents/src/FSListSimple.mxml -->
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<s:layout>
<s:VerticalLayout/>
</s:layout>
<mx:FileSystemList id="fileList"/>
<s:Button label="Up"
click="fileList.navigateUp();"
enabled="{fileList.canNavigateUp}"/>
</s:WindowedApplication>
- Le bouton up raméne la navigation de l'id "fileList" au précédent
FileSystemComboBox
[modifier | modifier le wikicode]<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="init();">
<mx:Script>
<![CDATA[
import flash.filesystem.File;
private function init():void
{
fcbChange.directory = File.desktopDirectory;
}
private function setOutput():void
{
output.text = fcbChange.directory.nativePath;
}
]]>
</mx:Script>
<mx:FileSystemComboBox id="fcbChange" directoryChange="setOutput();"/>
<mx:TextArea id="output" width="200" height="50"/>
</mx:WindowedApplication>
- setOutput met le chemin de "fcbChange" dans l'id "output"
HTML
[modifier | modifier le wikicode]<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:ControlBar width="100%">
<mx:Button label="< Back" click="content.historyBack();"/>
<mx:Button label="Forward >" click="content.historyForward();"/>
<mx:TextInput id="address" text="{content.location}" width="100%"/>
<mx:Button label="Go!" click="content.location = address.text"/>
</mx:ControlBar>
<mx:Canvas width="100%" height="100%">
<mx:HTML id="content" location="http://labs.adobe.com/"/>
</mx:Canvas>
</mx:WindowedApplication>
- les boutons et le textInput permettent de naviguer dans le browser