hi

i need a custom Image Component with borderstyle and borderskin etc.. please
help me in this regard..

Code for Custom ImageComponent

<?xml version="1.0" encoding="utf-8"?>
<mx:Image xmlns:mx="http://www.adobe.com/2006/mxml";
    initialize="init()">
    <mx:Metadata>
        [Style(name="borderColor", type="uint",format="Color",
inherit="no")]
        [Style(name="borderThickness", type="Number",format="Length",
inherit="no")]
        [Style(name="borderAlpha", type="Number",format="Length",
inherit="no")]

//[Style(name="borderStyle",type="String",enumeration="inset,none,outset,solid",inherit="no")]
        //[Style(name="borderSkin",type="Class")]
    </mx:Metadata>
    <mx:Script>
        <![CDATA[
            // initial position
            private var _recalX:Number;
            private var _recalY:Number;

            // initialization
            private function init():void
            {
                // we save the initial position
                _recalX = this.x;
                _recalY = this.y;
            }

            // overriding the update function
             override protected function updateDisplayList(
                 w:Number,h:Number):void
            {
                super.updateDisplayList(w,h);
                // adjust the position
                // calculation based on initial position
                x = _recalX + (getStyle('borderThickness'));
                y = _recalY + (getStyle('borderThickness'));
                // clear graphics
                // we want only one rectangle
                graphics.clear();
                // set line style with with 0 and alpha 0
                graphics.lineStyle(0,getStyle('borderColor'),0,false);
                // draw rectangle
                graphics.beginFill(getStyle('borderColor'),
getStyle('borderAlpha'));

graphics.drawRect(-getStyle('borderThickness'),-getStyle('borderThickness'),

contentWidth+getStyle('borderThickness')*2,contentHeight+getStyle('borderThickness')*2);
                //setting the border Style
                graphics.endFill();
            }
        ]]>
    </mx:Script>
</mx:Image>


-- 
Thanks & Regards
GK

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to