rails_generators/rx_scaffold/templates/layouts/default.erb in dima-restfulx-1.2.2 vs rails_generators/rx_scaffold/templates/layouts/default.erb in dima-restfulx-1.2.3
- old
+ new
@@ -7,16 +7,18 @@
import <%= base_package %>.models.<%= class_name %>;
<% for model in belongs_tos -%>
import <%= base_package %>.models.<%= model.camelcase %>;
<% end -%>
<% if attachment_field.size > 0 -%>
+ import flash.net.FileReference;
import org.restfulx.utils.RxFileReference;
<% end -%>
[Bindable]
private var <%= class_name.dcfirst %>:<%= class_name %> = new <%= class_name %>();
<% if attachment_field.size > 0 -%>
+
[Bindable]
private var fileName:String = "None selected";
private var file:RxFileReference;
<% end -%>
@@ -81,14 +83,14 @@
}
<% if attachment_field.size > 0 -%>
private function chooseFile():void {
file = new RxFileReference("<%= attachment_field[0].camelcase(:lower) %>");
- file.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler, false, 0, true);
- file.addEventListener(Event.SELECT, selectFile, false, 0, true);
- file.addEventListener(Event.CANCEL, cancelBrowse, false, 0, true);
- file.browse();
+ file.reference.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler, false, 0, true);
+ file.reference.addEventListener(Event.SELECT, selectFile, false, 0, true);
+ file.reference.addEventListener(Event.CANCEL, cancelBrowse, false, 0, true);
+ file.reference.browse();
}
private function selectFile(event:Event):void {
fileSelected(event)
}
@@ -96,10 +98,10 @@
private function cancelBrowse(event:Event):void {
file = null;
}
private function fileSelected(event:Event):void {
- fileName = RxFileReference(event.target).name;
+ fileName = FileReference(event.target).name;
}
private function ioErrorHandler(event:Event):void {
fileChooser.errorString = "Failed to selected a file. Please try again.";
}
\ No newline at end of file