Ah, another thing;
There is no need to cast this;
var tg:Number = Number(getStyle("titleGap"));
If the style is not set, it will automajically be NaN that you can test for.
Why do you call super?
super.setStyle("borderSkin", FieldSetBorder);
No need to.
I wouldn't call a layout method from a setter;
title ::
layoutChrome(unscaledWidth, unscaledHeight);
With that property, do this.
public function set title (value:String):void
{
if (value != _title)
{
_title = value;
titleChanged = true;
// text updates first in commitProperties()
invalidateProperties();
// now that you have set text, layoutChrome() will be called
// from this invalidatin
invalidateDisplayList();
}
}
override protected function commitProperties():void
{
super.commitProperties()
if (titleChanged)
{
if (_titleTextField)
_titleTextField.text = _title;
titleChanged = false;
}
}
Peace, Mike
On 5/1/07, Michael Schmalle <[EMAIL PROTECTED]> wrote:
Hi,
Just some advice from a fellow component dev.
protected function setDefaultStyles ():void {
var tg:Number = getStyle("titleGap");
if (!isNaN(tg))
_titleGap = tg;
setStyle("titleGap", _titleGap);
setStyle("borderStyle", "solid");
setStyle("borderSkin", FieldSetBorder);
}
I wouldn't use set style in your class. If some one wants to override that
style in a TypeSelector, they can't
IE
FieldSet {
titleGap:30;
}
Since you already committed it on the instance, it's stuck without calling
setStyle() or clearStyle().
Try creating a static loader when the class is loaded, create the
TypeSelector FieldSet and create a default factory.
IE
/**
* @private
*/
private static var stylesInited:Boolean = initStyles();
/**
* @private
*/
private static function initStyles():Boolean
{
var styles:CSSStyleDeclaration =
StyleManager.getStyleDeclaration(FieldSet');
if (!selector)
{
styles= new CSSStyleDeclaration();
StyleManager.setStyleDeclaration('FieldSet', styles, false);
}
styles.defaultFactory = function():void
{
this.titleGap= 10;
this.borderStyle = "solid";
}
return true;
}
I use a factory class to give me a new selector. Saves you from having to
write it over and over again.
IE
var styles:CSSStyleDeclaration =
FSCollectionDefaults.createSelector("FormItemFX");
Peace, Mike
On 5/1/07, jwopitz < [EMAIL PROTECTED]> wrote:
>
> The source is now up there. You can use SVN to get the latest from
> the repository: *http*://jwopitz- lib.googlecode.com/svn/trunk/
>
> This is the link to view it in your browser:
> http://jwopitz-lib.googlecode.com/svn/
>
> On 5/1/07, Bjorn Schultheiss < [EMAIL PROTECTED]> wrote:
> >
> > Hey jwoptiz,
> >
> > Is it possible to get the source for this component.
> > I've noticed the swc on google code, but i'm more after the source as
> > files.
> >
> > I plan to use it on an existing project and extend it further, with
> > functionality such as drag and drop support.
> >
> >
> > Regards,
> >
> > Bjorn Schultheiss
> > Senior Developer
> >
> > Personalised Communication Power
> >
> > Level 2, 31 Coventry St.
> > South Melbourne 3205,
> > VIC Australia
> >
> > T: +61 3 9674 7400
> > F: +61 3 9645 9160
> > W: http://www.qdc.net.au
> >
> > ((------------This transmission is confidential and intended solely
> > for the person or organization to whom it is addressed. It may contain
> > privileged and confidential information. If you are not the intended
> > recipient, you should not copy, distribute or take any action in reliance on
> > it. If you believe you received this transmission in error, please notify
> > the sender.---------------))
> >
> >
> > http://www.geocitie s.com/jwopitz/portfolio/ tileCanvas/
> > TileCanvasTest. swf
> >
> > Any comments, constructive criticism, etc. are appreciated. It is
> > still a work in progress.
> >
> > I need to work on a few things:
> > - better drag/drop functionality
> > - data accommodations from other components
> >
> > Once I get my code base straightened out, I will post the source as
> > well.
> >
> > Thanks,
> > jwopitz
> >
> > [EMAIL PROTECTED] com <jwopitz%40gmail.com>
> >
> >
> >
> >
> >
>
>
> --
> justin w. opitz
> 617.771.6639
> jwopitz(at)gmail.com
>
>
>
--
Teoti Graphix
http://www.teotigraphix.com
Blog - Flex2Components
http://www.flex2components.com
You can find more by solving the problem then by 'asking the question'.
--
Teoti Graphix
http://www.teotigraphix.com
Blog - Flex2Components
http://www.flex2components.com
You can find more by solving the problem then by 'asking the question'.