To get rid of the white contentPane, you need to override the layoutChrome method in your class
AddSubscriptionModal.as. however, there is a catch, the layoutchrome triggres off a whole lot of layouting operations, most of them private to get the Panel work the way it should. Overriding the method typically means, we need to take care of all that on our own now! thats the deal :)

Harish

On 9/18/06, aaron smith <[EMAIL PROTECTED]> wrote:

is there a way to remove the white content area in a titleWindow? i'm experimenting with drawing the UI myself, and when I draw it then add children to it, it adds that white content area, which I don't want. I tried extending canvas and drawing it that way, but then you can't drag the window around..

here is my example code:::

mxml::
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml " layout="horizontal" creationComplete="initApp()">
    <mx:Script>
        import Startup;
       
        private function initApp():void
        {
            var st:Startup = new Startup();
        }
    </mx:Script>
</mx:Application>


Startup.as:::

package
{
   
    import mx.managers.PopUpManager;
    import mx.containers.Canvas;
    import mx.core.Application ;
    import AddSubscriptionModal;
   
    public class Startup
    {   
        public function Startup()
        {
            var cn:Canvas = new Canvas();
            Application.application.addChild ( cn );
            var asm:AddSubscriptionModal = PopUpManager.createPopUp( cn, AddSubscriptionModal, true ) as AddSubscriptionModal;
        }
    }
}


AddSubscriptionModal.as:::

package
{
   
    import mx.managers.PopUpManager;
    import mx.events.CloseEvent;
    import mx.events.FlexEvent;
    import SelfCenteringTitleWindowPopUp;
    import mx.graphics.RectangularDropShadow;
    import flash.display.*;
    import flash.geom.*;
   
    import mx.controls.Button;
   
    public class AddSubscriptionModal extends SelfCenteringTitleWindowPopUp
    {
       
        private var dropShadow:RectangularDropShadow;
       
        public function AddSubscriptionModal()
        {
            doInit();
            addEventListener( CloseEvent.CLOSE, handleCloseModal );
            addEventListener( FlexEvent.CREATION_COMPLETE , haCreationComplete );
        }
       
        private function doInit():void
        {
            title = "test";
            showCloseButton = true;
            width = 350;
            height = 100;
            selfCenter();
        }
       
        override protected function updateDisplayList( unscaledWidth:Number, unscaledHeight:Number ):void
        {
            super.updateDisplayList( unscaledWidth, unscaledHeight );
            graphics.clear();
           
            //background
            var fillType:String = GradientType.LINEAR;
            var colors:Array = [0xFFFBC9, 0xFFFFFF];
            var alphas:Array = [100, 100];
            var ratios:Array = [0x00, 0xFF];
            var matr:Matrix = new Matrix();
            matr.createGradientBox(width, 20, -60, -50, 50);
            var spreadMethod:String = SpreadMethod.PAD;
            this.graphics.beginGradientFill(fillType, colors, alphas, ratios, matr, spreadMethod); 
            this.graphics.drawRect(0,0,width,height);
           
            //shadow
            if (!dropShadow)
                dropShadow = new RectangularDropShadow();
           
            dropShadow.distance = 3;
            dropShadow.angle = 70;
            dropShadow.color = 0;
            dropShadow.alpha = 0.4;
            dropShadow.drawShadow(graphics, 0, 0, unscaledWidth, unscaledHeight);
            selfCenter();
        }
       
        private function haCreationComplete( fe:FlexEvent ):void
        {
            var btn:Button = new Button();
            btn.label = "TEST";
            addChild( btn );
        }
       
        private function handleCloseModal( ce:CloseEvent ):void
        {
            PopUpManager.removePopUp( this );
        }
    }
}


SelfCenteringTitleWindowPopUp.as:::

package
{
   
    import mx.core.Application;
    import mx.containers.TitleWindow;
    import mx.events.FlexEvent;
    import mx.events.ResizeEvent;
   
    /**
    * a class that handles centering itself in the entire application window,
    * does a center when the swf is resized, or when you call <code>selfCenter</code>
    * from one of it's subclassed implementations
    */
    public class SelfCenteringTitleWindowPopUp extends TitleWindow
    {
       
        /**
        * constructor
        */
        public function SelfCenteringTitleWindowPopUp()
        {
            super();
            addEventListener( FlexEvent.CREATION_COMPLETE, handleCreationComplete );
        }
       
        /**
        * when the creation of the TitleWindow is complete, add listener for resize events
        * @param    fe
        */
        protected function handleCreationComplete( fe:FlexEvent ):void
        {
            Application.application.addEventListener( ResizeEvent.RESIZE, selfCenterFromResize );
        }
       
        /**
        * the resize event handler method, uses <code>selfCenter</code>
        * @param    re
        */
        protected function selfCenterFromResize( re:ResizeEvent ):void
        {
            selfCenter();
        }
       
        /**
        * the method that does the centering of this popup
        */
        protected function selfCenter():void
        {
            x = ( Application.application.width - width ) / 2;
            y = ( Application.application.height - height ) / 2;
        }
    }
}




thanks in advance...



__._,_.___

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





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to