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
Watching:

Making an item draggable


From:

Creating Drag-and-Drop Functionality with Edge Animate

with Paul Trani

Video: Making an item draggable

Once you've added your own script library, you want to take advantage of it, just like I've done over here. I'm adding the jQuery UI JavaScript file, that whole JavaScript library. In fact, right over here, under Stage, if I click on this little icon right here, I can open up the actions for the stage. And this is where I just did a quick check to make sure it's available before I start using it. That has an alert that I'm just going to remove. Because now I want to take advantage of this library specifically for these eyes. I want to make the eyes draggable.
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

Making an item draggable

Once you've added your own script library, you want to take advantage of it, just like I've done over here. I'm adding the jQuery UI JavaScript file, that whole JavaScript library. In fact, right over here, under Stage, if I click on this little icon right here, I can open up the actions for the stage. And this is where I just did a quick check to make sure it's available before I start using it. That has an alert that I'm just going to remove. Because now I want to take advantage of this library specifically for these eyes. I want to make the eyes draggable.

So I want to reference the jQuery UI documentation when doing that. So I'm going to launch a browser. And on jqueryui.com notice right over here my interactions, draggable, droppable, all sorts of things we can do. In fact I'm going to select draggable. And you can see how you can drag around this box. And there's other capabilities such as constraining the movement, all sorts of different things you can do. So I encourage you to explore the API documentation, which is exactly what I'm doing.

In fact, as I scroll down, you can see all the various options, the methods. But you'll see quite simply, its just adding a .dragable. So going back into Edge Animate. Selecting my eyes, and again right down here this is just an easy way to open up the actions. This is the actions I have for mouse over. Now I don't want to play that animation, so I'm going to eliminate that part but what I am going to do is I'm going to type in sym. That's going to target that symbol. Dollar sign since it's jQuery and then the name of the symbol.

In this case it's going to be eyes. And then .draggable. Open close parenthesis, end with a semi colon to complete this one line. And with that done, I will save this page and preview it in a browser. For the eyes, as I click on the eyes you can see how I can move them around. Easy enough, I could do the same thing for the mouth as I roll over that mouth that has functionality involved with it. So how would I take advantage of dragable there? Well it's pretty much the same deal.

In fact, I can go back into the eyes and it's going to be this same line. So I'm going to select it, Cmd+C to copy or Ctl+C if you're on a PC. Going to my mouth right here. Selecting the Open Actions button there. And rather than playing those two timelines I'm just going to paste in that line that I copied and change this to mouth. Easy enough. Doing a Cmd+Enter, Ctl+Enter, if you're on a PC. I can now drag around the mouth as well as the eyes. But there's additional functionality available as well, in fact, as I go back into jqueryui.com/draggable, right down in here you can start to see the different things you can do.

In fact, I want to actually change the opacity. So as I click on it I want to give an indication that I'm dragging it around. As well as I want to revert back to its original position. So I'll select opacity. And you can see it's this simple. It'll make it 35%. So I'll copy that line. As I'll scroll down you can see the revert. I'm going to take advantage of that as well. But let's start with opacity. By selecting my eyes. Opening up the Actions for it.

Right in those parentheses. Pasting that in. Opacity, 35%. And then I want to do a comma and this is where I'll add my revert. If we go back to our browser, we'll take a couple different parameters. You'll have basically true, invalid, valid or true. And I want to do invalid. If it's not dropped on a droppable item, then put it back in its place. Revert invalid. That's what I'm going to go with. Right in here. And in quotes. Invalid.

So, it'll change opacity and should, as I run this again, it should actually go back to its original position. So there's my opacity change, as I release, it goes back into it's original position. That's excellent in fact, I'm going to do this once more. Specifically for the mouth. Taking those same, parameters, right in here, copying them. For my mouth, pasting them in and now as I save this and I run it.

I now have two elements that I can drag. Around and as I release they go back into their original location. So I encourage you to try that out for yourself as well as explore the additional functionality options, methods, and events that are available thanks to the JQuery UI draggable capabilities.

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

Upgrade to View Courses Offline

login

With our new Desktop App, Annual Premium Members can download courses for Internet-free viewing.

Upgrade Now

After upgrading, download Desktop App Here.

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:

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.

Start your FREE 10-day trial

Begin learning software, business, and creative skills—anytime,
anywhere—with video instruction from recognized industry experts.
lynda.com provides
Unlimited access to over 4,000 courses—more than 100,000 video tutorials
Expert-led instruction
On-the-go learning. Watch from your computer, tablet, or mobile device. Switch back and forth as you choose.
Start Your FREE Trial Now
 

A trusted source for knowledge.

 

We provide training to more than 4 million people, and our members tell us that lynda.com helps them stay ahead of software updates, pick up brand-new skills, switch careers, land promotions, and explore new hobbies. What can we help you do?

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.