Creating Drag-and-Drop Functionality with Edge Animate
Illustration by John Hersey

Moving items to their original position


From:

Creating Drag-and-Drop Functionality with Edge Animate

with Paul Trani

Start your free trial now, and begin learning software, business and creative skills—anytime, anywhere—with video instruction from recognized industry experts.

Start Your Free Trial Now

Video: Moving items to their original position

As you add your Drag and Drop functionality, you want to make sure that you're testing it often. Quite frankly when I drop the eyes on the body and then I try to put them back, it actually snaps back to the body. Okay? So basically what I need to do is when I drop the eyes back over in this area, I need them to snap back in place rather than snapping back to the body. So, through this testing, I realize what I need to do and luckily the functionality is largely what I've already created.
please wait ...
Watch the Online Video Course Creating Drag-and-Drop Functionality with Edge Animate
1h 14m Beginner Jul 01, 2014

Viewers: in countries Watching now:

Drag-and-drop functionality is perfect for any game or interactive web project. Edge Animate makes it easy to implement. Plus, the drag-and-drop interactions you add work even on smartphones and tablets. Learn how to create draggable objects, add target areas where users can drop them, create reactions to those drops, and change content and object positioning accordingly. Author Paul Trani walks you through each step of the process in this project-based course.

Topics include:
  • Creating graphics and importing them into Edge Animate
  • Adding animation and interactivity
  • Making items draggable
  • Adding a droppable target area
  • Controlling multiple objects
  • Resetting positions of objects
  • Testing and publishing your project
Subject:
Web
Software:
Edge Animate
Author:
Paul Trani

Moving items to their original position

As you add your Drag and Drop functionality, you want to make sure that you're testing it often. Quite frankly when I drop the eyes on the body and then I try to put them back, it actually snaps back to the body. Okay? So basically what I need to do is when I drop the eyes back over in this area, I need them to snap back in place rather than snapping back to the body. So, through this testing, I realize what I need to do and luckily the functionality is largely what I've already created.

So, with the eyes selected. Right down here I'm going to open up the actions for the eyes. And notice right in here, this is what I want to add to. Notice how I have monster body droppable. Well, this is the functionality I want to duplicate. So I can take this, I can Copy it. And Paste it below, basically duplicating it. And what I want to do, is I want to snap it back to the original positions. So I'll just say, origPos, original position. But I don't have an element to created that's called original position yet.

So, what I would do is create it right now. So jumping in here using the Rectangle tool, just drawing out a big rectangle. Now obviously, this doesn't look very good. I'll change the opacity of that rectangle, basically making it invisible. And lastly, you gotta make sure that not only is it called origPose, just like that, but I need to make sure it's beneath everything else. So beneath the eyes.

And the body, all that good stuff, so moving it down. Now it's on the right layer or at the right depth. And it's called the correct thing. I can go back into my code for this specific mouse over for the eyes. Orig position looks great. It's going to accept the eyes. And on Drop I can have it play, but really what I want to happen is I need it to snap back to the original position. So I'm going to say sym for that symbol dollar sign and the item name which is going to be eyes.

So for the eyes I want to animate back into play. So .animate this happens to be a jQuery function and within these parenthesis this is where I want to add some parameters. Okay I am going to add some curly braces. And right in here. This is where I want to add say for instance left, so move it to the left, oh I don't know 30 pixels. Just look under X this is basically the left, and as I roll over that X you can see how it says left right there. So animate it back to left 30 pixels.

Comma and this is CSS. For CSS it's top. We're defining the value of top as being one 130 pixels. PX just like that and lastly outside of these curly braces I'm going to add a comma. And then I can accept or use a different parameter which is going to be slow, medium, fast. I'm going to type in slow just so we can see it smoothly glide across and that looks good to me.

So I'm Saving this. I'm going to preview it in the browser. So initially it will snap back, that looks fine. Drop it onto the eyes. That looks good. Now, remember when we dragged it over here, it would always snap back here. But let's see what happens. It moves back into its original position. So that looks great. We want to make sure this is working for both of our elements, so selecting the eyes again. Copying this functionality for the Droppable, for the original position and keep in mind the changes you need to make are that you need to adjust not only the name of the symbol to mouth.

Like I'm doing now. But, also, the final position. So, with the mouse selected, you could say, it's at 0 and 242. I'm going to change that to 0. 242. Running. Eyes work great. Mouth. Bring it over here, snaps back into position as well. All using Dragable and Dropable on multiple elements.

There are currently no FAQs about Creating Drag-and-Drop Functionality with Edge Animate.

 
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now Already a member? Log in

* Estimated file size

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Creating Drag-and-Drop Functionality with Edge Animate.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member ?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferences from the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Learn more, save more. Upgrade today!

Get our Annual Premium Membership at our best savings yet.

Upgrade to our Annual Premium Membership today and get even more value from your lynda.com subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.