2 Replies Latest reply on May 17, 2007 9:16 PM by eljefeloco101

    stretching image to size of browser using BitmapData class and dawing api

    eljefeloco101 Level 1
      Ive been working from a great tutorial found at http://www.gotoandlearn.com/download.php on creating full browser flash. It uses the BitmapData class and drawing api to attach an image to the stage and have the image tile when the browser window is resized. The problem is that I want my image to stretch to fit the browser window instead of tile.

      I've looked into alternatives on attaching my image to a movieclip and having the mc resize, but thats no good since I'm using the drawing api to draw other elements on the background. The movieclip then covers those other elements.

      Any ideas?

      import flash.display.BitmapData;

      var bgImage:BitmapData = BitmapData.loadBitmap("bgImage");

      function fillBG() {
      this.beginBitmapFill(bgImage);
      this.moveTo (0,0);
      this.lineTo (Stage.width,0);
      this.lineTo (Stage.width, Stage.height);
      this.lineTo (0, Stage.height);
      this.lineTo (0,0);
      this.endFill ();

      }

      fillBG();

      var stageListen:Object = new Object();
      stageListen.onResize = function() {
      fillBG();
      }

      Stage.addListener(stageListen);