Can you use a custom cursor with drag and drop?

Hi there! I'm a newbie flash user and working on a simulation for a graduate course in instructional design. I'm using Flash Professional CC on Mac. Here's what I'm trying to do. I have several draggable sprites on the stage and three target sprites. I have specified the original x,y locations of the sprites and have set the end x,y locations as those of each of the three targets. Items must be dragged to one of the three targets.
Some questions:
1. Can I specify more than one End x,y location for a draggable sprite? I'm creating a lesson to teach kindergartners how to sort lunchroom waste. If they have a napkin, for example, it could either go into the compost OR into the recycling. In cases like this where an item could really be placed into more than one bin, I want them to get it right if they do either of those things, rather than forcing them to choose which one.
2. To make my project more "fun" for kids, I wanted to customize the cursor with a graphic of  hand. When I tried this in the flash file it works perfectly until I add the drag and drop functionality for the wasted items. Then the cursor will more around  but not pick up any items. Once I revert back to the standard pointer, the correct drag and drop functionality is restored.
3. I have it set to snap back to the original location if learner attempts to drop the item on the wrong target. I want to be able to play a sound file when that happens, as well as play a sound file when it lands on the correct target, as well as shrink the item and change its opacity so that it appears invisible. I want to give the illusion of it being placed into the bin. I have no idea as to the proper way to code these events so that they happen.
4. I've watched dozens of hours of youtube tutorials before coming here. I'm a quick study, but am very new to action script. In one of the videos the developer showed referencing an external action script file which I don't think is an option in CC. The coding method he used seemed much more streamlined and "clean" than the chunks I'm working with now. Is there an easy way for me to code information about these objects  than the way I've got it here now? I hate starting new things with bad habits. The perils of self-teaching.
Thanks!
I'm pasting my code from the actions panel below so you can see what's going on:
stop();
/* Custom Mouse Cursor
Replaces the default mouse cursor with the specified symbol instance.
stage.addChild(customcursor);
customcursor.mouseEnabled = false;
customcursor.addEventListener(Event.ENTER_FRAME, fl_CustomMouseCursor);
function fl_CustomMouseCursor(event:Event)
  customcursor.x = stage.mouseX;
  customcursor.y = stage.mouseY;
Mouse.hide();
//To restore the default mouse pointer, uncomment the following lines:
customcursor.removeEventListener(Event.ENTER_FRAME, fl_CustomMouseCursor);
stage.removeChild(customcursor);
Mouse.show();
//set up variables and objects for dragging
var offset:int = 10;
var appleStartX:int = 243;
var appleStartY:int = 156;
var appleEndX:int = 522;
var appleEndY:int = 22;
apple.buttonMode = true;
apple.addEventListener(MouseEvent.MOUSE_DOWN, startDragging);
apple.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
var cupStartX:int = 39;
var cupStartY:int = 266;
var cupEndX:int = 520;
var cupEndY:int = 175;
cup.buttonMode = true;
cup.addEventListener(MouseEvent.MOUSE_DOWN, startDragging);
cup.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
var barStartX:int = 178;
var barStartY:int = 234;
var barEndX:int = 522;
var barEndY:int = 22;
bar.buttonMode = true;
bar.addEventListener(MouseEvent.MOUSE_DOWN, startDragging);
bar.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
var orangeStartX:int = 284;
var orangeStartY:int = 102;
var orangeEndX:int = 522;
var orangeEndY:int = 22;
orange.buttonMode = true;
orange.addEventListener(MouseEvent.MOUSE_DOWN, startDragging);
orange.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
var bottleStartX:int = 172;
var bottleStartY:int = 303;
var bottleEndX:int = 520;
var bottleEndY:int = 175;
bottle.buttonMode = true;
bottle.addEventListener(MouseEvent.MOUSE_DOWN, startDragging);
bottle.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
var bananaStartX:int = 113;
var bananaStartY:int = 123;
var bananaEndX:int = 522;
var bananaEndY:int = 22;
banana.buttonMode = true;
banana.addEventListener(MouseEvent.MOUSE_DOWN, startDragging);
banana.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
var napkinStartX:int = 248;
var napkinStartY:int = 271;
var napkinEndX:int = 520;
var napkinEndY:int = 175;
napkin.buttonMode = true;
napkin.addEventListener(MouseEvent.MOUSE_DOWN, startDragging);
napkin.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
var yogurtStartX:int = 27;
var yogurtStartY:int = 136;
var yogurtEndX:int = 518;
var yogurtEndY:int = 329;
yogurt.buttonMode = true;
yogurt.addEventListener(MouseEvent.MOUSE_DOWN, startDragging);
yogurt.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
var strawberryStartX:int = 120;
var strawberryStartY:int = 285;
var strawberryEndX:int = 522;
var strawberryEndY:int = 22;
strawberry.buttonMode = true;
strawberry.addEventListener(MouseEvent.MOUSE_DOWN, startDragging);
strawberry.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
var sandwichStartX:int = 7;
var sandwichStartY:int = 364;
var sandwichEndX:int = 522;
var sandwichEndY:int = 22;
sandwich.buttonMode = true;
sandwich.addEventListener(MouseEvent.MOUSE_DOWN, startDragging);
sandwich.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
var juiceStartX:int = 88;
var juiceStartY:int = 347;
var juiceEndX:int = 518;
var juiceEndY:int = 329;
juice.buttonMode = true;
juice.addEventListener(MouseEvent.MOUSE_DOWN, startDragging);
juice.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
var foilStartX:int = 39;
var foilStartY:int = 416;
var foilEndX:int = 520;
var foilEndY:int = 175;
foil.buttonMode = true;
foil.addEventListener(MouseEvent.MOUSE_DOWN, startDragging);
foil.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
var waxbagStartX:int = 235;
var waxbagStartY:int = 342;
var waxbagEndX:int = 522;
var waxbagEndY:int = 22;
waxbag.buttonMode = true;
waxbag.addEventListener(MouseEvent.MOUSE_DOWN, startDragging);
waxbag.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
function startDragging (e:MouseEvent) {
  e.currentTarget.startDrag();
function stopDragging (e:MouseEvent) {
  e.currentTarget.stopDrag();
  switch (e.currentTarget) {
  case apple:
  if (apple.x < appleEndX - offset || apple.x > appleEndX + offset || apple.y < appleEndY - offset || apple.y > appleEndY + offset) {
  apple.x = appleStartX;
  apple.y = appleStartY;
  else {
  apple.x = appleEndX;
  apple.y = appleEndY;
  //checkGame();
  break;
  case sandwich:
if (sandwich.x < sandwichEndX - offset || sandwich.x > sandwichEndX + offset || sandwich.y < sandwichEndY - offset || sandwich.y > sandwichEndY + offset) {
  sandwich.x = sandwichStartX;
  sandwich.y = sandwichStartY;
  else {
  sandwich.x = sandwichEndX;
  sandwich.y = sandwichEndY;
  //checkGame();
  break;
  case orange:
if (orange.x < orangeEndX - offset || orange.x > orangeEndX + offset || orange.y < orangeEndY - offset || orange.y > orangeEndY + offset) {
  orange.x = orangeStartX;
  orange.y = orangeStartY;
  else {
  orange.x = orangeEndX;
  orange.y = orangeEndY;
  //checkGame();
  break;
  case strawberry:
if (strawberry.x < strawberryEndX - offset || strawberry.x > strawberryEndX + offset || strawberry.y < strawberryEndY - offset || strawberry.y > strawberryEndY + offset) {
  strawberry.x = strawberryStartX;
  strawberry.y = strawberryStartY;
  else {
  strawberry.x = strawberryEndX;
  strawberry.y = strawberryEndY;
  //checkGame();
  break;
  case napkin:
if (napkin.x < napkinEndX - offset || napkin.x > napkinEndX + offset || napkin.y < napkinEndY - offset || napkin.y > napkinEndY + offset) {
  napkin.x = napkinStartX;
  napkin.y = napkinStartY;
  else {
  napkin.x = napkinEndX;
  napkin.y = napkinEndY;
  //checkGame();
  break;
  case bar:
if (bar.x < barEndX - offset || bar.x > barEndX + offset || bar.y < barEndY - offset || bar.y > barEndY + offset) {
  bar.x = barStartX;
  bar.y = barStartY;
  else {
  bar.x = barEndX;
  bar.y = barEndY;
  //checkGame();
  break;
  case juice:
if (juice.x < juiceEndX - offset || juice.x > juiceEndX + offset || juice.y < juiceEndY - offset || juice.y > juiceEndY + offset) {
  juice.x = juiceStartX;
  juice.y = juiceStartY;
  else {
  juice.x = juiceEndX;
  juice.y = juiceEndY;
  //checkGame();
  break;
  case foil:
if (foil.x < foilEndX - offset || foil.x > foilEndX + offset || foil.y < foilEndY - offset || foil.y > foilEndY + offset) {
  foil.x = foilStartX;
  foil.y = foilStartY;
  else {
  foil.x = foilEndX;
  foil.y = foilEndY;
  //checkGame();
  break;
  case banana:
if (banana.x < bananaEndX - offset || banana.x > bananaEndX + offset || banana.y < bananaEndY - offset || banana.y > bananaEndY + offset) {
  banana.x = bananaStartX;
  banana.y = bananaStartY;
  else {
  banana.x = bananaEndX;
  banana.y = bananaEndY;
  //checkGame();
  break;
  case bottle:
if (bottle.x < bottleEndX - offset || bottle.x > bottleEndX + offset || bottle.y < bottleEndY - offset || bottle.y > bottleEndY + offset) {
  bottle.x = bottleStartX;
  bottle.y = bottleStartY;
  else {
  bottle.x = bottleEndX;
  bottle.y = bottleEndY;
  //checkGame();
  break;
  case waxbag:
if (waxbag.x < waxbagEndX - offset || waxbag.x > waxbagEndX + offset || waxbag.y < waxbagEndY - offset || waxbag.y > waxbagEndY + offset) {
  waxbag.x = waxbagStartX;
  waxbag.y = waxbagStartY;
  else {
  waxbag.x = waxbagEndX;
  waxbag.y = waxbagEndY;
  //checkGame();
  break;
  case cup:
if (cup.x < cupEndX - offset || cup.x > cupEndX + offset || cup.y < cupEndY - offset || cup.y > cupEndY + offset) {
  cup.x = cupStartX;
  cup.y = cupStartY;
  else {
  cup.x = cupEndX;
  cup.y = cupEndY;
  //checkGame();
  break;
  case yogurt:
if (yogurt.x < yogurtEndX - offset || yogurt.x > yogurtEndX + offset || yogurt.y < yogurtEndY - offset || yogurt.y > yogurtEndY + offset) {
  yogurt.x = yogurtStartX;
  yogurt.y = yogurtStartY;
  else {
  waxbag.x = waxbagEndX;
  waxbag.y = waxbagEndY;
  //checkGame();

Some questions:
1. Can I specify more than one End x,y location for a draggable sprite?
yes, use an if-else statement
I'm creating a lesson to teach kindergartners how to sort lunchroom waste. If they have a napkin, for example, it could either go into the compost OR into the recycling. In cases like this where an item could really be placed into more than one bin, I want them to get it right if they do either of those things, rather than forcing them to choose which one.
2. To make my project more "fun" for kids, I wanted to customize the cursor with a graphic of  hand. When I tried this in the flash file it works perfectly until I add the drag and drop functionality for the wasted items. Then the cursor will more around  but not pick up any items. Once I revert back to the standard pointer, the correct drag and drop functionality is restored.
assign your cursor's mouseEnabled property to false:
yourcursor.mouseEnabled=false;
3. I have it set to snap back to the original location if learner attempts to drop the item on the wrong target. I want to be able to play a sound file when that happens, as well as play a sound file when it lands on the correct target, as well as shrink the item and change its opacity so that it appears invisible. I want to give the illusion of it being placed into the bin. I have no idea as to the proper way to code these events so that they happen.
use the sound class to create a sound:
// initialize your correct sound once with
var correctSound:Sound=new CorrectSound();  // add an mp3 sound to your library and assign it class = CorrectSound
// apply the play() method everytime you want your sound to play:
correctSound.play();
// change an object's opacity:
someobject.alpha = .3;  // partially visible
someobject.alpha = 1;  // fully visible
someobject.visible=false;  // not visible, at all.
// change an object's scale
someobject.scaleX=someobject.scaleY=.5;  // shink width and height by 2
someobject.scaleX=someobject.scaleY=1;  // resize to original
4. I've watched dozens of hours of youtube tutorials before coming here. I'm a quick study, but am very new to action script. In one of the videos the developer showed referencing an external action script file which I don't think is an option in CC. The coding method he used seemed much more streamlined and "clean" than the chunks I'm working with now. Is there an easy way for me to code information about these objects  than the way I've got it here now? I hate starting new things with bad habits. The perils of self-teaching.
you could google: 
actionscript 3 class coding
actionscript 3 object oriented programming
p.s.  you can simplify and streamline your coding by learning about arrays and using hitTestObject.

Similar Messages

  • Can you group emails into conversations by drag and drop?

    Conversations in Mail is working fine.  However, sometimes there are messages that don't link because they are from the same person but a different time or not in the current "related" group?
    Can you MAKE them group into the conversation somehow?

    I never have this problem

  • Can you use find my iPhone with iPad and iPhone and the same icloud account for both?

    I have an iPhone and iPad. I use find my iPhone for both. If I use the same icloud account for both, how do I separate them on the map, or if I lose one and want to remote wipe the lost one but not the one in my possession?

    It will list each device separately, I even have two macs along with my ipad listed

  • Can I use my custom board with LPC2378 processor with ULINK2 on Embedded module for ARM and LV.

    Issues in ARM and LV
    Can I use my custom board with LPC2378 processor with ULINK2 on Embedded module for ARM and LV.How can I create my elemental I/O vis or I have to use the existing Keil board vis. Confused. Please help.
    I have LV8.6. Which ver of embedded module for ARM should I buy. Website shows combined price for ARM module and LV. But I already have LV8.6 so what is the cost of module.
    Regards
    Shradha

              If the processor of your development board  is the cortex-M3 core, I think you do not have to buy keil board. Now, there are a lot of OS and emulator suitable for Cortex-M3.
              Operating system I am referring to  is the real time operating system such as keil RTX,uCOS,FreeRTOS,CooCox CoOS and so on. CooCox CoOS is very new, you can get more information from http://coocox.org/ .
              Emulator or debugging tools such as ULINK2,st-link,Jlink,CooCox Colink and so on. CooCox Colink is also very new.  You can download the Colink Plugin from here Colink Plugin . 

  • Can you use 2 Thunderbolt Displays with Windows 7/Bootcamp on a Early 2011 Macbook pro?

    Can you use 2 Thunderbolt Displays with Windows 7/Bootcamp on a Early 2011 Macbook pro?
    I have 2 and cannot seem to get them to work?

    Can you use 2 Thunderbolt Displays with Windows 7/Bootcamp on a Early 2011 Macbook pro?
    I have 2 and cannot seem to get them to work?

  • Can you use a digital recorder with Skype on a Mac mini?

    Can you use a digital recorder with Skype on a Mac mini?

    Have a look at http://www.ecamm.com/mac/callrecorder/

  • Can you use external hard drives with the HP Omni 10 5600US

    Since this a Windows tablet, can you use external hard drives with the HP Omni 10 5600US?
    I know there is a micro-sd reader for additional storage but can you use the usb for external hard drives like a regular pc?
    I tried looking at the spec's for this tablet and it said the usb port was host only. I'm not sure what that means exactly.

    Yes you can.  You'll need to purchase a USB OTG (on-the-go) cable.  I recommend using a drive that has its own power supply but I've successfully used small USB powered drives also.

  • Can you use CORBA Naming Service with javax.naming.event.EventContext?

    Can you use CORBA Naming Service with javax.naming.event.EventContext?
    It seems like it doesn't work. When I try to do something like
    EventContext eCtx_ = (EventContext)namingCtx_.lookup("");
    I'm using JacORB's naming service.
    I just want to clarify that I cannot or can use javax.naming.event.EventContext with CORBA Naming Service.

    Can anyone tell me if it is doable or not doable.
    I looked at the COSNaming SPI, and it seems like it doesn't implement javax.naming.event.EventContext.
    Am I correct or not?

  • Can you use any external display with a macbook?

    hi all,
    I was just wondering, can you use any external display with a macbook? (i.e. gateway, and dell displays?)

    To original poster:
    Yes.
    Provided you have the appropriate ports and cables, that is. Some monitors do not have all vga, dvi-i, dvi-d, hdmi, etc. ports, and it can be misleading that all those technologies appear to be compatible via conversion cables (they aren't all meant to be compatible, so look it up on the internet before buying).
    Cheers,
    Sylvain
    MacBook   Mac OS X (10.4.9)   dual boot Vista Ultimate

  • Is it possible to create a tree with drag-and-drop functionality using ajax

    I saw these samples;
    Scott Spendolini's AJAX Select List Demo
    http://htmldb.oracle.com/pls/otn/f?p=33867:1:10730556242433798443
    Building an Ajax Memory Tree by Scott Spendolini
    http://www.oracle.com/technology/pub/articles/spendolini-tree.html
    Carl Backstrom ApEx-AJAX & DHTML examples;
    http://htmldb.oracle.com/pls/otn/f?p=11933:5:8901671725714285254
    Do you think is it possible to create a tree with drag-and-drop functionality using ajax and apex like this sample; http://www.scbr.com/docs/products/dhtmlxTree/
    Thank you,
    Kind regards.
    Tonguç

    Hello,
    Sure you can build it, I just don't think anyone has, you could also use their solution as well in an APEX page it's just a matter of integration.
    Carl

  • Problem in using AdvanceDataGrid as tree with drag n drop functionality

    Hi All,
    I am using AdvancedDataGrid as tree for displaying my data. Within this ADG tree I have to enable drag n drop i.e. user can select one node and will able to drop that on another node within tree.
    Overwritten dragDrop handler event for ADG.
    Issues: Not getting target node on which I am dropping currently selected node.

    Please don’t use this forum for support questions, go use flexcoders or the Adobe forums instead.
    Matt
    On 2/10/09 11:21 PM, "rakess" <
    [email protected]> wrote:
    A new discussion was started by rakess in
    Developers --
      Problem in using AdvanceDataGrid as tree with drag n drop functionality
    Hi All,
    I am using AdvancedDataGrid as tree for displaying my data. Within this ADG tree I have to enable drag n drop i.e. user can select one node and will able to drop that on another node within tree.  
    Overwritten dragDrop handler event for ADG.
    Issues: Not getting target node on which I am dropping currently selected node.
    View/reply at Problem in using AdvanceDataGrid as tree with drag n drop functionality <
    http://www.adobeforums.com/webx?13@@.59b7e11c>
    Replies by email are OK.
    Use the unsubscribe <
    http://www.adobeforums.com/webx?280@@.59b7e11c!folder=.3c060fa3>  form to cancel your email subscription.

  • Can I use HP Pro 8600 with usb and wireless at the same time

    Can I use HP Pro 8600 with usb and wireless at the same time?  Sometimes I cannot get the wireless to work, it seems to be my laptop.  It would be nice if I could use the usb, but it doesn't work.  What should / can I do, if anything?
    Sam

    Hi,
    Same physical printer but when connecting to SAME computer using both USB and wireless it becomes two (logical) printers. Probably your default prnter is the wireless one, you have to select the right printer before print .
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • Can you use home sharing betweeen a pc and a mac

    can you use homing sharing between a mac and a pc?

    in iTunes on both machines turn on home sharing from the advanced menu using the same Apple ID.
    have a look at this support article.

  • How can i get the address with drag and drop from address book into pages?

    I want to creat a letter withe the new pages. Normaly it was possible to put the adress from the adressbook with drag and drop into the letter. So it was possible to create one letter with many different adresses. But now I didn't find this function any more. How to do ist now?
    Withe best regards and I'm sorry for may bad english
    Klaus

    Sounds like you "upgraded" to Pages 5.
    Apple has removed over 90 features from Pages 5.
    http://www.freeforum101.com/iworktipsntrick/viewforum.php?f=22&sid=3527487677f0c 6fa05b6297cd00f8eb9&mforum=iworktipsntrick
    Pages '09 should still be in your Applications/iWork folder.
    Archive/trash Pages 5, after Exporting your files to Pages '09, and rate/review it in the App Store, then get back to work.
    Peter

  • If i use Ps5 the order lasso, drag and drop or letters the win vista crashes down. Can anybody help?

    If i use PS5 the order lasso,drag and drop or letters the win vista crashes down. Can anybody help me?

    Now that I'm looking at it, I don't have it... but I still have the problem:(. I rebooted the PRAM, I cleaned my permissions, run utilities checks, nothing helps, I'm at the end of my wits. I called apple - all I got was bad attitude... I don't know what to do, this disfunction makes it impossible for me to work....
    does anybody know what I could do to fix this issue?

Maybe you are looking for

  • My album artwork does not match the song in my playlists

    After making playlists with music purchased from itunes in my music app, the art work does not match the title of the song / album. How can I fix this problem?

  • File Content Conversion Problem

    Hi I have a flat file having 10 fileds with fixed length of field 7 characters abc  bcd  dce  cef  ecf  fgi 123  234  343  233 434 343 322  222  222  222 222 222 +++++++++++++++++++++++++++++++ XML CODE FOLLOWS +++++++++++++++++++++++++++++++ <?xml v

  • Just found a code that works for my Wharfedale LCD...

    I can't remember the full details of the TV and the instructions book does not have any - but after lots of trial and error 0017 worked. Hurrah!

  • Datetime to string convertion

    hi all, do you have any idea about, converting datetime type to string type? i select record from MSSql2000 database, and i try to write date-time field in textfield. rs.getTimeStamp("trh"); textfield.setText(...); how can � convert datetime type to

  • Photoshop 7- Crashing when opening a new document

    Hi All, Was working with a document when it crashed. The file now opens fine, but if I try and create a new document it crashes. I don't get any error message, it just removes my options to do anything but still looks like its operating fine, wont te