Hi,
 
It is working for me, however it doesn't draw a rectangle instead some other shape.
 
I am using following code along with myClass.as:
 
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns="*" creationComplete="foo.rectangle(100,100)">
 
    <myClass id="foo"/>
 
</mx:Application>
 
 
-abdul



From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Mink, Joseph
Sent: Thursday, September 15, 2005 1:18 AM
To: [email protected]
Subject: [flexcoders] Drawing a rectangle in Flex

Hi,
 
I have the following method in a class that extends mx.containers.Canvas.  Shouldn't this work?  I don't see any of the lines...However, if I remove the "emptyClip" altogether, & just draw directly on the Canvas of the local object, the lines appear.  But I want the rectangle to be an individual child of the myClass Canvas.  Any thoughts on where I'm goning wrong?
 
class myClass extends mx.containers.Canvas
{
 
...
 
/*
  Draws a "hard-cornered" rectangle.
  TODO: Add support for fill color.
 */
 function rectangle (boxWidth:Number, boxHeight:Number):Void
 {
    var L_INDENT = 3;
    var TOP_INDENT = 3;
    var R_INDENT = 2;
    var BOT_INDENT = 2;
 
    var emptyClip = createEmptyMovieClip("rectangleInNode", getNextHighestDepth());
 
       emptyClip.beginFill(0xFFFFFF);  //Currently harcoding a white fill...
       emptyClip.lineStyle (2, 0x000000);
       emptyClip.moveTo(L_INDENT, TOP_INDENT);
       emptyClip.lineTo(width - R_INDENT, TOP_INDENT);
       emptyClip.lineTo(width - R_INDENT, height - BOT_INDENT);
       emptyClip.lineTo(L_INDENT, boxHeight - BOT_INDENT);
       emptyClip.lineTo(L_INDENT, TOP_INDENT);
       emptyClip.endFill();
 }
...
}


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to