简体   繁体   中英

Flex3: Force Resizing of TitleWindow Component

I need some help forcing Flex3 to resize my TitleWindow component after an event.

My resize MXML looks like this:

<mx:Resize  id="rs1" duration="1000" 
            heightTo="{radioVBox.y + radioVBox.height + 110}"  />

How do I force it to resize after an event? I want to force the TitleWindow's height to change after the event in myFunc1 ends.

private function myFunc1():void {
 //blah blah...
 fe.addEventListener(FLASHEFFEvents.TRANSITION_END, myFunc2);
}

private function myFunc2():void {
 //force the titleWindow's height to be resized-- call rs1
}

Any suggestions?

Thank you.

-Laxmidi

I think it rather simple. For example we have a custom window and want it resizes on button click:

<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow height="300" layout="absolute" width="400" xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
    <![CDATA[
        import mx.events.EffectEvent;

        protected function clickHandler():void
        {
            windowResize.play();
        }

        protected function windowResize_effectEndHandler(event:EffectEvent):void
        {
            trace("Effect ended");
        }
    ]]>
    </mx:Script>

    <mx:Resize duration="1000" effectEnd="windowResize_effectEndHandler(event)" heightTo="200" id="windowResize"
        target="{this}" />

    <mx:Button click="clickHandler()" horizontalCenter="0" label="Resize" verticalCenter="0" />
</mx:TitleWindow>

You need to specify a target in your Resize tag for it to work, or specify the target when you call the resize.

<mx:Resize  id="rs1" duration="1000" target="{yourTitleWindow}" heightTo="{radioVBox.y + radioVBox.height + 110}"  />

rs1.play()

Personally, I don't like the Flex effect tags so I use TweenMax instead. In that case you'd just need to do this:

private function myFunc2():void 
{
   TweenMax.to(yourTitleWindow, 1, {height:radioVBox.y + radioVBox.height + 110});
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM