header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
Shridhar Kulkarni
Points:0
Posts:0

10/10/2011 4:37:21 AM

Title: Air Native drag-drop not working with child container canvas.


Hello Everybody,
Currently I am working with native drag-drop with air application. In this application their is a canvas container, and I am dragging images from desktop to this canvas container and this canvas container is a child of application.
Here all the code of drag drop is working, when I wrote it in main application file. but when I wrote it with canvas, the drag drop is not working

I am having following code for drag drop
<mx:Canvas xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" width="100%" height="100%" initialize="initHandler()">
<fx:Script>
<![CDATA[
import mx.managers.DragManager;
import flash.events.NativeDragEvent;
import flash.desktop.NativeDragManager;
import flash.desktop.Clipboard;
import flash.desktop.ClipboardFormats;

private function initHandler():void
{
this.addEventListener(NativeDragEvent.NATIVE_DRAG_ENTER,onDragInHandler);
this.addEventListener(NativeDragEvent.NATIVE_DRAG_DROP,onDropHandler);
// this.addEventListener(NativeDragEvent.NATIVE_DRAG_EXIT,onDragExitHandler);

}

private function onDragInHandler(nativeDragEvent:NativeDragEvent):void
{
DragManager.acceptDragDrop(this);

}

private function onDropHandler(nativeDragEvent:NativeDragEvent):void
{
var dropfiles:Array=nativeDragEvent.clipboard.getData(ClipboardFormats.FILE_LIST_FORMAT) as Array;
for each (var file:File in dropfiles)
{
switch (file.extension)
{
case "png" :
addImage(file.nativePath);
break;
case "jpg" :
addImage(file.nativePath);
break;
case "gif" :
addImage(file.nativePath);
break;
default:
Alert.show("default error");
}
}

}


private function addImage(value:String):void
{
Alert.show("image drag sucessfully');
}




Please tell me what I am missing for canvas. Its working with main container not with child container canvas



1
Shridhar Kulkarni
Points: 0
Posts:0
10/12/2011 11:28:55 PM



The bug has solved. just set some background property for that canvas


Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 6+3 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions