[Plugin] Drag'n'Drop zone

Post your completed addons to share with the community

Post » Wed Oct 10, 2012 5:11 pm

HEre's a plugin that leverage the possibility for browser to handle the drag'n'drop of a file from outside the browser, inside the page.


With that plugin, you can drag Images in your game, and get back a base64 string, that you can load in any Sprite. Therefore, your user can customize an avatar with dragging one of his image inside the game, for example !
All the image format currently supported by the browser are supported by the plugin. (Don't forget to catch the "On Image Loaded" event, the image can be laoded by the browser some time after the end of the "On drop" event).

You can also load some text file, and handle the result as a classic text string. File format are plain txt,html/htm,xml, and SVG (viewed as an XML, not an image, here !)

If you set the zone as "invisible", you can't drag any new file until you set the zone "visible" back again.

In the example .capx, I also show how to handle wrong a filetype dragged over a drag'n'drop zone (for example an image on a text drag'n'drop zone).

At the edit time, you need to set if you want your zone to access image files, or text files. In the future, I'll add support for more varied file type.

You can also specify a CSS string for the styling.

The demo : https://dl.dropbox.com/u/1412774/DragNDropZoneDemo/index.html
The plugin : https://dl.dropbox.com/u/1412774/DragNDropZoneDemo/pode_dragndrop_zone.1.0.zip
The .capx : https://dl.dropbox.com/u/1412774/DragNDropZoneDemo/DragNDropZoneDemo.capx
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Post » Wed Oct 10, 2012 7:40 pm

Great Pode!!!

Keeping the good work.
B
90
S
5
G
8
Posts: 165
Reputation: 7,648

Post » Wed Oct 10, 2012 10:48 pm

Amazing.
B
19
S
5
G
4
Posts: 208
Reputation: 3,960

Post » Sun Oct 14, 2012 12:30 am

Been waiting for this plugin...great work Pode.
B
19
S
6
G
7
Posts: 1,205
Reputation: 7,298

Post » Sat Dec 22, 2012 8:31 pm

Exactly what I was looking for thanks @pode
B
10
S
3
G
2
Posts: 23
Reputation: 2,177

Post » Mon Jan 21, 2013 1:28 am

@Pode

I am using this plugin in my app.
I got it to load and replace a sprite image.
However, i need to load each image only for a selected instance of a sprite.

To explain:
In my app i have multiple instances of the same sprite.
All have their own name.
I select a sprite instance "by its name".
Load the image via the drag & drop zone into the sprite.
But what happens is "all" the instances of that sprite are getting the image that was dropped into the zone.

(My goal is to give all sprite instances their own loaded image.)

Now the question here is, does this have to do with the: Load image from URI.
Which means the load image from URI event isnt programmed to load "per instance"
Or does it have to do with something in the plugin?

Here is a Capx
This one is a modified version of your own demo.
It shows that when loading a sprite into a specific instance.
The other instances become black and are unloaded.
"Which is not correct either"

In contrediction to the above capx, my own app loads the same image for all sprite instances. (as in image clones)
Now the only difference between the modified demo capx and my own.
Is that with the modified one the instances are chosen by number.
While in my app the instances are compared by name "stored as a variable".

Can u shed some light on this matter?
Thanx for any help!

Kind Regards.
Savvy001Savvy0012013-01-21 01:51:40
B
56
S
20
G
13
Posts: 778
Reputation: 13,204

Post » Mon Jan 21, 2013 11:03 am

I need to add the ability to change only one instance, or all of them...

For your second problem, I'm on a mac here at work so I can't open .capx file, so I don't really understand your problem. I'll try to check that at home...
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Post » Mon Jan 21, 2013 11:17 am

@Pode

[QUOTE=Pode] I need to add the ability to change only one instance, or all of them...
[/QUOTE]

It would be great if u can add that ability to this plugin
And i presume that would solve both the issues i mentioned.

Kind Regards.
Savvy001Savvy0012013-01-21 11:18:35
B
56
S
20
G
13
Posts: 778
Reputation: 13,204

Post » Sun Jan 27, 2013 2:25 pm

@Pode

If its possible, then it would also be a great feature to be able to set the frame number to where the instance image is set.
Then the users of my app can insert images for separate frames of the sprite instance.
As in.
Sprite instance 3 is selected & animation frame 2 is selected.
Dropping image in drag&drop zone.
Result.
Image is set as frame 2 of sprite instance 3.

Hope my explanation is understandable ;-)
Is this a do-able feature?

Kind regards.
Savvy001
B
56
S
20
G
13
Posts: 778
Reputation: 13,204

Post » Sun Jan 27, 2013 3:57 pm

@Savvy001 : in fact, it's not a feature of the Drag'n'Drop plugin, it's a feature of the Sprite itself. Since it's in the "Sprite" that we say "load Image from URL", if @Ashley hasn't set a way to give a specific frame number, we don't have that possibility.
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Next

Return to Completed Addons

Who is online

Users browsing this forum: vurzu, X3M and 0 guests