0 Replies Latest reply on Jul 17, 2009 12:10 PM by phet.colorado.edu

    Issue with html publish

    phet.colorado.edu

      Hi all,

       

      I am new to the forum, and could really use experts' advice.  My problem is my flash swfs scaling weirdly in some browsers.  I am using AS3, flash CS3 and CS4. I want the my swf to showall in browser without distortion and fill the screen in the one dimension (either x or y).  In Publish Settings.. HTML, I have selected Dimension:Percent, width: 100%, height: 100%, scale: default(show all).  

       

      My code, the html file, and screenshot of browser are here: http://www.colorado.edu/physics/phet/flash/DubsonTests/AS3Testing/BlockTest/

       

      Open the BlockTest.html and you will see the problem in most browsers. The code puts a symbol (BigBlock) on the main stage and draws a graphic drawing on the main stage.  Both the symbol and the drawing have the *same* dimensions, and both exactly fill the stage (stage size is 800x600).  The trace statement verifies that the symbol and the main stage have the same dimensions.  In the flash player, the swf displays correctly: symbol and drawing are same size (so the symbol almost exactly covers up the drawing, except for a few pixels of the drawing peeking out the right and bottom).  HOWEVER, when viewed in the browser, the symbol and the graphic have very different dimensions: the graphic is way too wide and too short.  The browser sizes to fit the symbol but not the drawing.  See the screenShot in the folder above.

       

      So what is going on here?  Why does the browser scale differently for different displayObjects?  This causes obvious alignment problems.  This problem is driving me nuts, and I would greatly appreciate any help.

       

      Thanks in advance!  Mike Dubson, Physics Dept, U. Colorado at Boulder

       

       

      Here is my code:

       

       

      package{
      import flash.display.*;

      public class BlockTest extends Sprite{
        private var myBigBlock:BigBlock;
        //private var canvas:Sprite;
        public function BlockTest(){
         this.myBigBlock = new BigBlock();
         //this.canvas = new Sprite();
         this.addChild(myBigBlock);
         this.myBigBlock.addChild(this.canvas);
         var W:Number = this.stage.stageWidth;
         var H:Number = this.stage.stageHeight;
         //var W = this.myBigBlock.width;
         //var H = this.myBigBlock.height;
         trace("stageWidth: "+W+"   stageHeight:"+H);
         trace("blockwidth: "+this.myBigBlock.width+"    blockHeight: "+this.myBigBlock.height);
        
         with(this.graphics){
          clear();
          lineStyle(3, 0x000000);
          //beginFill(0xff0000, 1);
          moveTo(0,0);
          lineTo(W,0);
          lineTo(W,H);
          lineTo(0,H);
          lineTo(0,0);
          //endFill();
          moveTo(W/2,0);
          lineTo(W/2,H);
          moveTo(0,H/2);
          lineTo(W,H/2);
         
         }
        }
      }
      }