cancel
Showing results for 
Search instead for 
Did you mean: 

Problem Extending the Dialog component from Flex

Former Member
0 Kudos

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);
		}
	}
}

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

First of all make sure you compile your Flex project with Flex SDK 2.0.1 Hotfix 3?

In the Add-on Packager carefully check your classname (the full class path + class name) because Xcelsius creates an instance of that class when you drag the add-on onto the canvas, so if it doesn't create anything usually it means your classname is wrong in the packager.

In your case:

com.component.xcelsius.component.ErrorMessageHandler

If none of that works try extending from VBox as the top-level add-on class instead and see if that works (I have never tried with a TitleWindow).

Regards

Matt

Former Member
0 Kudos

Thanks Matt, this fixed my problem

Answers (0)