« June 2007 | Main | January 2008 »

July 2007 Archives

July 5, 2007

Using mx_internal namespace

When extending Flex's built-in components, you might need to use 'mx_internal' namespace, to call the methods in the super class which are declared with 'mx_internal' namespace.

There are two ways to do this.

1. Import mx.core.mx_intertnal class and add 'use namespace mx_internal;' script just below your 'import' statements.
2. Otherwise, you can explicitly call the method by prefixing 'mx_internal::' before the method.

Happy coding!

Assigning a default style for your custom styles

I was wondering how to assign a default style to my custom style property while developing a custom component. After some search in the Flex Help, I found this solution:

private static var classConstructed:Boolean = classConstruct();

private static function classConstruct():Boolean
{
if (!StyleManager.getStyleDeclaration("titleBackgroundSkin"))
{
// If there is no CSS definition for StyledRectangle,
// then create one and set the default value.
var newStyleDeclaration:CSSStyleDeclaration = new CSSStyleDeclaration();
newStyleDeclaration.setStyle("titleBackgroundSkin", mx.skins.halo.TitleBackground);
StyleManager.setStyleDeclaration("Chat", newStyleDeclaration, true);
}
return true;
}

This might result '1000: Ambiguous reference to setStyle' error, if you are using mx_internal namespace to call the methods declared with 'mx_internal' namespace. To solve that, try calling the method, by explicitly prefixing 'mx_internal::' before the method. Refer my previous post for more information.

About July 2007

This page contains all entries posted to Subbu in July 2007. They are listed from oldest to newest.

June 2007 is the previous archive.

January 2008 is the next archive.

Many more can be found on the main index page or by looking through the archives.

Creative Commons License
This weblog is licensed under a Creative Commons License.
Powered by
Movable Type 3.34