A Flash Developer Resource Site

Page 3 of 3 FirstFirst 123
Results 41 to 45 of 45

Thread: Cable

  1. #41
    Junior Member
    Join Date
    Jul 2012
    Posts
    22
    It works but its not smooth :S
    Is there a way to trace "connected" when i drag it over socket-outlet without having to release it?

  2. #42
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,202
    set the frame rate higher for smoothness. I always put it at 35 fps

    yeah trace connected by doing a hitTest to it man. You are asking for alot and I dont believe you are learning

  3. #43
    Junior Member
    Join Date
    Jul 2012
    Posts
    22
    Yeah i hitTested it..but it works only when you drop MC not when it touches it...

  4. #44
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,202
    Cause the if statement is only set too trace when onReleased

    just make it trace on startDrag or something...

  5. #45
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    change this code:

    Code:
    plug_mc.onRelease = plug_mc.onReleaseOutside = function(){
        stopDrag();
        this._rotation = 0;
        down = false;
        if(this.hitTest(socket_mc)){
            trace("Connected!");
        } else {
            plug_mc._x = 190
            plug_mc._y = 190
        }
    }
    to this:

    Actionscript Code:
    plug_mc.onRelease = plug_mc.onReleaseOutside = function(){
        stopDrag();
        this._rotation = 0;
        down = false;
    }

    and change this code:

    Code:
    onMouseMove = function(){
        if(down){
            plug_mc._rotation = Math.atan2(b, a)*180/Math.PI;
            a = _root._xmouse - plug_mc._x;
            b = _root._ymouse - plug_mc._y;
        }
    }
    to this:

    Actionscript Code:
    onMouseMove = function(){
        if(down){
            if(plug_mc.hitTest(socket_mc)){
                trace("Connected!");
            }
            plug_mc._rotation = Math.atan2(b, a)*180/Math.PI;
            a = _root._xmouse - plug_mc._x;
            b = _root._ymouse - plug_mc._y;
        }
    }
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

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