AS3 sprite stroke

  • youjustknow
  • Born
  • Born
  • No Avatar
  • Joined: Feb 11, 2010
  • Posts: 1
  • Status: Offline

Post February 11th, 2010, 1:26 pm

I was wanting to do something similar, I had a rectangle created in a class with an event listener checking for a click, when I click the rectangle I wanted it to have a stroke colour added to it.

in the event listener click function i simply added this code.

Code: [ Select ]
var checkArray:Array=new Array ;

        public function containerClass() {

            // Creates the container for the card symbols to be added into

            var cardHolder:Sprite = new Sprite();
            cardHolder.graphics.beginFill(0xFFFFFF);
            cardHolder.graphics.drawRoundRect(0,0,225.061,150.929,15,15);


            this.addChild(cardHolder);
            cardHolder.(don't write whats in the brackets)name="cardHolder";

            //var counts the card clicks

            addEventListener(MouseEvent.CLICK,checker);



            function checker(evt:MouseEvent):void {
                trace(docClass.clicksCounter);
                docClass.clicksCounter++;
                
                /*cardHolder.graphics.clear();*/
                var newCardHolder:Sprite = new Sprite();
                newCardHolder.graphics.lineStyle(3,0xFF0099);
            
            newCardHolder.graphics.drawRoundRect(0,0,225.061,150.929,15,15);


            addChild(newCardHolder);
            newCardHolder.(don't write whats in the brackets)name="newCardHolder";
}
  1. var checkArray:Array=new Array ;
  2.         public function containerClass() {
  3.             // Creates the container for the card symbols to be added into
  4.             var cardHolder:Sprite = new Sprite();
  5.             cardHolder.graphics.beginFill(0xFFFFFF);
  6.             cardHolder.graphics.drawRoundRect(0,0,225.061,150.929,15,15);
  7.             this.addChild(cardHolder);
  8.             cardHolder.(don't write whats in the brackets)name="cardHolder";
  9.             //var counts the card clicks
  10.             addEventListener(MouseEvent.CLICK,checker);
  11.             function checker(evt:MouseEvent):void {
  12.                 trace(docClass.clicksCounter);
  13.                 docClass.clicksCounter++;
  14.                 
  15.                 /*cardHolder.graphics.clear();*/
  16.                 var newCardHolder:Sprite = new Sprite();
  17.                 newCardHolder.graphics.lineStyle(3,0xFF0099);
  18.             
  19.             newCardHolder.graphics.drawRoundRect(0,0,225.061,150.929,15,15);
  20.             addChild(newCardHolder);
  21.             newCardHolder.(don't write whats in the brackets)name="newCardHolder";
  22. }
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post February 11th, 2010, 1:26 pm

Post Information

  • Total Posts in this topic: 16 posts
  • Users browsing this forum: No registered users and 52 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.