A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: my shape won't show

  1. #1
    Senior Member
    Join Date
    Jul 2001
    Location
    Planet Earth
    Posts
    298

    Unhappy my shape won't show

    background info...I have been creating my assets in the flash library for the interfaces i have built and just linking them. But now I want to draw the shape I need via code. So I started with a very basic "row" class, or so I thought. Here she is:
    Code:
    package classes
    {
    	import flash.display.Sprite;
    	import flash.display.Shape;
    	import flash.display.Graphics;
    	
    	/**
    	 * ...
    	 * @author Ray Brown
    	 */
    	public class  aRow extends Sprite
    	{
    		public function aRow(w:Number = 615, h:Number = 15)
    		{
    			var rowSprite:Sprite = new Sprite();
    			var row:Shape = new Shape();
    			row.graphics.beginFill(0xFF0000, 1);
    			row.graphics.lineStyle(1, 0xCCCCCC, 1);
    			row.graphics.drawRect(0, 0, w, h);
    			row.graphics.endFill();
    			rowSprite.addChild(row);
    			addChild(rowSprite);
    		}
    	}
    	
    }
    This in my main class file, import the class:
    Code:
    import classes.aRow;
    So I thought, to make it show, all I had to do is:
    Code:
    var oneRow:aRow = new aRow();
    BUT, I get no errors, and NO SHAPE? What I do wrong?
    ---
    Thinking outside of the box will get you fired if the "box" is strict budget.

  2. #2
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    addChild(oneRow);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center