A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: localToGlobal and nested movieclips question

  1. #1
    Member
    Join Date
    Jun 2006
    Location
    Croatia
    Posts
    90

    Question localToGlobal and nested movieclips question

    Hi,

    Let's say i have a 3 movieclips which are nested one in other like this:

    A-> B-> C

    And i would like to find out C movie clip (which is in B mc and B mc is in A mc) coordinates relative to global stage, how can i accomplish that?

    Thanks in advance,
    Best regards

  2. #2
    rabid_Delineator AttackRabbit's Avatar
    Join Date
    Dec 2003
    Location
    Orlando, Florida
    Posts
    481
    var convertPoint:Point = new Point(c.x, c.y);
    c.localToGlobal(convertPoint);

  3. #3
    Member
    Join Date
    Jun 2006
    Location
    Croatia
    Posts
    90
    I complicated things a "bit" the thing is i have a Main class in which i add another let's say ClassA in which i add another let's say ClassB. All theese classes extend Sprite class. Now, i am in a ClassB code in which i try to position ExampleMc movie clip so in ClassB i have the following line:
    Code:
    addChild(ExampleMc):
    And now i am trying to position ExampleMc:

    Code:
    ExampleMc.x =
    ExampleMc.y =
    but relative to global stage coordinates. What is the right way to do that?

    Thanks,
    Best regards

  4. #4
    rabid_Delineator AttackRabbit's Avatar
    Join Date
    Dec 2003
    Location
    Orlando, Florida
    Posts
    481
    I mean , i don't know if there is a right or wrong way to doing that , and i'm almost certain I have no idea what you are doing. The above method is what adobe recommends doing , so I am in agreement with that. In your case since you have so many things all over , in many different scopes , i would try to localize all their values , in one place. Like write a position manager class , that does nothing more then create arrays of different objects at different scopes within your app , and keep track of their global positions.

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