dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Can't do the math :-((

  1. #1
    Registered User
    Join Date
    Jul 2011
    Posts
    2

    Question Can't do the math :-((

    Hi!

    I have a problem, I cant figure out how to solve the following...

    I have a container (CONTAINER_MC), containing one or more containers(CONTAINER_01_MC) that is rotated arbitrary. Inside these containers I have one or more MC's (MC_01, MC02...)

    I want to acheive the effect of zooming and centering in on MC_01, MC_02 ect.
    I'm scaling and rotating CONTAINER_MC to get this effect, I figured out how to calulate the rotation and scale.
    But I am having difficulties calculating the X and Y position of CONTAINER_MC.

    var scale:Number = stage.stageHeight/MC_01.height;
    var rotation:Number =CONTAINER_01_MC.parent.rotation*-1;

    But I cant figure how to calculate the new X and Y for CONTAINER_MC the ensures that MC_01 is centered on stage.

    I made a illustration to ******** the problem...


    Hope someone can help me......

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Use localToGlobal and globalToLocal to translate points in individual object coordinate spaces to stage space.

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