Small game like drag and drop

i'm new to flash action scrip but i want to create small game like drag and drop. but this has special area to drop and after drop selected object ,then i want to change that object(replace object by another object) using mouse move(scrolling). here what i did up to now
bold area is the specialy i want to know, please help....
ball_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
ball_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
square_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
square_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
function pickUp(event:MouseEvent):void
    event.target.startDrag(false);
    event.target.parent.addChild(event.target);
function dropIt(event:MouseEvent):void
    event.target.stopDrag();
ball_mc.buttonMode = true;
square_mc.buttonMode = true;

I don't know which line you intended be bold, but the following line makes little sense...
event.target.parent.addChild(event.target);
If the parent of the event target is the parent, then the event target is already the child of the parent.

Similar Messages

  • I want to make a VBIDE-Like drag and drop programm using Swing

    I am using swing am able to display no.of JInternalFrames on JDesktopPane to achieve an senario as in the VB-IDE we can easy resize and move the VB-components like Label ,Button ...But i want to drag a JButton or JLabel from any JToolBar and when i draw a rectangle,with dotted lines , on some container (may be JDeskTopane) and when i realese the Mouse then that JButton or JLabel will be displayed on the container.Please give me any idea,code,links or hints so that i can complete it.i.e How i can develope a VB-Ide like drag and ide in Java..
    Thanks in advance....

    Hey there buddy!
    You may like to check out the code for some projects on sourceforge if you wish to build something like this. Firstly, it is no easy task you are undertaking, but a good one none the less!
    The projects I have in mind are the following ones:
    Abacus GUI builder:
    http://sourceforge.net/projects/abaguibuilder
    JUIE
    http://sourceforge.net/projects/juie
    Have a look at the code to see how it is done. JUIE uses AWT but is in the process of being upgraded to swing. Abacus is currently Swing based.
    As far as I know, you are going to have to learn about Mouse handlers, in particular public void mousePressed();mouseDragged() etc... You will also need to learn about the layered pane architechture of Swing. When you click on your button it would (presumably) create a new button, add it to one of the thousands of possible layers you can have, and when you drag that component, the mouseDragged event will constantly send updates to the component to re-position it in the GUI...
    Good luck with it and I would be very interested to see how you went about it in the end.
    Take care
    Jason Barraclough.

  • Need help with drag and drop game, Urgent!

    Hi I have created a drag and drop game, the drag and drop is
    working alright however once the right word has been placed in the
    box, and moves on to the next question the previous correct answer
    stays where it was placed, how can i get it to snap back to its
    original location? Also when the right word is draged in to the the
    white box i want it to snap into place in that box so it fits in
    there.
    Also if you have any other thoughts and advice on how i can
    improve on this please email me thanx
    Can someone please help, my .fla file can be found here:
    http://www.freshlemon.co.uk/timeline.fla
    http://www.freshlemon.co.uk/timeline.fla.zip
    thanx

    tellTarget is ancient
    I forget what it even used to do??? hahaha
    seriously, just put in the instance name and what you want it
    to do:
    tellTarget("movieclip"){
    play();
    is now just
    movieclip.play();

  • Drag and drop to grid AS2

    i want to create a grid where i can drag and drop items to it n save them, should i draw the grid myself and make a bunch of holders (as if i were making an inventory?) or is there a code i can use.
    i am pretty good with as2 but i never took the time to really get into arrays. i come up with my own solutions, but i want to make this the right way.
    for ex.sims build mode. 
    anyone interested in helping me out with my game also?  Doesnt hurt to ask.

    that doesn't sound like drag and drop.
    but if you want to attach something to a clicked cell, just do it.  flash will know which cell was clicked the same way it knows which button in a list of several buttons were clicked:
    for(var i:Number=0;i<colNum;i++){
    for(var j:Number=0;j<rowNum;j++){
    var mc:MovieClip=this.attachMovie("cell_mc","cell_"+j+"_"i,this.nextHighestDepth());
    mc.colNum=j;
    mc.rowNum=i;
    mc._x=j*mc._width;
    mc._y=i*mc._height;
    mc.onRelease=function(){
    //do whatever

  • Why can't I drag and drop photos from iPhoto on my iMac to my iPad?

    I have thousands of photos on my iMac and often want to copy a few dozen to my iPad to bring to my relatives. It seems that I should be able to create an album on my iMac and drag it to my iPad but I can't. Didn't Apple get where it is by making things simple like drag and drop?  Why is it like a state secret to get some photos moved over? I'd really like to know the reason. I don't want a convoluted work-around. This isn't Windows!
    Come on Apple, give us simplicity or at least a USB port to copy stuff!

    Thanks for the reply. I guess I was a bit steamed. I know how to sync photos but object to having to treat my photos on the iPad in such an unintuitive way. Maybe I'm alone ( but I doubt it ) but I have photos on my iPad and iPhone for several different purposes. I keep photos of things I want to paint, photos of friends and relatives, photos of items I saw that I may want to buy and snapped the ISBN code. Photos of book list of authors I like that I want to read so if I see one in a used book store I remember which ones I haven't read yet. I don't think this is unreasonable or even something that only I want. I don't want to delete all of this every time I want to add another photo. I know I can back it up to my iMac and restore it plus the new photo later but this is not what I expect or want from Apple. I have had Apple products since the Apple II and Macs since March 1984 and it was because Apple always seemed to try and figure what the user wanted first and foremost but this seems to have changed. I would prefer most iPhoto and iTunes app versions from ten years ago to those coming out now because they valued intuitive interface over exotic features. Apple is the product 'for the rest of us' but not anymore it seems.
    Maybe there are some good reasons why Apple is doing it, security, contracts, etc but I'd like to know. Maybe some of the users know and will give straight answers.
    Thanks, for the info though.

  • Drag and drop in Apple Mail

    I just upgraded to OS X 10.9.1. When I started the Mail program, I was told that the mail database was being upgraded. Now I can no longer drag and drop e-mail messages between Mail folders like I could before. Is anyone else experiencing this same issue? I can use the Move to command. I really like dragging and dropping messages. I don't want to have to use the 'Move to' option if I don't have to. Does anyone know how to get back drag and drop?

    SOLVED. I needed to reindex the entire mailbox database. The initial reindex when I first started Mail after the update to 10.9.1 did not work completely, and neither did reindexing individual mailboxes. Drag and drop has been restored.

  • HDividedBox - dragging and dropping panels

    Hi All,
    Need urgent help from the community...
    I need to create a dashboard which I plan to create using HDividedBox as need to create multiple panels with draggable divider ..
    However my another requirement is user should also be able to drag and drop panels within that HDividedBox.. it will be like dragged and dropped panels will switch positions ..
    please help me with the pointers to achieve this ..
    Thanks..

    I don't know why but this code doesnt work for me too.
    I am able to drag out only one mc and have a duplicate being
    positioned at the same position. But i am not able to drag the
    duplicate out from the same position.
    Here's what i want actually:
    1) when a movieclip starts to be dragged, create a duplicate
    of it located at its start position
    2) the duplicate can be dragged as well and when it is being
    dragged, there will be another duplicate of it at its start
    position.
    3 ) 2 version of the dragged movieclip; (a) should be above
    the other movieclips & (b) are not above of the other
    movieclips
    Is it possible to do it?
    X_x

  • A drag and drop game with dynamic text response

    Hi,
    I am a teacher and my school has recently upgraded to Adobe Design Premium.  Our previous version was about 5 versions out of date.
    I teach A Level which requires students to create an Interactice Multimedia product.
    In the previous 6 years, I have taught students how to create simple drag and drop game with dynamic text responses.
    Since the upgrade to Actionscript 3.0 the dynamic text response has ceased working.
    When creating the game from scratch, I need to move to Actionscript 2.0 as 3.0 does not allow me to add actionscript to objects - I know and am sure that this is a better way of doing things, but I would prefer to keep working the way I am used to.
    I use a switch case statement which I have copied below to make the drag and drop work.  The objects I apply the code to work in that they can be dragged, however, my dynamic text box with a variable name of "answer" is no longer displaying the response when an answer is left on a dropzone (rectangle converted to a symbol and given an instance name).
    on(press) {
    startdrag(this);
    on(release) {
    stopdrag();
    switch(this._droptarget) {
      case "/dropzoneB":
       _root.answer="Well done";
       break;
      case "/dropzoneA":
      case "/dropzoneC":
       _root.answer="Hopeless";
       break;
      default:
       _root.answer="";
       break;
    Any help would be much apeciated.
    Thanks
    Adrian

    To drag in as3
    blie_btn is the instance of the object drawin on the stage. In AS3 you have to assign a even listener, in this case MOUSE_DOWN, and MOUSE_UP, as we want the drag to stop if the mouse is not clicked. Then we fire the functions, and tell the object to start drag.
    // Register mouse event functions
    blue_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
    blue_btn.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
    red_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
    red_btn.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
    // Define a mouse down handler (user is dragging)
    function mouseDownHandler(evt:MouseEvent):void {
         var object = evt.target;
         // we should limit dragging to the area inside the canvas
         object.startDrag();
    function mouseUpHandler(evt:MouseEvent):void {
         var obj = evt.target;
              obj.stopDrag();
    if you want to make the text do what you want then something like this might work.
    In the function, you could add a text box onto the stage, give it a instance of something like outputText
    and then:
    outputText = ("Bla Bla Bla");
    (^Not sure if this will work exactly^)
    PS. I am currently a A-level student

  • Who'd like to test a new Drag and Drop Interactive Widget?

    It's taken about 6 months of every spare minute we could find but we're finally ready to do a round of Alpha testing for our new Drag and Drop Interactive Widget for Cp4 and 5.  This post is to ask for a handful of volunteers to test the new widget over the next week creating drag and drop interactions in both Cp4 and Cp5.
    If you've already tried our well-known Drag and Drop Lite Question Widget, but were a bit frustrated by the limitations that the quiz question format placed on your creativity, we think you'll be blown away by what this new Interactive Widget can do.  It does everything the current question widget does, aside from the aspects that are unique to question types (Review Area, Retake Quiz, etc) plus a whole lot more.  Due to the extra functionality, this widget has twice as much code as our last one.
    Some of the features:
    You can have as many widgets as you want on a single slide and each can be addressing a different drag and drop scenario.
    You can reference the same drag and target objects from different widgets to create different.
    Since they are interactive widgets, you can use the widget success/failure criteria to trigger Advanced Actions.  This opens up a lot of possibilities for game interactions.
    You can score each widget differently so that OnSuccess they will each report different scores for dragging the same objects.  This means you can have Conditional Scoring and more than one correct answer for a given problem.
    You can set one of the widgets to have its Preferences be used for all widgets on the slide so that you don't need to set all widget preferences individually, thus saving a lot of time.
    You can set Preference Priority for each widget to configure which widgets will have "right of way" if there is a potential conflict in preferences.  For example, if one widget wants one type of snapping behaviour on an object but another widget wants the same object to snap differently, the widget with the higher Preference Priority will dominate.
    You can nominate other interactive objects (including clickboxes or other widgets) to act as Submit button and Clear button to create a simulated quiz question.
    Since this widget is an Interactive widget, it also has the same advanced Pausing override behaviours we built into our Event Handler widget (http://www.infosemantics.com.au/eventhandler)  So you can have users stay on the same slide playing with the drag and drop interaction for as long as they like without progressing to the next slide until they want to.
    Plus other stuff I can't think of right now.
    If you decide to volunteer to participate in this Alpha testing, please don't use this widget for any production Captivate projects you may have.  The Alpha and Beta versions of the widget will be time-bombed to stop working after a couple of weeks so that we don't have buggy versions running around later.
    As I said at the beginning, we only need a handful of testers, we need people using either Cp4 or Cp5, and you need to do this testing over the next week so that we can then address any issues you find and release a debugged Beta version for more testing.
    Anyone wanna play?
    If you do want to volunteer, send me a private message on this forum with your email address so I can send you a widget and instructions.  We'll only be taking the first dozen or so people that are willing to contribute time and feedback.
    Cheers,
    Rod Ward

    Hi Sandy,
    If you hover the mouse over Rod's avatar, there is an e-mail address visible. For a private message; double-click on his avatar and you'll find the button private message in that dialog box,
    Lilybiri

  • Drag and Drop Interactive Game

    I am creating a drag and drop interactive game. I cannot post
    the file because it is for work and is business sensitive. Here is
    the problem I am having. I have multiple frames in the game. I have
    correctly entered the actionscript that allows for the drag and
    drop feature and to go to the next frame. However when the game
    goes to the next frame, the last drag and drop item stays on the
    screen. Is there a further actionscript I need to enter that clears
    the screen before the next frame?

    can u use the as like this:
    mcname_mc._visible = false;

  • Drag and Drop Games

    I'm interesting in creating some simple games which require
    drag and drop and gives some results/points
    is this possible with captivate 3? I read somewhere in some
    reviews that it is possible with matching games.
    Has anyone any experience or knowledge in this area?

    Hi edumacator and welcome to our community
    Certainly the Captivate Question type of Matching offers the
    ability to click and drag, but that is limited to the text used.
    There is another Captivate Question type of Sequence that may be
    used, but it too is limited to the text.
    The bottom line is that there is no way I'm aware of with
    Captivate alone, that you may create a drag and drop using images.
    (I'm guessing that you don't wish to offer simple text and would
    prefer images that would be clicked and dragged)
    You would have to resort to Flash for something like that.
    Cheers... Rick

  • I would like to copy all the songs from one Ipod into another. All the songs are into my Itunes account, I tried to drag and drop the songs from the old Ipod to the new one but it doesn't work. Is there a way to do it ?

    Hello everybody,
    I would like to copy all the songs from one Ipod into another. All the songs are into my Itunes account, I tried to drag and drop the songs from the old Ipod to the new one but it doesn't work. Is there a way to do it ?
    I share one Itunes account with other people from my family and one person would like to keep the same songs on the new Ipod as the ones which were on the old one.
    Thanks in advance for your answer.
    Yan

    Hello Chris,
    Thanks for your answer. I was hoping for an easier answer. Too bad there is no drag and drop solution, it would have been much easier.
    Thanks for answering so fast.
    Bye.
    Yan

  • I purchased a seagate 5T hard drive that I would like to partition and have time machine on one side and drag and drop on the other side. Is this possible, and if so how?

    I purchased a Seagate 5T external harddrive which stated it was for both Mac and PC.
    I want to partition the drive so I can have a partition for time machine and a partition for drag and drop.
    My Mac book pro 17inch model has parallels. I would like a partition for time machine for the mac side and a partition for the PC side as well and a third partition for just saving work files so I don't clog up my laptop.  IS this possible? DrMAV

    yes it is possible using 'disk utility'. format the time machine backup as Mac OS Extended( journaled). The windows partition can use FAT32.

  • Can't import photos via drag-and-drop (only small thumbnail will appear)

    After I drag and drop photos into iPhoto 7.1.3 (even a photo just exported from iPhoto), it shows the import process and creates an untitled event. Once complete, I see a dashed-line box instead of the images.
    http://idisk.mac.com/phildame/Public/Pictures/Skitch/iPhoto-20080308-111415.jpg
    Every time I re-open, it will try and re-import the failed photos, creating a new event each time. I have to tell it not to try recoving.
    Note that in the event view, it's a blank square. If a reduce the thumbnail slider enough the images appear in "Photos" view (as if only the small thumbnails were generated before it crapped out).
    Is anyone else seeing this? I'm not sure what to do.
    Phil

    Phil
    Two issues there:
    Every time I re-open, it will try and re-import the failed photos,...
    Go to your Pictures Folder and find the iPhoto Library there. Right (or Control-) Click on the icon and select 'Show Package Contents'. A finder window will open with the Library exposed.
    Look there for a Folder called 'Import' or 'Importing'.
    Drag it to the Desktop. *Make no other changes*.
    Start iPhoto. Does that help?
    2. As to the blank thumbnails:
    Back Up and try rebuild the library: hold down the apple and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild.
    Regards
    TD

  • Can i link to a specific sent email within a cell like the "Show in Mail" drag and drop feature in iCal events?

    Trying to make a log of phone and email contacts with customers.  I want to link to the actual email I sent to the customer, like the "show in mail" drag and drop feature in iCal.  Thanks

    Links in Numbers can do only two things external to the document:
    Open a page on the web
    Open and address a NEW email message, ready to compose and send.
    Regards,
    Barry

Maybe you are looking for

  • How can I create a new Security Domain ?

    Hi everyone, I would like to know how can I create an Security Domain other than ISD ?(If my card support multi SD and delegated management) I read Global Platform v2.1.1 ,but I don't know how can I create new SD practically(how can I write it's code

  • J2EE Application Client Container

    Hi everyone, I've three questions about J2EE Application Client Container. 1) What do I have to install into the client computer so that my J2EE client application can run? 2) Can I install my client application and also the client container through

  • Mountain Lion not compatible

    I am trying to download Mountain Lion from the App Store and this is the message I get?  I have the latest software updates?

  • DV camcorder to iMovie / iDVD - Why does my DVD look so bad?

    I have an SD DV camcorder (a canon opt-40 model which is quite decent for SD)which when I hookup directly to my TV puts out a pretty decent picture. I have imported the video from this camcorder into iMovie and done the assembly. I then put it throug

  • Blurry photos - Premiere Elements 11

    (System) Windows 8 64 bit, Core i5 4670 CPU @ 3.40GHz, 8 GB DDR ram, GeForce GTX 650 - Nvidia/MSI - GeForce 320.49 Driver. Hello I recently purchased Premiere Elements 11 and Photoshop Elements 11.  My first project was a success which included video