RE: [flexcoders] Drag-n-dropping images from Mac OS to AIR app

2009-01-08 Thread Jim Hayes
You might see if tempImg.url works (assuming it's failing with using 
tempImg.nativepath and not elsewhere).


-Original Message-
From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of Mac Martine
Sent: 08 January 2009 00:27
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Drag-n-dropping images from Mac OS to AIR app

Try this:

if(Capabilities.os.search(Mac) = 0) img1.source = file:// + 
tempImg.nativePath; else img1.source = tempImg.nativePath;

On 1/7/09 1:26 PM, Jeff Hindman jake...@cox.net wrote:

AIR gurus,

The following code in my AIR app works fine on a PC, but not on a
Mac:

protected function handleDragEnter(event:NativeDragEvent):void {
if (event.clipboard.hasFormat
(ClipboardFormats.FILE_LIST_FORMAT)) {
NativeDragManager.acceptDragDrop(event.currentTarget as
InteractiveObject);}
}

protected function handleDrop(event:NativeDragEvent):void {
var temp:Object = event.clipboard.getData
(ClipboardFormats.FILE_LIST_FORMAT);
var tempImg:File = temp[0] as File;
if (tempImg.extension == jpg || tempImg.extension == JPG ||
tempImg.extension == gif || tempImg.extension == GIF ||
tempImg.extension == png || tempImg.extension == 'PNG') {
img1.source = tempImg.nativePath;
img1.maintainAspectRatio = true;
} else {
Alert.show(File is not an image., Oops!);
}

Any clues (or directionts to further research) would be greatly
appreciated.

Thanks!

--jake
}
 

__
This communication is from Primal Pictures Ltd., a company registered in 
England and Wales with registration No. 02622298 and registered office: 4th 
Floor, Tennyson House, 159-165 Great Portland Street, London, W1W 5PA, UK. VAT 
registration No. 648874577.

This e-mail is confidential and may be privileged. It may be read, copied and 
used only by the intended recipient. If you have received it in error, please 
contact the sender immediately by return e-mail or by telephoning +44(0)20 7637 
1010. Please then delete the e-mail and do not disclose its contents to any 
person.
This email has been scanned for Primal Pictures by the MessageLabs Email 
Security System.
__


Re: [flexcoders] Drag-n-dropping images from Mac OS to AIR app

2009-01-08 Thread Lushen Wu
Jeff,

File.nativePath is really funky on unix machines. I would try
img1.source = tempImg.url

of course, you didn't mention exactly what the breakdown was or what 
behavior did happen, but that might help..

Lushen


Jeff Hindman wrote:

 AIR gurus,

 The following code in my AIR app works fine on a PC, but not on a
 Mac:

 protected function handleDragEnter(event:NativeDragEvent):void {
 if (event.clipboard.hasFormat
 (ClipboardFormats.FILE_LIST_FORMAT)) {
 NativeDragManager.acceptDragDrop(event.currentTarget as
 InteractiveObject);}
 }

 protected function handleDrop(event:NativeDragEvent):void {
 var temp:Object = event.clipboard.getData
 (ClipboardFormats.FILE_LIST_FORMAT);
 var tempImg:File = temp[0] as File;
 if (tempImg.extension == jpg || tempImg.extension == JPG ||
 tempImg.extension == gif || tempImg.extension == GIF ||
 tempImg.extension == png || tempImg.extension == 'PNG') {
 img1.source = tempImg.nativePath;
 img1.maintainAspectRatio = true;
 } else {
 Alert.show(File is not an image., Oops!);
 }

 Any clues (or directionts to further research) would be greatly
 appreciated.

 Thanks!

 --jake
 }

  



Re: [flexcoders] Drag-n-dropping images from Mac OS to AIR app

2009-01-07 Thread Mac Martine
Try this:

   if(Capabilities.os.search(Mac) = 0)   
 img1.source = file:// + tempImg.nativePath;else  
  img1.source = tempImg.nativePath;




On 1/7/09 1:26 PM, Jeff Hindman jake...@cox.net wrote:




AIR gurus,

The following code in my AIR app works fine on a PC, but not on a
Mac:

protected function handleDragEnter(event:NativeDragEvent):void {
if (event.clipboard.hasFormat
(ClipboardFormats.FILE_LIST_FORMAT)) {
NativeDragManager.acceptDragDrop(event.currentTarget as
InteractiveObject);}
 }

protected function handleDrop(event:NativeDragEvent):void {
 var temp:Object = event.clipboard.getData
(ClipboardFormats.FILE_LIST_FORMAT);
 var tempImg:File = temp[0] as File;
 if (tempImg.extension == jpg || tempImg.extension == JPG ||
 tempImg.extension == gif || tempImg.extension == GIF ||
 tempImg.extension == png || tempImg.extension == 'PNG') {
 img1.source = tempImg.nativePath;
 img1.maintainAspectRatio = true;
 } else {
 Alert.show(File is not an image., Oops!);
 }

Any clues (or directionts to further research) would be greatly
appreciated.

Thanks!

--jake
}