A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Center component in movie clip

  1. #1
    Junior Member
    Join Date
    Aug 2001
    Posts
    10

    Center component in movie clip

    I'm try to build a photo gallery using the flash components SlideShowPro and ThumbGrid. I have put ThumbGrid inside a movie clip called thumbs_mc that slides in and out when you mouse over it to show or hide the thumbs. That part is working, but I would like to have the stage and thumbs_mc resize to the browser width with ThumbGrid centered inside thumbs_mc.

    Resize and scaling the stage and movie clips is not a problem, but I can't figure out how to keep ThumbGrid centered inside the containing movie clip. ThumbGrid is a fixed width component, and the only way I can get it to work is to have the mc the same width as the component. Here's the part of the AS that I'm using to control the positioning now:

    Code:
    thumbs_mc.x = (sw/2) - (thumbs_mc.my_tg.width/2);
    thumbs_mc.y = sh-25;
    I hope all that makes sense, and any suggestions would be much appreciated.

  2. #2
    Developing For Dunkets mneil's Avatar
    Join Date
    Mar 2007
    Location
    Lincoln City
    Posts
    2,156
    Well, I'm going to assume that your anchor points for all clips are the top right:

    thumbs_mc.my_tg.x = thumbs_mc.width/2 - thumbs_mc.my_tg.width/2;

    That would set your thumbs mc's my_tg in the center of thumbs_mc assuming that the anchor point is top left, scale mode is no scale and align is top left I think unless I'm not understanding you correctly.
    http://code.mneilsworld.com/
    Text Effects | Bubbles | Dynamic Resize
    4 weeks , 20 papers ... thats 2 dollars .....Caassshhh!

  3. #3
    Junior Member
    Join Date
    Aug 2001
    Posts
    10
    Thanks for your reply. I tried your code, but it didn't work. I'm really new to this, so I'm not exactly sure about anchor points. I have noticed in my testing that the ThumbGrid component acts very different than movie clips. So that may be part of the problem. Here's part of my AS for the resizing if it helps.
    Code:
    stage.scaleMode = StageScaleMode.NO_SCALE;
    stage.align = StageAlign.TOP_LEFT;
    stage.addEventListener(Event.RESIZE, resizeHandler);
    Thanks again for trying to help.

  4. #4
    Developing For Dunkets mneil's Avatar
    Join Date
    Mar 2007
    Location
    Lincoln City
    Posts
    2,156
    That's the part I assumed. Without seeing it I don't have a lot to go off of. It's not a standard flash component and I'm unfamiliar with it. It could be because of the component, the anchor points, the rest of the code, or any number of those.When you click into a clip you see a crosshair on the stage, that's the anchor point. The component on stage should also have a little crosshair when you click on it to show you where the point is. If you can provide an example that would help.
    http://code.mneilsworld.com/
    Text Effects | Bubbles | Dynamic Resize
    4 weeks , 20 papers ... thats 2 dollars .....Caassshhh!

  5. #5
    Junior Member
    Join Date
    Aug 2001
    Posts
    10
    I can't attach my fla because it is bigger than 300KB, but I have uploaded a copy to my server. I'm not sure if it will work if you don't have the components, but maybe it will give you an idea what I'm trying to do. Please remember that I'm a complete noob and have been faking my way through this.

    http://homepage.mac.com/arossphoto/f..._thumbs_v1.fla

    You can also see a working example with sliding thumbs on the right side at the link below. I may just stick with that one, but wanted to try one with the thumbs on the bottom as well.

    http://www.arossphoto.com/2011/toron...ial-interiors/

    Cheers,

    Andrew

  6. #6
    Developing For Dunkets mneil's Avatar
    Join Date
    Mar 2007
    Location
    Lincoln City
    Posts
    2,156
    I tried it last night and it's definitely the component causing problems. It probably has it's own resize listener working. I'll look at it to see if it has any methods to keep it centered or if some property can change the default behavior. Otherwise, you'd have to have the source of the compiled component to get anywhere.
    http://code.mneilsworld.com/
    Text Effects | Bubbles | Dynamic Resize
    4 weeks , 20 papers ... thats 2 dollars .....Caassshhh!

  7. #7
    Junior Member
    Join Date
    Aug 2001
    Posts
    10
    Thanks again for your assistance. If you figure anything out please let me know. I would really love to make ThumbGrid resize dynamically based on the browser width, but on their forums they say it's not possible without some advanced customization. There are a few sites in their examples page that do this, so it must be possible.

    Thanks again.

  8. #8
    Developing For Dunkets mneil's Avatar
    Join Date
    Mar 2007
    Location
    Lincoln City
    Posts
    2,156
    It's definitely something more than I have time to dedicate to to figure out. I'm sure you could extend the component and override their controls but it would take some time not being familiar with it. Otherwise, if they have some documentation (and I'm sure they do, slideshow pro has been around several years) and it tells you what handles the sizing you could use it if it's public or again, extend it and override the methods. Maybe someone else is lurking and knows the answer off the top of their heads!? Good luck.
    http://code.mneilsworld.com/
    Text Effects | Bubbles | Dynamic Resize
    4 weeks , 20 papers ... thats 2 dollars .....Caassshhh!

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