flash on resize

Out of context: Reply #2

  • Started
  • Last post
  • 8 Responses
  • PonyBoy0

    Enter response:

    that's all in the flash - by default - your swf will center itself if you go full browser flash and DON'T mess w/the alignment in flash... (Stage.align = "TL, T, TR"; etc... Top Left, Top, Top Right (search your Flash help for Stage.align)....

    ... I usually align all my junk to the top left...

    ... and for the stage resize action... you need to add a listener for the stage...

    ... look up Stage.onResize (I think that's it)... or look up Stage Listener - because that's what you use is a listener...

    it's purty simple once you get the hang of it... all you have to do is come up w/simple equations to place your swf's at exact coordinates...

    ... for instance, if you wanted the instancee 'my_mc' to be 30 px in on the X axis and 30 px FROM THE BOTTOM and you aligned your Stage.align = "TL"... your variables would be:

    my_mcX = 30;
    my_mcY = Stage.height -30;

    if you wanted to center your instance of 'my_mc' (this will depend on the movieClip's alignment itself - if the 'my_mc' instance is aligned to it's top left - then your variables would be:

    my_mcX = (Stage.width/2) + (my_mc._width/2);

    my_mcY = (Stage.height/2) + (my_mc._height/2);

    what both variables do is first find the center of the stage... but because the mc isn't centered but is justified to the top left of itself - you need to compensate for that by finding it's center... which is where you divide the mc in half and add that to your position on stage.

    hope that makes some sense - I can toss you an .fla or two or what I use... w/the stage listener in place etc...

    ... you may want to have someone 'good' at actionscript check it though as I'm sure it can be made much more efficient.

    lemme know if you want it.

    happy flashing!

View thread