I was under a bit of time pressure and trying to stop dragging of a TitleWindow PopUp. I tried all sorts of funky stuff like intercepting the onMouseDown Event and using Event.stopImmediatePropogation() to no avail. I also wanted access to the titleBar exclusively so here is an extended TitleWindow which enables both my requirements and stops the dragging of a TitleWindow.
Actionscript:
-
package com.newtriks.view.components.utils
-
{
-
import flash.events.MouseEvent;
-
import mx.containers.TitleWindow;
-
import mx.core.IUIComponent;
-
import mx.core.UIComponent;
-
-
public class PopUpTitle extends TitleWindow
-
{
-
public function PopUpTitle()
-
{
-
super();
-
}
-
-
override protected function startDragging( event:MouseEvent ):void
-
{
-
}
-
-
override protected function updateDisplayList( unscaledWidth:Number, unscaledHeight:Number ):void
-
{
-
super.updateDisplayList( unscaledWidth, unscaledHeight );
-
if ( numChildren )
-
{
-
var child:IUIComponent = IUIComponent( getChildAt(0) );
-
child.setActualSize( unscaledWidth, child.getExplicitOrMeasuredHeight() );
-
}
-
}
-
-
public function getTitleBar():UIComponent
-
{
-
return super.titleBar;
-
}
-
}
-
}


4 Comments
A simpler solution would be to set the "isPopUp" property to true for the TitleWindow.
i.e. On the TitleWindow component call the following function with the creationComplete event:
...
private function init():void{
this.isPopUp = true;
}
Thanks for the comment, but isPopUp = true won't stop the TitleWindow from dragging!
Whoops, sorry for the mistake - you have to set isPopUp to FALSE to stop dragging
i.e. On the TitleWindow component call the following function with the creationComplete event:
...
private function init():void{
this.isPopUp = false;
}
Yeh a few ways to skin a cat indeed, what you where trying to explain can be seen fully by the fantastic resource known to many Flex Examples - Peter deHaan!