Bug when adding a sprite to 1 <s:State>

Posted by lostincode on Stack Overflow See other posts from Stack Overflow or by lostincode
Published on 2010-04-04T07:30:44Z Indexed on 2010/04/04 7:33 UTC
Read the original article Hit count: 326

I'm working within a skin for a button that has some <s:State> normal over

In the tag, I'm drawing a circle

private var theshape:Sprite;

private function drawShape():void {
   theshape = new Sprite();
   theshape.graphics.beginFill(0x666666);
   theshape.graphics.drawCircle(3,5,10);
   theshape.graphics.endFill();

   //i then add it to a Spite Visual Element that's defined in mxml
   canv.addChild(theshape);
}

This works fine, until I try to control under which states that canv SpriteVisualElement appears. If I just add an includeIn like this

<s:SpriteVisualElement id="canv" includeIn="over" />

I get a run-time error TypeError: Error #1009: Cannot access a property or method of a null object reference.

Any ideas what the problem is, or a different way I can accomplish the same thing. What I need is to simply include the circle in the button when it's in the hover state.

© Stack Overflow or respective owner

Related posts about adobe

Related posts about flex