{lang: 'de'}
Flashhilfe.de - Flash Community

#1046 NativeDragEvent handler [Flash 10]

 


AntwortenRegistrieren Seite1  

simnzllr#1
Benutzerbild von simnzllr
Beiträge: 4
Registriert: Nov 2010

01.11.2011, 14:20

Hallo zusammen,

ich verzweifel langsam. Ich bekomm einfach nicht die Fehlerquelle behoben.
Mein Sourcecode .as

ActionScript:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.myavatareditor.air.fileio {
     
     import com.myavatareditor.data.IHasAvatar;
     import flash.display.InteractiveObject;
     import flash.desktop.NativeDragActions;
     import flash.desktop.NativeDragOptions;
     import flash.desktop.NativeDragManager;
     import flash.desktop.DragManager;
     import flash.desktop.Clipboard;
     import flash.desktop.ClipboardFormats;
     import flash.desktop.NativeApplication;
     import flash.events.NativeDragEvent;
     import flash.filesystem.File;
     
     /**
      * Manages the saving of Avatar data from a an Avatar
      * client to the users hard drive.  This data
      * can be in the form of a binary Avatar file, an XML
      * file, or a bitmap image file.
      */

     public class FileDragDrop {
     
        private var target:IHasAvatar;
           
        public function FileDragDrop(target:IHasAvatar){
           this.target = target;
           target.addEventListener(NativeDragEvent.NATIVE_DRAG_ENTER, dragEnterHandler, false, 0, true);
           target.addEventListener(NativeDragEvent.NATIVE_DRAG_DROP, dragDropHandler, false, 0, true);
        }
        
        protected function dragEnterHandler(event:NativeDragEvent):void {
           if (event.clipboard.hasFormat(ClipboardFormats.FILE_LIST_FORMAT)){
              NativeDragManager.acceptDragDrop(InteractiveObject(event.currentTarget));
           }
        }
        
        protected function dragDropHandler(event:NativeDragEvent):void {
           NativeDragManager.dropAction = NativeDragActions.COPY;
           var files:Array = event.clipboard.getData(ClipboardFormats.FILE_LIST_FORMAT) as Array;
           if (files && files.length){
              var path:String = File(files[0]).url;
              target.fileManager.loadURL(path);
              NativeApplication.nativeApplication.activate();
           }
        }      
     }
}


Ich bekomme beim kompilieren folgende Fehlermeldung:

C:UsersSimonDesktopnonosrccommyavatareditorairfileioFileDragDrop.as, Line 58   1046: Type was not found or was not a compile-time constant: NativeDragEvent.
C:UsersSimonDesktopnonosrccommyavatareditorairfileioFileDragDrop.as, Line 52   1046: Type was not found or was not a compile-time constant: NativeDragEvent.

- Die lib wird doch richtig importiert oder ?

Gruß
Schlagwörter: Drag, event, nativedrag drag
ashitaka#2
Benutzerbild von ashitaka
Beiträge: 161
Registriert: Apr 2010

03.11.2011, 15:38