/*****************************
import Classes
*****************************/
import fl.video.FLVPlayback;
//Drag and Drop Manager
import flash.desktop.DragManager;
import flash.desktop.ClipboardFormats;
//Event that Handles the Drag and Drop Events
import flash.events.NativeDragEvent;
/*****************************
Create an active Hit Spot
*****************************/
var shape:Shape = new Shape();
shape.graphics.beginFill(0x000000, 1);
shape.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);
shape.graphics.endFill();
var _mc:MovieClip = new MovieClip();
_mc.addChild(shape);
addChild(_mc);
var video_vd:FLVPlayback = new FLVPlayback();
addChild(video_vd);
video_vd.x = 0;
video_vd.y = 0;
video_vd.width = 320;
video_vd.height = 240;
/*****************************
Drag and Drop
*****************************/
this.addEventListener(NativeDragEvent.NATIVE_DRAG_ENTER, onDragEnter);
function onDragEnter(e:NativeDragEvent):void {
//NativeDragEvent has a clipboard property where our data is stored. That clipboard class has a getData method
//The way to specifiy formats is the a constant of a ClipboardFormats class. We just want a file object
//The reason it is a filelist is because if multiple files were dragged into the Flash, all of them could be retreived
var fa:Object = e.clipboard.getData(ClipboardFormats.FILE_LIST_FORMAT);
//Check the File Extension of the Object
if (fa[0].extension == "flv") {
//Accept the Drag n Drop operation
DragManager.acceptDragDrop(this);
}
}
this.addEventListener(NativeDragEvent.NATIVE_DRAG_DROP, onDragDrop);
function onDragDrop(e:NativeDragEvent):void {
var fa:Object = e.clipboard.getData(ClipboardFormats.FILE_LIST_FORMAT);
video_vd.play(fa[0].url);
}