Skip to Content
0
Former Member
Mar 19, 2010 at 01:47 PM

Problem Extending the Dialog component from Flex

35 Views

I'm trying to extend the flex Dialog component () for usage in Xcelcius, I can package my component successfully and add it to the add-ons in Xcelsius. The problem is that if I try to drag and drop the component to the Xcelsius workspace, the component appears blank and halts the IDE a bit. Does anyone have an idea what I might be doing wrong?

my code is as follows:

package com.component.xcelsius.component
{
	import flash.text.TextFormatAlign;
	
	import mx.containers.TitleWindow;
	import mx.controls.Label;
	import mx.core.ScrollPolicy;
	
	
	
	[CxInspectableList ("title", "showTitle")]
	
	public class ErrorMessageHandler extends TitleWindow
	{
		private var _titleChanged:Boolean = true;
		private var _valueChanged:Boolean = true;
		private var _titleText:String = "My Own";
		private var _showTitle:Boolean = true;
		private var _visible:Boolean = true;
		
		public function ErrorMessageHandler()
		{
			super();
		}
		
		[Inspectable(defaultValue="Title", type="String")]
 		public override function get title():String
		{
			return _titleText;
		} 

		public override function set title(value:String):void
		{
			if (value == null)  value = "";
			
			if (_titleText != value)
			{
				_titleText = value;
				_titleChanged = true;
				invalidateProperties();
			}
		}
		
		override protected function createChildren():void
		{
			super.createChildren();
			
			// Allow the user to make this component very small.
			this.minWidth = 200;
			this.minHeight= 25;
			
			// turn off the scroll bars
			this.horizontalScrollPolicy = ScrollPolicy.OFF;
			this.verticalScrollPolicy = ScrollPolicy.OFF;
			
		}
		
		override protected function commitProperties():void
		{
			super.commitProperties();
			
			if (this._titleChanged)
			{
				this.title = _titleText;
				this.visible = true;
				this.showCloseButton = true;
				invalidateDisplayList();  // invalidate in case the titles require more or less room.
				_titleChanged = false;
			}
			if (this._valueChanged)
			{
				
			}
		}
		
		// Override updateDisplayList() to update the component 
        // based on the style setting.
 		override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
 		{
			super.updateDisplayList(unscaledWidth, unscaledHeight);
		}
	}
}