googleAdsense_widever


Air :: Native drag and drop picture Adobe Air




<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
creationComplete="initProcess(event)"
>
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.FlexEvent;
import spark.components.Image;

protected function initProcess(event:FlexEvent):void
{
// TODO Auto-generated method stub
this.addEventListener(NativeDragEvent.NATIVE_DRAG_ENTER, onDragEnter);
this.addEventListener(NativeDragEvent.NATIVE_DRAG_DROP, onDragDrop);
}

private function onDragEnter(event:NativeDragEvent):void{
NativeDragManager.acceptDragDrop(this);
}

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

private function addImage(nativePath:String):void{
var img:Image = new Image();
img.smooth = true;
if(Capabilities.os.search("Mac") >= 0){
img.source = "file://" + nativePath;
}else{
img.source = nativePath;
}
//this.addChild(img);
//this.addElement(this);
group_pic.addElement(img);
}

]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Scroller id="scroller_main" x="0" y="0" width="100%" height="100%">
<s:Group id="group_pic" width="100%" height="100%">
</s:Group>
</s:Scroller>
</s:WindowedApplication>














덧글

댓글 입력 영역


공지

어서오십시오.
트위터 : @FCliver
기저심리학 : 네이버카페
카카오톡 : FCliver
페이스북 : Fredric Cliver

통계 위젯 (화이트)

316
50
288488

접속자 위치