A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Help with AS(dynamic layout)

  1. #1
    Senior Member
    Join Date
    May 2001
    Posts
    140

    Help with AS(dynamic layout)

    Hi all
    I am having headache with it!!! :-(

    I am trying to create a flash site that automatically adjust the position
    and size when browser is resized.

    My problem:
    on frame 1
    The below code fails when tested in browser but works in Flash test mode.

    preloader case

    If I use preloader on frame 1 and apply the code on frame 2, then it fails again.

    The Code:

    code:
    fscommand("fullscreen", "true");
    fscommand("showMenu", "false");
    Stage.scaleMode = "noScale";
    Stage.align = "LT";

    // create a listener object
    stageListener = new Object();
    stageListener.onResize = function() {
    expandTop();
    //expandBodyText();
    }

    Stage.addListener(stageListener);

    expandTop = function() {
    Background_mc._width = Stage.width;
    Background_mc._height = Stage.height;
    logoClip._x = 0;
    Main_navigation._x = 0;
    colorTab_mc._x = Stage.width - colorTab_mc._width;
    content._x = (Stage.width - this.content._width) / 2;
    content._y = (Stage.height - this.content._height) / 2;
    }



    Could somebody tell me why it`s behaving so bad???

    the fla file

  2. #2
    Senile member! :)
    Join Date
    Dec 2001
    Location
    Saunaswamp (transl)
    Posts
    2,296
    Well I'm not sure if this is it but sometimes it's necessary to call the onResize event manually in the first or second frame of the movie as I think the onResize event might have fired before the listener is set.

    /Mirandir

  3. #3
    Senior Member
    Join Date
    May 2001
    Posts
    140
    what do you suggest??

    thanks

  4. #4
    Senile member! :)
    Join Date
    Dec 2001
    Location
    Saunaswamp (transl)
    Posts
    2,296
    try to add this in the end of the script on first frame(or maybe in the scond frame) of the movie:

    Code:
    expandTop();
    /Mirandir

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