3 Replies Latest reply on Jan 15, 2007 1:40 AM by Duckyofdoom.com

    Stage doesn't listen to code

      Hi Everyone,
      Can anyone help me with this problem I'm having?
      I put this code on frame 1 of fist layer, on 2nd layer frame one, an empty movie clip named main.
      The code reads:
      loadMovie("main.swf", main);
      Stage.scaleMode = "noScale";
      Stage.align = "TL";
      var stageListener = new Object();
      stageListener.onResize = function (){
      main._x = (Stage.width - 748.5)/2;
      main._y = (Stage.height - 462)/2;

      But main wouldn't position itself. Basically I want main to position in the center of the stage, no matter the stage's size.
      Help please....:(
        • 1. Re: Stage doesn't listen to code
          huiyan Level 1
          Sorry everyone,
          What I want is for the content to position itself immediately even before I resize the stage. Is it possible?
          • 2. Re: Stage doesn't listen to code
            Where did the main get placed?
            • 3. Re: Stage doesn't listen to code
              Duckyofdoom.com Level 1
              Okay taking a second to hypothesize about the problem, you which to have an object drawn on stage at a specific point, and wish the object to stay there when you set the Stage.scaleMode = "noScale"; function.

              Having run into this exact problem today, I can tell you don't have to make a function for it. scaleMode allows the file to be resized, but the stage still thinks it's the same high and width.

              To verify trace Stage.width and Stage.height as you resize it.

              Or simply modify your code to read:

              main._x = 748.5/2;
              main._y = 462/2;

              This makes since, because if the value of the stage width and height changed it would create all sorts of messiness. It saves flash programmers like us lot's of headaches figuring out how to position objects in a constantly changing environment.

              Though their not exactly clear on that, so we try to do it anyway.

              Never the less hope this helps.