Hi, after reading this link (http://blogs.adobe.com/flexdoc/2007/10/conditional_compilation_in_mox_1.html) about conditional compilation I decided to see if I could get it to work for my Air / web switch.
looks like it does work but one major drawback is that you can't debug. According to a comment on the link this will be fixed before release though. here's the code: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initDragAndDrop()"> <mx:Script> <![CDATA[ CONFIG::web { trace("web"); private function initDragAndDrop():void{} } CONFIG::air { trace("air"); import flash.desktop.DragActions; import flash.desktop.ClipboardFormats import flash.events.NativeDragEvent; private function initDragAndDrop():void{ this.addEventListener(NativeDragEvent.NATIVE_DRAG_ENTER,onDragIn); this.addEventListener(NativeDragEvent.NATIVE_DRAG_DROP,onDrop); } public function onDragIn(event:NativeDragEvent):void{ flash.desktop.DragManager.acceptDragDrop(this); } public function onDrop(event:NativeDragEvent):void{ flash.desktop.DragManager.dropAction = DragActions.COPY; trace("onDrop"); var dropFiles:Array = event.clipboard.dataForFormat(ClipboardFormats.FILE_LIST_FORMAT) as Array; var path = ""; if(Capabilities.os.search("Mac") >= 0) path = "file://" + dropFiles[0].nativePath; image.source = path; } } ]]> </mx:Script> <mx:Image id="image" width="100" height="100" horizontalCenter="0" verticalCenter="0"/> <mx:Button horizontalCenter="0" y="5" label="Button" width="100" height="20"/> </mx:Application> Use these additional compiler arguments: -define=CONFIG::web,true -define=CONFIG::air,false Also make sure you have a AIR project. For the web version create a new run configuration, and type in the project name (it doesn't appear in the combobox). So now if you run your application you'l be asked to run as either Flex or Air. By changing the compiler arguments you can switch between the two. Dennis