MX04 X and Y of a nested Rotated Clip
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: X and Y of a nested Rotated Clip

  1. #1
    Member Manic_Man's Avatar
    Join Date
    Dec 2007
    Location
    Hastings, England
    Posts
    73

    X and Y of a nested Rotated Clip

    I need to 'lock on' one Movieclip to a fixed point on another. BUT the other is inside of another clip that can be rotated. When the clip is rotated, the X and Y of the clip inside the rotated clip isn't changing so Local to Global or anything like that doesn't want to work. I've tried some basic Trig to workout where the point is but My math skills don't seam to be up to it.. Basiclly, lets refer to the lock-on clip as 'Lock', the rotating clip as 'Target' and the clip inside that which I need to lock onto 'TargetPoint', so we have _root.Lock, _root.Target and _root.Target.TargetPoint

    Any ideas?

  2. #2
    :
    Join Date
    Dec 2002
    Posts
    3,513
    Code:
    Target.onMouseDown = function() {
            Target.onEnterFrame = function() {
                    Target._rotation++;
                    upDate();
            };
            onMouseUp = function () {
                    Target.onEnterFrame = null;
            };
    };
    function upDate() {
            var myPoint = {x:Target.TargetPoint._x, y:Target.TargetPoint._y};
            Target.localToGlobal(myPoint);
            Lock._x = myPoint.x;
            Lock._y = myPoint.y;
    }

  3. #3
    Member Manic_Man's Avatar
    Join Date
    Dec 2007
    Location
    Hastings, England
    Posts
    73
    stupid question but have you tried that and have it work? as I said, when the parent clip is rotated, the X and Y doesn't change for the internal clip, of course, and localtoglobal didn't take rotation into account..

    I'll try it again but i'm not sure.. if it works, thanks

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

Poll by Flashkit.com