RE: [Flashcoders] FileReference and actionscript 2.0

2006-06-26 Thread Mike
Pretty simple:

import flash.net.FileReference;
class package.FileReferenceListener extends Object {
public function FileReferenceListener () {
super();
}
private function onCancel(file:FileReference):Void {
trace(onCancel:  + file.name);
}
private function onOpen(file:FileReference):Void {
trace(onOpen:  + file.name);
}
private function onProgress(file:FileReference,
bytesLoaded:Number, bytesTotal:Number):Void {
trace(onProgess:  + file.name + :  + bytesLoaded + / +
bytesTotal);
}
}

Then, elsewhere, you can do something like this:

import flash.net.FileReference;
import package.FileReferenceListener;
// ...
var file:FileReference = new FileReference();
var listener:FileReferenceListener = new FileReferenceListener();
file.addListener(listener);
// Do stuff with file.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of human
ghaderyan
Sent: Sunday, June 25, 2006 7:34 AM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] FileReference and actionscript 2.0

Hi dear Hank
I think after a successfull upload and inserting in db, I can set the
record ID (or any thing else) in User Session in server and after
successful upload( returning true to flash ) call a simple remoting
method that invoke id from session and return it to flash. 
 
After all I think I don't undrestand some of key features of AS 2.0 ::
 
listener.onCancel = function(file:FileReference):Void {
trace(onCancel);
}
listener.onOpen = function(file:FileReference):Void {
trace(onOpen:  + file.name);
}
listener.onProgress = function(file:FileReference, bytesLoaded:Number,
bytesTotal:Number):Void {
trace(onProgress with bytesLoaded:  + bytesLoaded +  bytesTotal:
 + bytesTotal);
}

I don't know where can I put event methods like this in my AS 2.0 class.
What did I misundrestand??
All the samples are in AS1 and I don't know what to do for my events :(


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] FileReference and actionscript 2.0

2006-06-26 Thread David Rorex

one way of doing it:

class MyClass {

var file:FileReference;

function doit() {
  file = new FileReference();
  file.addListener(this);
  file.browse();
}

function onCancel() {
 trace(user canceled);
}

function onBlah() 

}

hope this helps,
-David R

On 6/25/06, human ghaderyan [EMAIL PROTECTED] wrote:

Hi dear Hank
I think after a successfull upload and inserting in db, I can set the record ID 
(or any thing else) in User Session in server and after successful upload( 
returning true to flash ) call a simple remoting method that invoke id from 
session and return it to flash.

After all I think I don't undrestand some of key features of AS 2.0 ::

listener.onCancel = function(file:FileReference):Void {
trace(onCancel);
}
listener.onOpen = function(file:FileReference):Void {
trace(onOpen:  + file.name);
}
listener.onProgress = function(file:FileReference, bytesLoaded:Number, 
bytesTotal:Number):Void {
trace(onProgress with bytesLoaded:  + bytesLoaded +  bytesTotal:  + 
bytesTotal);
}

I don't know where can I put event methods like this in my AS 2.0 class. What 
did I misundrestand??
All the samples are in AS1 and I don't know what to do for my events :(

- Original Message 
From: hank williams [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Sunday, June 25, 2006 5:20:43 PM
Subject: Re: [Flashcoders] FileReference and actionscript 2.0


I am curious what those tricks are.

What I do is to ask the server for an upload code number before I upload
This upload code is associated with the given user and whatever the user is
trying to do. This is application specific. This creates a record in the
database, so that when the file is uploaded the server knows what it is.
Then I send the parameter as part of the upload URL. Additionally, I make
the upload codes time out. So if a code isnt used within a few minutes it is
no longer usable.

Regards
Hank

On 6/25/06, human ghaderyan [EMAIL PROTECTED] wrote:

 Thanx david. I think I can do some tricks to return value after completion
 of download.

 - Original Message 
 From: David Rorex [EMAIL PROTECTED]
 To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
 Sent: Sunday, June 25, 2006 9:21:58 AM
 Subject: Re: [Flashcoders] FileReference and actionscript 2.0


 On 6/23/06, human ghaderyan [EMAIL PROTECTED] wrote:
 
  Hi list
  I try to use FileReference class in a actionscript 2.0 project. the
  browse and upload methods work fine but it seems that this class
 designed
  for AS 1.0 (???). I can't find any AS 2.0 sample and don't know what to
 do
  for catching events . I think this class has bad architecture. for
 example I
  need to put the uploaded file in database and return its ID to client.

 The class works fine in AS2, you catch the events pretty much the exact
 same
 was as other built in classes (like MovieClip, XML, etc)


 FileReference do the transfer by a POST but it seems that there is no way
 to
  catch a response from server for this POST Action.

 Correct, as far as I know, they did not give a way to recieve any data
 returned from the server. All you can know is that the action completed.



 any body has some experience to do the uplad with flash remoting?
 
 You can't upload files from the user's local drive using flash remoting.

 -David R

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] FileReference and actionscript 2.0

2006-06-25 Thread human ghaderyan
Thanx david. I think I can do some tricks to return value after completion of 
download.  

- Original Message 
From: David Rorex [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Sunday, June 25, 2006 9:21:58 AM
Subject: Re: [Flashcoders] FileReference and actionscript 2.0


On 6/23/06, human ghaderyan [EMAIL PROTECTED] wrote:

 Hi list
 I try to use FileReference class in a actionscript 2.0 project. the
 browse and upload methods work fine but it seems that this class designed
 for AS 1.0 (???). I can't find any AS 2.0 sample and don't know what to do
 for catching events . I think this class has bad architecture. for example I
 need to put the uploaded file in database and return its ID to client.

The class works fine in AS2, you catch the events pretty much the exact same
was as other built in classes (like MovieClip, XML, etc)


FileReference do the transfer by a POST but it seems that there is no way to
 catch a response from server for this POST Action.

Correct, as far as I know, they did not give a way to recieve any data
returned from the server. All you can know is that the action completed.



any body has some experience to do the uplad with flash remoting?

You can't upload files from the user's local drive using flash remoting.

-David R
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] FileReference and actionscript 2.0

2006-06-25 Thread hank williams

I am curious what those tricks are.

What I do is to ask the server for an upload code number before I upload
This upload code is associated with the given user and whatever the user is
trying to do. This is application specific. This creates a record in the
database, so that when the file is uploaded the server knows what it is.
Then I send the parameter as part of the upload URL. Additionally, I make
the upload codes time out. So if a code isnt used within a few minutes it is
no longer usable.

Regards
Hank

On 6/25/06, human ghaderyan [EMAIL PROTECTED] wrote:


Thanx david. I think I can do some tricks to return value after completion
of download.

- Original Message 
From: David Rorex [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Sunday, June 25, 2006 9:21:58 AM
Subject: Re: [Flashcoders] FileReference and actionscript 2.0


On 6/23/06, human ghaderyan [EMAIL PROTECTED] wrote:

 Hi list
 I try to use FileReference class in a actionscript 2.0 project. the
 browse and upload methods work fine but it seems that this class
designed
 for AS 1.0 (???). I can't find any AS 2.0 sample and don't know what to
do
 for catching events . I think this class has bad architecture. for
example I
 need to put the uploaded file in database and return its ID to client.

The class works fine in AS2, you catch the events pretty much the exact
same
was as other built in classes (like MovieClip, XML, etc)


FileReference do the transfer by a POST but it seems that there is no way
to
 catch a response from server for this POST Action.

Correct, as far as I know, they did not give a way to recieve any data
returned from the server. All you can know is that the action completed.



any body has some experience to do the uplad with flash remoting?

You can't upload files from the user's local drive using flash remoting.

-David R
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] FileReference and actionscript 2.0

2006-06-25 Thread human ghaderyan
Hi dear Hank
I think after a successfull upload and inserting in db, I can set the record ID 
(or any thing else) in User Session in server and after successful upload( 
returning true to flash ) call a simple remoting method that invoke id from 
session and return it to flash. 
 
After all I think I don't undrestand some of key features of AS 2.0 ::
 
listener.onCancel = function(file:FileReference):Void {
trace(onCancel);
}
listener.onOpen = function(file:FileReference):Void {
trace(onOpen:  + file.name);
}
listener.onProgress = function(file:FileReference, bytesLoaded:Number, 
bytesTotal:Number):Void {
trace(onProgress with bytesLoaded:  + bytesLoaded +  bytesTotal:  + 
bytesTotal);
}

I don't know where can I put event methods like this in my AS 2.0 class. What 
did I misundrestand??
All the samples are in AS1 and I don't know what to do for my events :(

- Original Message 
From: hank williams [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Sunday, June 25, 2006 5:20:43 PM
Subject: Re: [Flashcoders] FileReference and actionscript 2.0


I am curious what those tricks are.

What I do is to ask the server for an upload code number before I upload
This upload code is associated with the given user and whatever the user is
trying to do. This is application specific. This creates a record in the
database, so that when the file is uploaded the server knows what it is.
Then I send the parameter as part of the upload URL. Additionally, I make
the upload codes time out. So if a code isnt used within a few minutes it is
no longer usable.

Regards
Hank

On 6/25/06, human ghaderyan [EMAIL PROTECTED] wrote:

 Thanx david. I think I can do some tricks to return value after completion
 of download.

 - Original Message 
 From: David Rorex [EMAIL PROTECTED]
 To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
 Sent: Sunday, June 25, 2006 9:21:58 AM
 Subject: Re: [Flashcoders] FileReference and actionscript 2.0


 On 6/23/06, human ghaderyan [EMAIL PROTECTED] wrote:
 
  Hi list
  I try to use FileReference class in a actionscript 2.0 project. the
  browse and upload methods work fine but it seems that this class
 designed
  for AS 1.0 (???). I can't find any AS 2.0 sample and don't know what to
 do
  for catching events . I think this class has bad architecture. for
 example I
  need to put the uploaded file in database and return its ID to client.

 The class works fine in AS2, you catch the events pretty much the exact
 same
 was as other built in classes (like MovieClip, XML, etc)


 FileReference do the transfer by a POST but it seems that there is no way
 to
  catch a response from server for this POST Action.

 Correct, as far as I know, they did not give a way to recieve any data
 returned from the server. All you can know is that the action completed.



 any body has some experience to do the uplad with flash remoting?
 
 You can't upload files from the user's local drive using flash remoting.

 -David R
 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com
 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com