开发者

Weird behaviour reading stage.stageHeight when Bandwith Profiler is open

Anyone else has experienced weird behaviors and unexpected values when checking for stage.stageHeight while you have Bandwith Profiler open in Flash IDE?

Say, I have been using this for testing Perlin Noise stuff:

package {

    import flash.display.StageAlign;
    import flash.display.StageScaleMode;

    import flash.display.Sprite;
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.events.Event;
    import flash.geom.Point;

    [SWF(width="550", height="400", backgroundColor="#000000", frameRate="60")]
    public class Clouds extends Sprite {
        private var _bitmap:BitmapData;
        private var _xoffset:int = 0;
        private var _yoffset:int = 0;

        public function Clouds() {
            stage.align = StageAlign.TOP_LEFT;
            stage.scaleMode = StageScaleMode.NO_SCALE;

            trace("stage.stageHeight: "+stage.stageHeight);

            _bitmap = new BitmapData(stage.stageWidth, stage.stageHeight,true, 0xffffffff);
            var image:Bitmap = new Bitmap(_bitmap);
            addChild(image);
            addEventListener(Event.ENTER_FRAME, onEnterFrame);
        }

        public function onEnterFrame(event:Event):void {
            _xoffset = _xoffset + Math.random()*4 -2;
            _yoffset = _yoffset + Math.random()*3;
            var point:Point = new Point(_xoffset, _yoffset);

            _bitmap.perlinNoise(200, 100, 3, 1000, false, true,
                            1, true, [point, point]);
        }
    }
}

As you see here, the swf is set to a height of 400 .. When e开发者_运维知识库xecuted with test movie, control-enter, the trace returns 400 .. now, if you try this with the Bandwidth Profiler open, it would return 300, and the Sprite would only extend to 300 height.

Anyone experiencing the same??


There's nothing weird about that. The stage height you've set is the default one but the stage size might vary if the user, the browser or in this case, FlashIDE resizes the player window (since the UI will proportionally allocate some space for the profiler).

You may want to create your own WIDTH/HEIGHT constants if you need specific base numbers for scaling etc.


Absolutely - As far as i am aware the bug has been fixed in CS4. This bug used to plague me for a long time. The problem only occurs within the testing environment, so you can rest assured that wrapped inside an HTML page this problem disappears.

The only thing i can really suggest is compiling the clip and then opening the bandwidth profiler - or upgrade your flash ide if $ allows it.

You are not alone: http://www.google.com/search?hl=en&q=bandwidth+profiler+bug

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜