Match, drag and drop game

Hello,
My name is Nikola and I'm newbie with AS.
Here’s the thing:
With the help of some tutorial I’ve created a 'game', where user selects objects, drags it, and drops it on correct shape/color/object. Tutorial is “1 to 1” based, so you can match one object and one target only.
Now, I would like to have multi objects, and one target on which I can drop them.
Example:
TARGET: blue square
OBJECTS: blue star, blue circle, etc.
I got stucked with Instance and Movie clip names since they have to be unique, and the code itself works on the principle of names paring - object: name, target: "target"+object name.
Here’s a code for “1 to 1” option:
var objectoriginalX:Number;
var objectoriginalY:Number;
shape_mc.buttonMode = true;
shape_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
shape_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
shape2_mc.buttonMode = true;
shape2_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
shape2_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
function pickupObject(event:MouseEvent):void {
event.target.startDrag(true);
event.target.parent.addChild(event.target);
objectoriginalX = event.target.x;
objectoriginalY = event.target.y;
function dropObject(event:MouseEvent):void {
event.target.stopDrag();
var matchingTargetName:String = "target" + event.target.name;
var matchingTarget:DisplayObject = getChildByName(matchingTargetName);
if (event.target.dropTarget != null && event.target.dropTarget.parent == matchingTarget){
event.target.removeEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
event.target.removeEventListener(MouseEvent.MOUSE_UP, dropObject);
event.target.buttonMode = false;
event.target.x = matchingTarget.x;
event.target.y = matchingTarget.y;
} else {
event.target.x = objectoriginalX;
event.target.y = objectoriginalY;
I hope that I was clear,
thanks,
Nikola

for your special example give all matching instances an identical leading Letter:
like: bStar,bSquare,bHeart for all blue Shapes and gStar,gHeart etc. for all green ones...you get the idea
then change your function
function dropObject(event:MouseEvent):void
    event.target.stopDrag();
   //check if the leading Letter for both Sprites is the same
    if (testIfMatch(event.target.name, event.target.dropTarget.parent.name))
        event.target.removeEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
        event.target.removeEventListener(MouseEvent.MOUSE_UP, dropObject);
        event.target.buttonMode = false;
    else
        event.target.x = objectoriginalX;
        event.target.y = objectoriginalY;
function testIfMatch(_drop:String, _target:String):Boolean
    if (_drop.substr(0, 1) == _target.substr(0, 1))
        return true;
    else
        return false

Similar Messages

  • 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();

  • 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

  • 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

  • Drag and Drop game with only two targets

    I created a drag and drop activity where their are five boxes that are supposed to go in to two columns in any order. I found a tutorial online that I based this activity off of.
    The problem is that the tutorial shows you how to make a target for each mc which has worked for all the activities I've made except for this one where I need only two targets. How would I change it so I can have multiple mc's drop on to one target?
    This is my AS:
    var score:Number = 0;
    var objectoriginalX:Number;
    var objectoriginalY:Number;
    growing_mc.buttonMode = true;
    growing_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
    growing_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
    gorging_mc.buttonMode = true;
    gorging_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
    gorging_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
    dormancy_mc.buttonMode = true;
    dormancy_mc.addEventListener(MouseEvent.MOUSE_DOWN  , pickupObject);
    dormancy_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
    cystform_mc.buttonMode = true;
    cystform_mc.addEventListener(MouseEvent.MOUSE_DOWN  , pickupObject);
    cystform_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
    hosttrans_mc.buttonMode = true;
    hosttrans_mc.addEventListener(MouseEvent.MOUSE_DOW  N, pickupObject);
    hosttrans_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
    function pickupObject(event:MouseEvent):void {
    event.target.startDrag(true);
    event.target.parent.addChild(event.target);
    objectoriginalX = event.target.x;
    objectoriginalY = event.target.y;
    function dropObject(event:MouseEvent):void {
    event.target.stopDrag();
    var matchingTargetName:String = "target" + event.target.name;
    var matchingTargetisplayObject = getChildByName(matchingTargetName);
    if (event.target.dropTarget != null && event.target.dropTarget.parent == matchingTarget){
    event.target.removeEventListener(MouseEvent.MOUSE_  DOWN, pickupObject);
    event.target.removeEventListener(MouseEvent.MOUSE_  UP, dropObject);
    event.target.buttonMode = false;
    event.target.x = matchingTarget.x;
    event.target.y = matchingTarget.y;
    score++;
    scoreField.text = String(score);
    } else {
    event.target.x = objectoriginalX;
    event.target.y = objectoriginalY;
    if(score == 5){
    response_mc.gotoAndStop(2);

    var matchingTargetName:String =(event.target.name).substring(0, 1);
    Change the name of the target to A and B and the mc A1, A2, A3, A4... and B1, B2,B3...

  • Im trying to make a drag and drop game where i can drag words into a table which then makes a Tick

    Im having trouble with this and its going wrong. I need to use actionscript 2 and im on flash cs3. Can anyone give me a code i could use to do this or maybe a tutorial?
    Thanks

    if you can't explain, you can't get specific help.  you can still use google to search for tutorials and you may get enough help to see you past the problem(s) you're having.

  • Drag and Drop exercise

    Hi. I am a language teacher and completely new to Flash. I
    have designed a drag and drop exercise with textboxes that I
    converted into movie clips.
    One set of textboxes are empty and are the 'target'
    textboxes.
    The other set of textboxes are exactly the same size but have
    writing in them. I have attached the following action script to the
    moveable textboxes:
    While I have succeeded in making the textboxes move, they
    will not drop into the 'target' textboxes and stay there. Any idea,
    why?

    Hello kglad. Before I started this drag and drop exercise
    using textboxes, I followed a tutorial which I found on another
    flash website. I was taught how to design a drag and drop game for
    which I drew 4 different shapes. Then, I copied those 4 shapes and
    put them onto another layer. One set of shapes was to be the target
    shapes, the other ones were draggable. I used the code you can see
    below. This game worked fine - when I dragged the shapes over the
    correct targets, they stayed there. I then tried to replicate the
    same idea (using the same basic code but changing the instance
    names) but instead of drawing shapes, I used textboxes.
    Unfortunately, I still can't get this to work. Is there a
    fundamental difference between shapes and textboxes?

  • Drag and drop in Fireworks CS4?

    Hi,
    Does anyone know if it is possible to create a basic 'drag and drop' game in fireworks cs4?  I want to be able to drag a small image from one column in a table to another.  Any thoughts?
    Thanks,
    Denbeck

    Dreamweaver  http://www.communitymx.com/abstract.cfm?cid=ACCE1DA73E6F43C1
    flash http://www.communitymx.com/abstract.cfm?cid=ACCE1DA73E6F43C1

  • Drag and Drop with snap and response

    Ok, first of all I'm new to all of this as I'm just doing some parttime work. I'm trying to make a drag and drop game where the images (imported and made into movie clips with instance names "peg1 - peg7") are to be dragged onto targets (images, made into movie clips with instance names "targetpeg1-targetpet7").
    Here's my code and it comes up with two errors -
    ReferenceError: Error #1069: Property parent not found on builtin.as$0.MethodClosure and there is no default value.
    at Gametake1_fla::MainTimeline/fl_ReleaseToDrop()
    Please help!!! Thanks a bunch!
    Amy
    peg1.buttonMode = true;
    peg2.buttonMode = true;
    peg3.buttonMode = true;
    peg3.buttonMode = true;
    peg4.buttonMode = true;
    peg5.buttonMode = true;
    peg6.buttonMode = true;
    peg7.buttonMode = true;
    peg1.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);
    peg2.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);
    peg3.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);
    peg4.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);
    peg5.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);
    peg6.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);
    peg7.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);
    function fl_ClickToDrag(event:MouseEvent):void
    event.currentTarget.startDrag();
    reply_txt.text = "Drag the image to its correct location"
    peg1.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);
    peg2.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);
    peg3.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);
    peg4.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);
    peg5.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);
    peg6.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);
    peg7.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);
    function fl_ReleaseToDrop(event:MouseEvent):void
    event.currentTarget.stopDrag();
    var myTargetName:String = "target" + event.target.name;
    var myTarget:DisplayObject = getChildByName("myTargetName");
    if (event.target.stopDrag != null && event.target.stopDrag.parent == myTarget){
        reply_txt.text = "Good Job!";
    } else {
        reply_txt.text = "Try Again!";
    function checkTarget(drag){
    if (drag.hitTest(targetpeg1)) {
    trace(drag+" has been dropped on greyCircle");
    } else {
    trace("you missed the target");

    use:
    peg1.buttonMode = true;
    peg2.buttonMode = true;
    peg3.buttonMode = true;
    peg3.buttonMode = true;
    peg4.buttonMode = true;
    peg5.buttonMode = true;
    peg6.buttonMode = true;
    peg7.buttonMode = true;
    peg1.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);
    peg2.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);
    peg3.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);
    peg4.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);
    peg5.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);
    peg6.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);
    peg7.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);
    function fl_ClickToDrag(event:MouseEvent):void
    event.currentTarget.startDrag();
    reply_txt.text = "Drag the image to its correct location"
    peg1.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);
    peg2.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);
    peg3.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);
    peg4.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);
    peg5.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);
    peg6.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);
    peg7.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);
    function fl_ReleaseToDrop(event:MouseEvent):void
    event.currentTarget.stopDrag();
    var myTargetName:String = "target" + event.currentTarget.name;
    var myTarget:DisplayObject = getChildByName("myTargetName");
    if (event.currentTarget.dropTarget){
    if(event.currentTarget.dropTarget.parent == myTarget){
        reply_txt.text = "Good Job!";
    } else {
        reply_txt.text = "Try Again!";

  • Drag and drop counter which activates a animation when certain number is reached

         Hi there guys, I was wondering if anyone could help me with this problem, I'm using adobe edge to create a drag and drop game and I want edge to use a counter to track how many draggable parts have been dropped in their repective targets, when a certin number of elements have been dropped I would like edge to automaticly reveal a button so the user can move on. I have the code and I think I may be on the right track but I may be miss placing some code
    Any help woud be great
       // insert code to be run when the symbol is created here
             yepnope({nope:['jquery-ui-1.10.4.custom.min.js', 'http://code.jquery.com/jquery-1.11.0.js'], complete: init});
             function init(){
                       //Use the code! Draggable! Droppable!!
                       sym.$('Leftpole3').draggable({opacity:.5, revert:'invalid'});
                       sym.$('Leftpole2').draggable({opacity:.5, revert:'invalid'});
                       sym.$('Leftpole1').draggable({opacity:.5, revert:'invalid'});
                       //Droppable
                       sym.$('Leftpole3target').droppable({
                                 accept:sym.$("Leftpole3"),
                                 drop: function () { 
                                                      sym.setvarible("count", count + 1)
                                 sym.getSymbol("Leftpole3").play();  
                       sym.$('defaultpole3').droppable({
                                 accept:sym.$("Leftpole3"),
                                 drop: function () {
                       sym.$('Leftpole2target').droppable({
                                 accept:sym.$("Leftpole2"),
                                 drop: function () {
                                                      sym.setvarible("count", count + 1)
                                                      sym.getSymbol("Leftpole2").play();
                       sym.$('defaultpole2').droppable({
                                 accept:sym.$("Leftpole2"),
                                 drop: function () {
                       sym.$('Leftpole1target').droppable({
                                 accept:sym.$("Leftpole1"),
                                 drop: function () {
                                                      sym.setvarible("count", count + 1)
                                 sym.getSymbol("Leftpole1").play();
                       sym.$('defaultpole1').droppable({
                                 accept:sym.$("Leftpole1"),
                                 drop: function () {
             // Set the value of a Symbol variable
             sym.setVariable("count",0);
             if("count"==3) {
                sym.getSymbol('Text2').play();

    Hi,
    I don't know whether you have sorted this problem out but I have a drag drop just the same as you have described and I have got it working.
    I found that adding the if statement for the count ==3 to the droppable, drop: function works.
    You will just have to have it like this for example:
    drop: function ()
         sym.setvarible("count", count + 1)
         if (count ==3)
              sym.getSymbol('Text2').play();
    This is the way have it working, hope it helps

  • Drag and drop issues

    hi
    ive got the following code. bevvy is a movieclip, theres a dynamic text box called feedText nd a box..imaginately called box.
    I'm trying to create a drag and drop game when the user drags a word into the box that will have its meaning beside it in a text box, the dynamic text box will tell them if they are right or not. if they are right the word stays, if not the word will go back to its original location. the dynamic text box will give feedback whether they are right or not.
    the code below means that the word will stay in the box, but the text message is displayed all the time. i also have a reset button to make the word return to its origal location but id rather not have the button.
    any thoughts please?
    bevvy.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown)
    var onTheRun:Boolean = true;
    function mouseDown(event:MouseEvent):void {
        bevvy.startDrag();
    bevvy.addEventListener(MouseEvent.MOUSE_UP,mouseUp)
    function mouseUp(event:MouseEvent):void  {
        bevvy.stopDrag();
    resetButton.addEventListener(MouseEvent.CLICK, reset);
    function reset(evt:MouseEvent):void {
        bevvy.x=99
        bevvy.y=131
    addEventListener(Event.ENTER_FRAME,enterFrameHandler);
    function enterFrameHandler(event:Event):void{
        if(bevvy.hitTestObject(box)&& onTheRun){
            onTheRun = false;
            bevvy.stopDrag();
            bevvy.x=box.x;
            bevvy.y=box.y;
            feedText.text="well done thats right"

    thanks so much!
    put the code in and it works.
    now for my next problem, i want to add another word into the game. so put the same code in, changed it according to instance names etc and get this error:
    1021: Duplicate function definition.
    its because i have two mouse up and two mouse down functions like this
    bevvy.addEventListener(MouseEvent.MOUSE_UP,mouseUp)
    numpty.addEventListener(MouseEvent.MOUSE_UP,mouseUp)
    i tried to change the mouseUp by adding a number to the end of one to make it different but then i just got more error messages! its probably a simple problem to solve but i just dont have enough flash experience yet to figure it out.
    thanks

  • How to play a sound on drag and drop?

    I've been tasked with creating a drag and drop game for College, and I would like to make it so that when an object is picked up/clicked on, a small 'pop' sound will play, and when it is successfully placed on a target, a slightly different 'pop' sound will play.
    I'm using ActionScript 2.0 on Flash CS5.5.
    I've got the drag and drop done, I just need to add the sound counterpart. I've seen some tutorials, but they're way too vague for me.

    Thanks a lot for that! Managed to get it to work finally.
    Sorry for the late response, I've only just decided to get back to doing the work.

  • Drag and Drop Item Sticking

    I'm creating a drag and drop game for grades K-2 and two of
    my pieces stick to the mouse when clicked. I'm not sure what the
    problem is as I've used the same code for all of my pieces.
    The pants1_mc and the glasses_mc are the problems.

    I think the problem might also be that you are listening for
    the Mouse Up on each of your draggable items. Instead you should
    register just one listener on the stage so that if the pointer
    isn't over your drag when you release it still will be able to
    "dropIt".
    My guess would be that the pants and the glasses are a shape
    where when you stuck the pointer to the registration point (with
    the true inside the startDrag) the pointer wasn't actually over a
    pixel of the artwork. The other shapes weren't like that.
    So removing the true might work for you here, but what if you
    wanted the true? Or what if you were going to constrain the
    dragging to a specific area and it was possible that the pointer
    would move off the artwork. You would have this problem again.
    So I would add to the pickUp function:
    addEventListener(MouseEvent.MOUSE_UP,dropIt);
    event.target.startDrag()
    Then inside the dropIt function
    removeEventListener(MouseEvent.MOUSE_UP,dropIt);
    stopDrag();
    Finally you won't need each of the individual dropIt
    registrations in your main code.

  • Flash drag and drop not finding targets in Captivate

    I created a drag and drop game in Flash CS4 using Actionscript 2 which allows you to pull clothing onto a stick figure. If you get the clothes in the right place, over the target, then they stick, if not they return to their original position. It works fine but when I open it in Captivate 4 the targets no longer hold the objects. No matter where you place the clothes icons they will return to their original position.
    I have captivate set up for the correct Actionscript and the fps in captivate and the swf are the same. I've included the code I wrote below. Please help if you have any answers as to why this is happening.
    shirt_mc.onPress=function(){
    startDrag(this);
    shirt_mc.onRelease=shirt_mc.onReleaseOutside=function(){
    stopDrag();
    if (this._droptarget == "/targetShirt") {
    this.onTarget=true;
    _root.targetShirt.gotoAndStop(2);
    }else{
    this.onTarget=false;
    _root.targetShirt.gotoAndStop(1)
    shirt_mc.myHomeX=shirt_mc._x;
    shirt_mc.myHomeY=shirt_mc._y;
    shirt_mc.onMouseDown=function(){
    //this variable tells us if the mouse is up or down
    mousePressed=true;
    shirt_mc.onMouseUp=function(){
    mousePressed=false;
    shirt_mc.onEnterFrame=function(){
    //all these actions basically just say "if the mouse is up (in other words - the clip is not being dragged)
    // then move the MC back to its original starting point (with a smooth motion)
    if(mousePressed==false&&this.onTarget==false){
    this._x-=(this._x-this.myHomeX)/5;
    this._y-=(this._y-this.myHomeY)/5;
    pants_mc.onPress=function(){
    startDrag(this);
    pants_mc.onRelease=pants_mc.onReleaseOutside=function(){
    stopDrag();
    if (this._droptarget == "/targetPants") {
    this.onTarget=true;
    _root.targetPants.gotoAndStop(2);
    }else{
    this.onTarget=false;
    _root.targetPants.gotoAndStop(1)
    pants_mc.myHomeX=pants_mc._x;
    pants_mc.myHomeY=pants_mc._y;
    pants_mc.onMouseDown=function(){
    //this variable tells us if the mouse is up or down
    mousePressed=true;
    pants_mc.onMouseUp=function(){
    mousePressed=false;
    pants_mc.onEnterFrame=function(){
    //all these actions basically just say "if the mouse is up (in other words - the clip is not being dragged)
    // then move the MC back to its original starting point (with a smooth motion)
    if(mousePressed==false&&this.onTarget==false){
    this._x-=(this._x-this.myHomeX)/5;
    this._y-=(this._y-this.myHomeY)/5;

    Hi all,
    Thanks for the informative replies.  My main issue seems to be when adding animations.  For example (I have included one below
    ).  I add this animation to my project and it runs perfectly.  I then add another, very similar animation, and the sound dissapears completely in the previous one! I remove the one added, preview the project again and the first animation works again!
    The only access I make to Root is through the successful click on the otherTARGET, that tells captivate to move to the next slide.  Could this be the root (exuse the pun) of my problems?
    Any help appreciated!
    stop();
    var target:Array=new Array(likelyTARGET,otherTARGET,other1TARGET);
    addListners();
    var more:Sound = new consequencefocuspeople();
    var less:Sound = new consequencemoreserious();
    function addListners(){
    for (var i in target) {   
    target[i].addEventListener(MouseEvent.CLICK, onClick);
    function onClick(event:MouseEvent):void
    var item:String = event.target.name;
    switch(item)
      case "otherTARGET":
         var mainmov:MovieClip = MovieClip(root);
          mainmov.rdcmndNextSlide = 1;
      break;
      case "other1TARGET":
      removeAllEventListner()
      var soundChannel:SoundChannel = more.play();
      soundChannel.addEventListener(Event.SOUND_COMPLETE, soundComplete);
      break;
      case "likelyTARGET":
      removeAllEventListner()  
      var soundChannel2:SoundChannel = less.play();
      soundChannel2.addEventListener(Event.SOUND_COMPLETE, soundComplete);
      break;
    function soundComplete(event:Event):void {
    addListners()
    function removeAllEventListner()
    for (var i in target)
      target[i].removeEventListener(MouseEvent.CLICK, onClick); 
    thanks,
    tristan

  • Embedded drag and drop not working

    Hi,
    Hoping someone can help as have got 90% of the way through a project and hit a wall at the final (end-of-level-baddie) problem.
    I'm currently embedding old AS2 activities (build by a second party - now not operating/contactable) into a new AS3 menu system.
    Most of them I've managed to port across and embed without issue. Unfortunately embedding the drag and drop activity is proving to be, for want of a better phrase, a complete drag.
    I've managed to decompile the code, so have put a few trace statements in to find out what might be going wrong. Looking in the collision detection part of the code, the problem appears to be that when the activity is embedded, although the index of the drag clip is returned fine with its corresponding index number, the index of the drop clip is returned as 'undefined'.
    The activity works fine in a standalone flash player, with both indexes returning their respective numbers. However not so when it's embedded.
    I'm guessing that this is a levels issue, but is there any easy way that I can force the AS2 drag and drop game to act as self-contained and ignore its parent holding clip?
    Thanks in advance

    Hi kglad,
    Thanks for replying (you've helped me out before :-)  )
    A search of the classes reveals only one mention of getDepth() on a text field, which is irrelevant at the mo (as the engine's just creating image drag and drops)
    The main activity stage is created by an EngineClass (which drives all the activities I've been adapting, but wasn't a problem with less layer critical ones).
    There are three lines I can see where the activity stage is created using 'getNextHighestDepth()'
    this.mWhere.createEmptyMovieClip("activity_mc", this.mWhere.getNextHighestDepth());
    this.mWhere.createEmptyMovieClip("activityMask_mc", this.mWhere.getNextHighestDepth());
    this.mWhere.createEmptyMovieClip("toolbars_mc", this.mWhere.getNextHighestDepth());
    All the drags and drops are then created within this activity_mc. When I run the activity as standalone (where it works), and drag an item onto a drop zone, the traces I set up on the Drag and Drop items report back the following:
    DragObject: _level0.activity_mc.container_mc.dropItem2.dropSkin.greyBorder.whiteBG
    DropArea: _level0.activity_mc.container_mc.dropItem2.dropSkin.greyBorder
    When I run it embedded in the AS2 wrapper it then fires back the following after an attempted drop:
    DragObject: undefined
    DropArea: undefined
    ...and the item refuses to drop on the dropzone, returning to where it came from.
    The tiny amount of knowledge I have makes me (probably mistakenly) assume that if I could place the activity_mc layer on root, then everything would be contained within the embedded clip and the layering wouldn't go so wonky. But in reality I've got no idea! To make matters worse, the original drag and drop activity is itself inside another as2 wrapper which contains some navigation buttons...

Maybe you are looking for

  • Transparecy rxvt [SOLVED]

    Hello. I have followed this from Arch wiki: Urxvt in the background With Openbox, running a terminal as desktop background is easy. You won't need devilspie here. First you must enable transparency, open your .Xdefaults file (if it doesn't exist yet,

  • Can't find backup in my docouments folder or anywhere for that matter.

    Desktop manager tells me it's backing up as an .ipd file to my documents folder, but when I look for it it isn't there. Then I did a search with Windows and it doesn't find the most recent one either. Some others are there. What is a loader backup(da

  • HT1349 i've been listening to a podcast but the pause button disappeared, how do i get it back?

    I've been listening to a podcast on my computer but the pause button disappeared, how do i get it back?

  • Reciever determiantion not found

    Hi We installed PI 7.3 but not able to find receiver determination,interface determination and sender and receiver agreements. but integrated configuration is present I think only AAE is installed and IE is missing . Please let me know how to check t

  • InDesign not saving certain files

    Any idea how to solve the following issues? I have 6 versions of a 32pp A5 InDesign document, each one a different language. Working on them all yesterday. 4 worked fine, and saved all the work done on them. 2 appeared to be working most of the day,