A Flash Developer Resource Site

Results 1 to 1 of 1

Thread: AS2 help -- Disable dragging once movieclip reaches designated area?

  1. #1
    Junior Member
    Join Date
    Jan 2009
    Posts
    3

    AS2 help -- Disable dragging once movieclip reaches designated area?

    Hi everyone!

    I'm using Flash 8, AS2. To simplify things, I made an .fla using basic shapes, and have it attached here.

    I have a black circle, that has a purple circle in it. I want to drag and drop the green circle onto the black circle, and have the purple circle immediately be sent to the yellow box.

    My question is:

    Once one of the colored circles is in the black circle, how can I disable the dragging of that circle? Make it immovable until the other colored circle takes its place?

    Here's the actionscript I have already, which addresses everything EXCEPT disabling the mobility:

    PHP Code:
    on(press){
    startDrag(_root.gbutton);

        
    dragging true;
    }

    on (release,releaseOutside) {
    stopDrag();
    dragging false;

            
    if(
    this._x 30 && this._x 70 && this._y 30 && this._y 70)
            {
            
    setProperty(this,_x,58.0)
            
    setProperty(this,_y,54)
                    
                
    dragging=false
    }

    if(
    _parent.pbutton._x == 58.0 && _parent.pbutton._y == 54)
            {
            
    setProperty(_parent.pbutton,_x,420.0)
            
    setProperty(_parent.pbutton,_y,40.0)
            }
            } 
    And I have the same for if I want the purple to take the place of the green.

    Please forgive any clunky script, and thank you so much for your time!
    Attached Files Attached Files
    Last edited by Savivi; 05-12-2009 at 05:25 PM. Reason: Forgot to say what I'm using.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center