2 Replies Latest reply on Feb 7, 2007 8:22 AM by RoCKSTaH226

    calling a function

    RoCKSTaH226
      Hey guys... I'm not exactly the best programmer (as you can probably tell by this post haha). I got this code for a liquid GUI and it works great. Only problem is it doesn't happen when the movie first loads, only if the movie is resized. Normally I'd be able to figure this kinda thing out through some trial and error, but I haven't been able to get it.

      I'll include the code here... what I'm trying to do is call the same "myListener" function that resizes these movie clips with an onLoad function in addition to the onResize one that occurs here.... any help would be appreciated.

      Stage.scaleMode = "noScale";
      Stage.align = "TL";
      var myListener:Object = new Object();
      myListener.onResize = function (e:Object):Void {
      var sw:Number = Stage.width;
      var sh:Number = Stage.height;
      body_mc._width = sw;
      body_mc._height = sh;
      bg_mc._height = (sh*.8);
      bg_mc._width = (bg_mc._height*1.44);
      bg_mc._x = (sw-bg_mc._width)/2;
      bg_mc._y = (sh-bg_mc._height)/2;
      header_mc._height = (bg_mc._height*.2);
      header_mc._width = (bg_mc._width*.965);
      header_mc._x = (sw-header_mc._width)/2;
      header_mc._y = (bg_mc._y*1.23);
      nav_mc._height = (bg_mc._height*.05);
      nav_mc._width = (bg_mc._width*.965);
      nav_mc._x = (sw-nav_mc._width)/2;
      nav_mc._y = (bg_mc._y*3.1);
      shadow_mc._height = (bg_mc._height*.21);
      shadow_mc._width = (bg_mc._width*1.01);
      shadow_mc._x = (sw-shadow_mc._width)/2;
      shadow_mc._y = (bg_mc._y*8);
      footer_mc._height = (bg_mc._height*.035);
      footer_mc._width = (bg_mc._width*.965);
      footer_mc._x = (sw-footer_mc._width)/2;
      footer_mc._y = (bg_mc._y*8.7);
      screen_mc._height = (bg_mc._height*.625);
      screen_mc._width = (bg_mc._width*.965);
      screen_mc._x = (sw-screen_mc._width)/2;
      screen_mc._y = (bg_mc._y*3.6);
      };
      Stage.addListener(myListener);
        • 1. Re: calling a function
          kglad Adobe Community Professional & MVP
          try:

          • 2. Re: calling a function
            RoCKSTaH226 Level 1
            Close but not quite. I tried copying in your code, and found it made some of the elements disappear, but I couldn't figure out why... I moved the disappearing elements off of the same frame as this code and they re-appeared... went to test it in a web environment, and only the background (the only element in that first frame) resized upon load everything else remained small... so I tried putting an instance of each element in the first frame so that the onLoad function would work with them too, however then most of the elements would disappear as well... the only two that worked were body_mc and footer_mc... is there a problem somewhere in my code? I can't for the life of me figure out why only these 2 movie clips would show up and others wouldn't.... also the footer_mc was resized upon load so I know the resize is working, but the elements won't appear... any more ideas?