Graphics Reference
In-Depth Information
Dragging a file from the desktop to the
scene
When you create visualizations, it is a nice feature to let your users provide their own
resources. For instance, you might want to let the user specify their own textures or
models. You can implement this with a traditional upload form, but with HTML5, you
also have the option to let the user drag and drop a resource directly from the desktop.
In this recipe, we'll explain how to provide this drag and drop functionality to your
users.
Getting ready
The easiest way to prepare for this recipe is by first looking at the example we created
for you. Open an example 01.14-drag-file-to-scene.html in your browser.
Note
Please note that this only works when running your own web server, or with se-
curity exceptions disabled.
When you drag and drop an image file onto the drop area (the dashed square), you'll
immediately see that the texture of the rotating box is changed and the image that you
provide is used.
In the following section, we'll explain how you can create this functionality.
Search WWH ::




Custom Search