PDA

View Full Version : Drag & drop problem


Feldin
06-14-2008, 06:59 PM
Hello there!

I wanted to make a simple mp3 player and i got to the problem with making a playlist...

I want to have a datagrid on stage and when i would drag an .mp3 file to the datagrid it would add it as a new item.Here is the AS i wrote... and i dont get errors everything is working fine but this line:
playlist.addEventListener(NativeDragEvent.NATIVE_D RAG_DROP, dodaj_musko);

It also works if i use NATIVE_DRAG_ENTER or NATIVE_DRAG_OVER but not the way i want.

And here is the rest of AS(here is the flv file (http://www.planinsko-drustvo-zirovnica.si/janez/mp3%20player.fla)):
import flash.desktop.*;
import flash.events.*;

playlist.addEventListener(NativeDragEvent.NATIVE_D RAG_DROP, dodaj_musko);

playlist.addColumn("St");
playlist.addColumn("Muska");
playlist.addColumn("Dolzina");

playlist.columns[0].width = 40;
playlist.columns[1].width = 400;
playlist.columns[2].width = 60;

var zap_st:Number = new Number(0);

function dodaj_musko(e:NativeDragEvent) {
var fa:Object = e.clipboard.getData(ClipboardFormats.FILE_LIST_FOR MAT);
var i:Number;
for (i = new Number(0); i<fa.length; i++) {
zap_st++;
playlist.addItem({St: zap_st,Muska: fa[i].url});
}
}

I was looking to solve the problem all day but didnīt find anything useful so i would appreciate any help.

Ty all for help :)

Feldin
06-19-2008, 01:37 PM
ok i figured it out so its working now...