<?xml version="1.0" encoding="utf-8"?> <s:Button xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" initialize="onInitialize(event)" click="onClick(event)"> <fx:Metadata> /** * A button which allows for browsing for and selecting files for processing * * @author Mathias Brodala */ /** * Dispatched when files where selected by the user */ [Event("filesSelected", type="de.dtele.ui.components.events.UploadButtonEvent")] </fx:Metadata> <fx:Script> <![CDATA[ import de.dtele.data.Assets; import de.dtele.ui.components.events.UploadButtonEvent; import mx.events.FlexEvent; /** * Reference to the list of files */ protected var files:FileReferenceList = new FileReferenceList(); /** * Sets up the file selection listener */ protected function onInitialize(e:FlexEvent):void { this.files.addEventListener(Event.SELECT, this.onFilesSelect); } /** * Starts the file browser for file selection */ protected function onClick(e:Event):void { this.files.browse(); } /** * Nofies about file selection by the user */ protected function onFilesSelect(e:Event):void { this.dispatchEvent(new UploadButtonEvent(UploadButtonEvent.FILES_SELECTED, this.files.fileList)); } ]]> </fx:Script> <s:label>Dateien hochladen ...</s:label> <s:icon>{Assets.AddImage}</s:icon> </s:Button>