Subversion Repositories linkit

[/] [trunk/] [fileUploadApp/] [src/] [main/] [flex/] [FileUploadApp.mxml] - Rev 1

Compare with Previous | Blame | View Log

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:com="com.flashdev.file.*" layout="absolute"
    creationComplete="initApp()" viewSourceURL="srcview/index.html"
    backgroundColor="white">
        
        <mx:Script>
                <![CDATA[
                
                        import mx.controls.Alert;
            import flash.external.*;
            import com.flashdev.utils.Localizator;

            [Bindable]
            public var domain:String;
            [Bindable]
            public var target:String;
            [Bindable]
            public var leftSpace:Number;
            [Bindable]
            public var maxFileSize:Number;
            [Bindable]
            public var locale:String;
            [Bindable]
            public var showSendButton:String;

            [Bindable]
            private var uploadDoneMsg:String;
            [Bindable]
            private var uploadSucceedMsg:String;
            [Bindable]
            private var ioErrorMsg:String;
            [Bindable]
            private var errorMsg:String;
            [Bindable]
            private var securityErrorMsg:String;
                        
                        // Initalize
                        private function initApp():void {
                domain = Application.application.parameters.domain;
                target = Application.application.parameters.target;
                leftSpace = Application.application.parameters.leftSpace;
                maxFileSize = Application.application.parameters.maxFileSize;
                locale = Application.application.parameters.locale;
                showSendButton = Application.application.parameters.showSendButton;

                                Security.allowDomain(domain);

                Localizator.getInstance().lang = getLocalizator();

                initMessages();
                        }

            private function getLocalizator():int {
                if ("fr_FR" == locale) {
                    return Localizator.FRENCH;
                } else {
                    return Localizator.ENGLISH;
                }
            }

            private function initMessages():void {
                uploadDoneMsg = Localizator.getInstance().getText('msg.upload.done');
                uploadSucceedMsg = Localizator.getInstance().getText('msg.upload.success');
                ioErrorMsg = Localizator.getInstance().getText('msg.upload.ioError');
                errorMsg = Localizator.getInstance().getText('msg.error');
                securityErrorMsg = Localizator.getInstance().getText('msg.upload.securityError');
            }
                        
                ]]>
        </mx:Script>
        
        <mx:Canvas width="500" height="200" horizontalCenter="0" verticalCenter="0">
        <!--mx:Label text="showSendButton = {showSendButton}"/-->
                <com:FileUpload
                        width="100%" height="100%"
            uploadUrl="{target}"
            leftSpace="{leftSpace}"
            maxFileSize="{maxFileSize}"
            showSendButton="{showSendButton}"
            uploadComplete="Alert.show(uploadDoneMsg, uploadSucceedMsg)" 
            uploadIOError="Alert.show(ioErrorMsg, errorMsg)"
            uploadSecurityError="Alert.show(securityErrorMsg, errorMsg)"/>
        </mx:Canvas>
</mx:Application>

Compare with Previous | Blame | View Log