A Flash Developer Resource Site

Results 1 to 14 of 14

Thread: Registration points/flipping an mc.

  1. #1
    Zombie Coder EvilKris's Avatar
    Join Date
    Jun 2006
    Location
    Fukuoka, Japan.
    Posts
    796

    Registration points/flipping an mc.

    Here's a tricky problem. Tricky to explain without diagrams too.

    I have a main movie clip for a character on the screen.
    Within the mc are several nested mc's that contain the character animations

    If you press the right arrow key, the character walks right. To maintain the correct direction I use the code ob._xscale = -100;
    Same for the left direction. except.ob._xscale = 100;

    The problem is, when you go left, the character flips, but the the mc leaps halfway across the screen in the opposite direction. I know it's because of the mc's being quite large. However, if the main top level registration point is centered, I thought the mc would flip around that point. Apparently not. It's making some kind of composite median registration point from all of the nested mc's and using that as the registration point.

    Then I tried something like hero_mc._x-=hero_mc._x=hero_mc._width/2;
    to center the mc, but all this did was transform the mc somewhere off into nowhere. I'm not sure what else to try. Tried setting some localToGlobal values too, but nothings going right.

    I figure I could probably do a check for last direction against current direction and if they're different then set the x position at an + - offset that is dependant on which direction the mc is going. Seems like a long way to go about things - if only the mc would revolve around a central point it would work fine.

  2. #2
    Senior Member
    Join Date
    Feb 2005
    Posts
    1,834
    The registration is the + sign in the movieclip not the circle. You have to actually edit the movieclip and move all the content in relation to the +.
    .

  3. #3
    Pumpkin Carving 2008 ImprisonedPride's Avatar
    Join Date
    Apr 2006
    Location
    Grand Rapids MI
    Posts
    2,378
    If the character always starts facing right, change the inner movieclips registration points to the middle of the side closest to the characters center registration which is what character flips across when the flip occurs.

    Swak: You can set the registration point when you create the movieclip, so if kris can and it's not too big of a problem, re-creating the movie clips may help.
    The 'Boose':
    ASUS Sabertooth P67 TUF
    Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
    8GB G.Skill Ripjaws 1600 DDR3
    ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
    New addition: OCZ Vertex 240GB SATA III SSD
    WEI Score: 7.6

  4. #4
    Trainee coder Viza's Avatar
    Join Date
    Sep 2006
    Location
    Melbourne, Down under
    Posts
    513
    Quote Originally Posted by ImprisonedPride
    Swak: You can set the registration point when you create the movieclip, so if kris can and it's not too big of a problem, re-creating the movie clips may help.
    You dont have to re-create the movieclip if you want to change the position of an mc's registration point. You can just move all of its contents, as swak suggested.

  5. #5
    Qwaizang:syntax_entity_ Q__Hybrid's Avatar
    Join Date
    Aug 2005
    Posts
    270
    First of all, I don't know what sort of nesting structure you're using for your movieclips. The structure you should be using is something like this:

    World.Hero.Animations[]

    If this is what you're working with, you need to take all of your nested animations and translate them within the container ("Hero") at startup so that they'll be at the proper position to flip correctly.

    It sounds like your problem is that your nested animations are being moved inside their container rather than their container being moved. Check your motion code to make sure you're translating the container and not the nested animations in all of your directional routines. This would explain the intermittent and unexpected flipping errors.
    Qwai•zang \kwî-'zan\ n [origin unknown] 1 : abstract designer, esp. of complex real-time experiments, c. 21st century

  6. #6
    Pumpkin Carving 2008 ImprisonedPride's Avatar
    Join Date
    Apr 2006
    Location
    Grand Rapids MI
    Posts
    2,378
    Quote Originally Posted by Viza
    You dont have to re-create the movieclip if you want to change the position of an mc's registration point. You can just move all of its contents, as swak suggested.

    Yeah but if your animations are 100 frames long, it would be probably be easier to re-create the frames. Meh, at least in my brain it would.
    The 'Boose':
    ASUS Sabertooth P67 TUF
    Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
    8GB G.Skill Ripjaws 1600 DDR3
    ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
    New addition: OCZ Vertex 240GB SATA III SSD
    WEI Score: 7.6

  7. #7
    Senior Member
    Join Date
    Feb 2005
    Posts
    1,834
    There's a button you can press to manipulate them all at once.
    .

  8. #8
    Script kiddie VENGEANCE MX's Avatar
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,590
    IP, that's what the 'Edit Multiple Frames' button is for.
    http://www.birchlabs.co.uk/
    You know you want to.

  9. #9
    Zombie Coder EvilKris's Avatar
    Join Date
    Jun 2006
    Location
    Fukuoka, Japan.
    Posts
    796
    Aggh.. This is going in my Top-Ten-Stupidest-Questions-I've-Asked-on-FlashKit list.

    Of course, all I had to do was align the nested clips to the center. Jesus. Duh.

  10. #10
    Now tell me whos watchin...... samvillian's Avatar
    Join Date
    Feb 2007
    Location
    Where do you live?
    Posts
    539
    you would probably have to extend that list later on. After you find the solution, everything seems like a stupid question.... ive asked alot already, and now i just search google, to make myself look less nubby here lol.

  11. #11
    Pumpkin Carving 2008 ImprisonedPride's Avatar
    Join Date
    Apr 2006
    Location
    Grand Rapids MI
    Posts
    2,378
    Quote Originally Posted by VENGEANCE MX
    IP, that's what the 'Edit Multiple Frames' button is for.
    Hmmm.... I've heard nor seen of any such thing... probably could've saved me years of remaking animations.
    The 'Boose':
    ASUS Sabertooth P67 TUF
    Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
    8GB G.Skill Ripjaws 1600 DDR3
    ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
    New addition: OCZ Vertex 240GB SATA III SSD
    WEI Score: 7.6

  12. #12
    Senior Member
    Join Date
    Feb 2005
    Posts
    1,834
    Quote Originally Posted by ImprisonedPride
    Hmmm.... I've heard nor seen of any such thing... probably could've saved me years of remaking animations.
    do you know which button it is? Try pressing each button under the timeline.
    .

  13. #13
    Pumpkin Carving 2008 ImprisonedPride's Avatar
    Join Date
    Apr 2006
    Location
    Grand Rapids MI
    Posts
    2,378
    Oh THAT lol. Yeah... I'm stupid... was thinking something else. With finals coming up, my brain is fired...
    The 'Boose':
    ASUS Sabertooth P67 TUF
    Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
    8GB G.Skill Ripjaws 1600 DDR3
    ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
    New addition: OCZ Vertex 240GB SATA III SSD
    WEI Score: 7.6

  14. #14
    Senior Member
    Join Date
    Feb 2005
    Posts
    1,834
    You should get one of those hats that you can juice a lemon to help you concentrate. fired? or fried
    .

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