AS3 Draw a Dot at 0,0 to Show the Centre Of a DisplayObject


/ Published in: ActionScript 3
Save to your folder(s)

A handy little function to dynamically draw a black dot on the stage (or displayObject). This can be useful if you want to see where 0,0 is located.


Copy this code and paste it in your HTML
  1. private function showCentre($doc:DisplayObjectContainer = null, $colour:uint = 0x000000, $radius:Number = 2):void
  2. {
  3. var dot:Shape = new Shape();
  4. dot.graphics.beginFill($colour);
  5. dot.graphics.drawCircle(0, 0, $radius);
  6. dot.graphics.endFill();
  7. $doc.addChild(dot);
  8. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.