I have a strange problem that perhaps someone has also experienced. While using ActionScript 3 and the drawRect() function to create a movie clip on run time, I am experiencing some flickering when trying to use math to determine the position it gets drawn in.
The following code creates a nice, solid rectangle with no issue:
var mc:MovieClip = new MovieClip();
mc.graphics.beginFill(0xFF1230);
mc.graphics.drawRect(mouseX, mouseY, 100, 80);
mc.graphics.endFill();
However, When I begin to try to adjust where the rectangle gets drawn, like this:
mc.graphics.drawRect(mouseX - 50, mouseY - 50, 100, 80);
the rectangle gets drawn but will constantly flicker.
I have tried many variations of the line that gives an error, trying different data types and separating out the math into its own variable, but the same thing happens.
Has anyone experienced anything like this before? Any help or information is much appreciated!