Sha256: 549812bdc778697f084a49db2936b87d51193848a020590c97df7c67cc2a48e2
Contents?: true
Size: 1.9 KB
Versions: 3
Compression:
Stored size: 1.9 KB
Contents
package <%= base_package %>.models.presentation { import flash.events.Event; import flash.events.KeyboardEvent; import flash.events.IOErrorEvent; import org.restfulx.utils.RxFileReference; import <%= base_package %>.models.presentation.ResourceModel; import <%= base_package %>.models.constant.Resource; import <%= base_package %>.models.domain.Account; import <%= base_package %>.controllers.event.ResourceEvent; public class AccountModel extends ResourceModel { [Bindable] public var photoFileName:String = "None selected"; [Bindable] public var signUpFormDirty:Boolean = true; [Bindable] public var photoErrorString:String; [Bindable] public var accountEvent:ResourceEvent; private var photo:RxFileReference; private var _account:Account; [Bindable] public function get account():Account { return _account; } public function set account(value:Account):void { _account = value; } public function AccountModel() { account = new Account(); } public function signUp():void { create(account, accountEvent); } public function signUpOnEnter(event:KeyboardEvent):void { if (event.keyCode == 13) { signUp(); } } public function chooseFile():void { photo = new RxFileReference("avatar"); photo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler, false, 0, true); photo.addEventListener(Event.SELECT, selectFile, false, 0, true); photo.addEventListener(Event.CANCEL, cancelBrowse, false, 0, true); photo.browse(); } private function fileSelected(event:Event):void { photoFileName = RxFileReference(event.target).name; } private function ioErrorHandler(event:Event):void { photoErrorString = "Failed to selected a file. Please try again."; } private function selectFile(event:Event):void { fileSelected(event) } private function cancelBrowse(event:Event):void { photo = null; } } }
Version data entries
3 entries across 3 versions & 1 rubygems