I'm kinda new to this whole Flash/Actionscript 3 scene. I'm remaking one of my games in Flash so that people can play it on my website/blog (which doesn't exist :P). Anyway, I've got this shape I need to draw (the anaconda's head), and it's going to rotate so that it's always pointing towards the user's mouse. I created a Shape called head that I planned to simply rotate so that it would face user's mouse, but when I rotate it, Flash decides to rasterize it and cache it as a bitmap. If I don't rotate it, it draws as a vector image, but if I ever assign to the rotation member (even if it's just 0), it gets converted to a bitmap image.
The code
package
{
import flash.display.Sprite;
import flash.display.Shape;
import flash.events.Event;
public class Anaconda extends Sprite
{
private var head:Shape = new Shape();
public function Anaconda()
{
head.y = 30;
//head.rotationZ = 0;
head.graphics.lineStyle(1, 0xffffff);
head.graphics.moveTo( 0, -7);
head.graphics.lineTo( 8, -10);
head.graphics.lineTo(18, -6);
head.graphics.lineTo(20, -4);
head.graphics.lineTo(20, 4);
head.graphics.lineTo(18, 6);
head.graphics.lineTo( 8, 10);
head.graphics.lineTo( 0, 7);
head.cacheAsBitmap = false;
// I've added this part just for a visual reference
this.graphics.lineStyle(1, 0xffffff);
this.graphics.moveTo( 0, -7);
this.graphics.lineTo( 8, -10);
this.graphics.lineTo(18, -6);
this.graphics.lineTo(20, -4);
this.graphics.lineTo(20, 4);
this.graphics.lineTo(18, 6);
this.graphics.lineTo( 8, 10);
this.graphics.lineTo( 0, 7);
this.addChild(head);
this.x = 100;
this.y = 100;
}
}
}
And here are some images that show the problem. I've zoomed in to 400% so you can clearly see the difference. The head on the top is the one drawn with this.graphics (just for comparison) and the head on the bottom is the one drawn with head.graphics.
With head.rotationZ = 0; commented out
With head.rotationZ = 0; not commented out
![](http://g96una.bay.livefilestore.com/y1p70yRqhC6gVhSfADtjfOkh21gM1ct3v_Gsvrb6NS3Yv0T1Ig6oZNa_pbJlSaBZsBTLTc1E7doV3_HL-DYWh-mcIaXMibb_peH/9-7-2008-1.49.54%20PM6-16-2009-8.51.54%20PM.png)
With some of my current plans, this is unnacceptable for me. I need it to be drawn with vector graphics. Now of course, I could just do the rotation transformation myself and plot the points, but I'd rather not. Is there a way to get the head to always draw as a vector image, even if I'm rotating? I've tried setting head.cacheAsBitmap = false; but that doesn't seem to have any affect; it still renders the head as a bitmap. Thanks in advance!