Hi Harris,
You can acheive this similar to the following code. The canvas (id="applicationCanvas") is originally set to a percentage-based height and width. When the browser is maximized, you can set the minHeight and minWidth to explicit values. This will replace the percentHeight and percentWidth propertes.
I hope that this helps you,
Tim Hoff
//--------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="initApp()"
resize="lockCanvas();">
<mx:Script>
<![CDATA[
private function initApp():void
{
applicationCanvas.minHeight = applicationCanvas.height;
applicationCanvas.minWidth = applicationCanvas.width;
}
private function lockCanvas() : void
{
if (applicationCanvas.minHeight < applicationCanvas.height)
{
applicationCanvas.minHeight = applicationCanvas.height;
}
if (applicationCanvas.minWidth < applicationCanvas.width)
{
applicationCanvas.minWidth = applicationCanvas.width;
}
}
]]>
</mx:Script>
<mx:Canvas id="applicationCanvas" height="100%" width="100%"/>
</mx:Application>
//--------------------------------------------------------------------------------------------------------
--- In flexcoders@yahoogroups.com, "Harris Reynolds" <[EMAIL PROTECTED]> wrote:
>
>
> What up flex coders.
>
> I'd like to lock the maximum size of a compoent. To do this I have set
> both the width and height properties in the MXML file to 100%. If the
> user then maximizes the browser the component will expand to fill the
> new extra space. This is good.
>
> Here is the rub. After the component reaches its maximum size I'd like
> to lock the size so that if the user then clicks the "Restore Down"
> broswer button to make the window smaller, then the scrollbars will kick
> in and the size stays the same. Does this make sense? Basically I want
> the width and height to be 100% until the browser is maximized, then I
> want that size to be locked.
>
> One solution I thought might work is overriding the updateDisplayList
> function on my customized Canvas component like this:
>
> override protected function updateDisplayList(unscaledWidth:Number,
> unscaledHeight:Number):void
> {
>
> if( unscaledWidth < width || unscaledHeight < height )
> return;
>
> super.updateDisplayList(unscaledWidth, unscaledHeight);
>
> }
>
> This didn't work. Does anyone have any ideas?
>
> thanks,
>
> ~harris
>
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Web site design development | Computer software development | Software design and development |
Macromedia flex | Software development best practice |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.