A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [RESOLVED] This is not doing anything.. lol

  1. #1
    Senior Member
    Join Date
    Aug 2001
    Posts
    227

    [RESOLVED] This is not doing anything.. lol

    Code:
    package AS.Geo
    {
    	import flash.display.Shape;
    	import flash.display.MovieClip;
    	public class Square extends MovieClip
    	{
    		private var xVal:int;
    		private var yVal:int;
    		private var wVal:int;
    		private var hVal:int;
    		private var colorVal:uint;
    		private var shapeObj:Shape;
    		function Square(XValue:int, YValue:int, Width:int, Height:int, hexColor:uint)
    		{
    			this.xVal = XValue;
    			this.yVal = YValue;
    			this.wVal = Width;
    			this.hVal = Height;
    			this.colorVal = hexColor;
    			this.drawSquare();
    		}
    		private function drawSquare():void
    		{
    			this.xVal = 0;
    			this.yVal = 0;
    			this.hVal = 200;
    			this.wVal = 200;
    			
    			this.shapeObj = new Shape();
    			this.shapeObj.graphics.lineStyle(0, 0x0000FF, 1);
    			this.shapeObj.graphics.beginFill(0x000000, .5);
    			this.shapeObj.graphics.drawRect(0, 0, this.wVal, this.hVal);
    			this.shapeObj.graphics.endFill();
    			addChild(this.shapeObj);
    			this.shapeObj.x = this.xVal;
    			this.shapeObj.y = this.yVal;
    		}
    	}
    }
    This is simply not doing anything.. Drawing atleast..
    No errors.. and i am following a tutorial which i believe everything is the exact same.

    Note that just to keep sure control of it all, i reassigned all the x,y,w,h values just to not make me jump around to different files to make sure the class is giving the correct values.. if that makes any sense.


    *edited for crappy title lol*
    Last edited by Zeusbwr; 09-11-2006 at 12:16 AM.

  2. #2
    Senior Member
    Join Date
    Aug 2001
    Posts
    227
    the problem simply was my incorrect use of addChild (which i suspected). I was confused because in the examples i saw, it was the main class and hence had immediate access to the root. Whereas, this remote class does not. So i had to feed it a reference to the root clip (or i should say the desired movieclip)

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