Search code examples
flashactionscript-3cs4

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 makes 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? enter image description here

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;


        }

Solution

  • 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.