开发者

redraw regions in flash out of canvas?

i am currently building a pond flash application, and it has a water ripple effect , when it is rendered, the water ripple effect is not at my mouse position when in fact my function make开发者_JAVA技巧s it draws on my mouse position. i did a show redraw region on the flash player and attached is the picture.does anyone know how to solve this problem?

redraw regions in flash out of canvas?

addEventListener(MouseEvent.MOUSE_MOVE,onMouseMoveTriggered);
addEventListener(MouseEvent.MOUSE_DOWN, onMouseDownTriggered);
private function onMouseMoveTriggered(e:Event):void {
            if (canPlay)
            {
            waterMovementSound.play();
            canPlay = false;
            soundTimer.start();
            }
            myRippler.drawRipple(stage.mouseX, stage.mouseY, 10, 0.9);

            //evt.stageX
            //evt.stageY
        }
        private function onMouseDownTriggered(e:Event):void {
            myRippler.drawRipple(stage.mouseX,stage.mouseY, 10, 0.9);
            stage.mouseX;
            stage.mouseY;


        }


I would think you need to check that the stage.align is set to topLeft and stage.scaleMode is set to noScale, unless you actually need to have differing setup.

If you've still got issues then this could possibly be because you're drawing inside a nested container (Sprite,DisplayObject,etc) and that is offset. If that's the case you could use globalToLocal to solve the issue of positional problems concerning mouse?


I found a work around to this problem, the effects only move out of place when my fishes are swimming towards a random x,y point near to the canvas max Y and max X, so i reduced the generated random XY values for the fishes to swim to by much lesser than max Y and max X, therefore it wont swim close to the edges.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜