Hello dear forum users.
I’m programmign in Flash ActionScript CS4.
Tests in the browser (This is the web direction flash) Google Chrome, Mozilla FireFox
Confronted with the problem and even the head does not come to the reason.
What I have:
1.I have finished library, which consists the *.FLA file, which draw button.
2.When clicking this button launches FileReferenceList.browse
3.After browse worked and users choose files - array of files copies to the new list and by pressing the other buttons all files from thatlist
4.uploaded to the server by FileReference.upload
What I want to get
in my case, my files are always pictures
a) I want to intercept the files upload to the server and before uploading each file Set following Manufacture:
b) load picture by FileReference.load to the flash and give the date to Bitmap. Afer that do image resizing
c) and after that upload to the server by using urlLoader.
And so each picture.
Then I started having problems:
ReferenceError: Error # 1069: Unable to find property in load flash.net.FileReference; have no default value.
…
at SWFUpload / Select_Handler ()
at SWFUpload / Select_Many_Handler ()
therefore I decided to throw FileReference.load in “3.” (read upper)
immediately after working out FileReferenceList.browse I’m trying to load the file to a flash.
But the error was the same - it’s changes only place of exception.
I got the impression that I just did not connect some library (or some thing like that).
I’m programmign in Flash ActionScript CS4.
Tests in the browser (This is the web direction flash) Google Chrome, Mozilla FireFox
I would be very grateful for at least some tips …
If there is something to do non-obvious - I can pay little reward for practical assistance.
Thanks in advance everyone!
Here I writes the most important part of the code (the rest is here: http://depositfiles.com/files/3ann5ho3x):
package
{
import flash.display.*;
import flash.events.*;
import flash.external.*;
import flash.net.*;
import flash.system.*;
import flash.text.*;
import flash.utils.*;
public class SWFUpload extends flash.display.Sprite
{
public function SWFUpload()
{
................................
fileBrowserMany = new flash.net.FileReferenceList();
image = new flash.display.Bitmap();
file_queue = new Array();
file_index = new Array();
valid_file_extensions = new Array();
httpSuccess = [];
super();
if (!flash.net.FileReferenceList || !flash.net.FileReference || !flash.net.URLRequest || !flash.external.ExternalInterface || !flash.external.ExternalInterface.available || !flash.events.DataEvent.UPLOAD_COMPLETE_DATA)
{
return;
}
................................
this.fileBrowserMany.addEventListener(flash.events.Event.SELECT, this.Select_Many_Handler);
................................
this.stage.addEventListener(flash.events.MouseEvent.CLICK, function (arg1:flash.events.MouseEvent):void
{
self.ButtonClickHandler(arg1);
return;
})
................................
return;
}
................................
private function ButtonClickHandler(arg1:flash.events.MouseEvent):void
{
if (!this.buttonStateDisabled)
{
if (this.buttonAction !== this.BUTTON_ACTION_SELECT_FILE)
{
if (this.buttonAction !== this.BUTTON_ACTION_START_UPLOAD)
{
this.SelectFiles();
}
else
{
this.StartUpload();
}
}
else
{
this.SelectFile();
}
}
return;
}
................................
private function SelectFiles():void
{
var allowed_file_types:String;
var allowed_file_types_description:String;
var loc1:*;
allowed_file_types = "*.*";
allowed_file_types_description = "All Files";
if (this.fileTypes.length > 0)
{
allowed_file_types = this.fileTypes;
}
if (this.fileTypesDescription.length > 0)
{
allowed_file_types_description = this.fileTypesDescription;
}
this.Debug("Event: fileDialogStart : Browsing files. Multi Select. Allowed file types: " + allowed_file_types);
ExternalCall.Simple(this.fileDialogStart_Callback);
try
{
this.fileBrowserMany.browse([new flash.net.FileFilter(allowed_file_types_description, allowed_file_types)]);
}
catch (ex:Error)
{
this.Debug("Exception: " + undefined.toString());
}
return;
}
................................
private function Select_Many_Handler(arg1:flash.events.Event):void
{
this.Select_Handler(this.fileBrowserMany.fileList);
return;
}
................................
private function Select_Handler(arg1:Array):void
{
................................
var loc4:*;
loc4 = NaN;
................................
loc4 = 0;
while (loc4 < arg1.length)
{
arg1[loc4].load(); //<--------------- ERROR HERE!!!!!
loc5 = new FileItem(arg1[loc4], this.movieName, this.file_index.length);
................................
loc4 = (loc4 + 1);
}
................................
return;
}
................................
private var _loader : flash.display.Loader;
private var file_index:Array;
private var fileTypes:String;
private var restoreExtIntTimer:flash.utils.Timer;
private var valid_file_extensions:Array;
private var fileBrowserMany:flash.net.FileReferenceList;
private var image:flash.display.Bitmap;
private var file_queue:Array;
private var current_file_item:FileItem=null;
private var fileBrowserOne:flash.net.FileReference=null;
private var fileTypesDescription:String;
private var uploadURL:String;
private var movieName:String;
private var successful_uploads:Number=0;
private var _fileRef:flash.net.FileReference;
}
}