Skip navigation
nik.savtchenko
Currently Being Moderated

► SWF File Elements Shift Upon Resizing Window

May 17, 2012 9:02 PM

Hi,

 

I've created a Flash website. However, when I resize the published SWF (or the preview window within Flash) some of the elements get displaced. How can I create a "wrapper" like in Dreamweaver so that the window can be dragged out to any size and all of the components stay together as they were intended?

 

Here is what I mean:

 

http://i1124.photobucket.com/albums/l567/niksavtchenko/2.jpg

 

http://i1124.photobucket.com/albums/l567/niksavtchenko/1.jpg

 

Thanks,

 

Nik

 
Replies
  • kglad
    72,340 posts
    Jul 21, 2002
    Currently Being Moderated
    May 19, 2012 7:43 AM   in reply to nik.savtchenko

    you can specify your layout in an onResize listener:

     

    var stageListener:Object={};

    stageListener.onResize=function(){

    // position header

    // position content

    // etc

    }

    Stage.addListener(stageListener);

     
    |
    Mark as:
  • kglad
    72,340 posts
    Jul 21, 2002
    Currently Being Moderated
    May 20, 2012 9:59 AM   in reply to nik.savtchenko

    your exact code depends on what you want.  but, for example, if you wanted your header to be centered horizontally and your content to be centered horizontally and vertically, you could use:

     

    var stageListener:Object={};

    stageListener.onResize=function(){

    // position header

    header._x = (Stage.width-header._width)/2;

    // position content

    content._x = (Stage.width-content._width)/2;

    content._y = (Stage.height-content._height)/2;

    }

    Stage.addListener(stageListener);

     

    // and you will probably want to check the stage scaleMode properties.

     
    |
    Mark as:
  • kglad
    72,340 posts
    Jul 21, 2002
    Currently Being Moderated
    May 20, 2012 10:49 PM   in reply to nik.savtchenko

    what error message do you see?

     

    check the flash help files, the Stage class.

     
    |
    Mark as:
  • kglad
    72,340 posts
    Jul 21, 2002
    Currently Being Moderated
    May 21, 2012 7:52 AM   in reply to nik.savtchenko

    are you publishing for as3 or as2?

     
    |
    Mark as:
  • kglad
    72,340 posts
    Jul 21, 2002
    Currently Being Moderated
    May 21, 2012 11:27 AM   in reply to nik.savtchenko

    you're posting in the wrong forum.  the previously suggested code was for as2.

     

    for as3, your code will work.

     
    |
    Mark as:
  • kglad
    72,340 posts
    Jul 21, 2002
    Currently Being Moderated
    May 21, 2012 5:38 PM   in reply to nik.savtchenko

    what do you expect to happen?  you only have a trace() statement in your listener function and it's not clear you know how to find trace output when you open that html file in your browser

     
    |
    Mark as:
  • kglad
    72,340 posts
    Jul 21, 2002
    Currently Being Moderated
    May 21, 2012 10:34 PM   in reply to nik.savtchenko

    ?

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points