Skinning Components in Flash CS3
4 12 2007I’ve had an article on component skinning in the works for several months but finally got it done and its now published on the Adobe Developer Center.
The article walks you through the different options for skinning components in the Flash CS3 authoring environment: manually editing the assets, code-based skinning and talks about how you can package up your skinned component as an SWC to easily share it with the rest of your team.
http://www.adobe.com/devnet/flash/articles/skinning_flash_cs3.html
Enjoy!
This work, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.





I read your article on skinning Flash CS3 components and found it very helpful. When I test the movie, it looks great and works well. however, when I try to import the swf with the text scrollbar into another swf file, the scrollbar does not show up at all. In the output window, it shows:
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/fl.controls:BaseButton::drawBackground()
at fl.controls::BaseButton/fl.controls:BaseButton::draw()
at fl.core::UIComponent/drawNow()
at fl.controls::ScrollBar/fl.controls:ScrollBar::draw()
at fl.controls::UIScrollBar/fl.controls:UIScrollBar::draw()
at fl.core::UIComponent/::callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/fl.controls:BaseButton::drawBackground()
at fl.controls::BaseButton/fl.controls:BaseButton::draw()
at fl.core::UIComponent/::callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/fl.controls:BaseButton::drawBackground()
at fl.controls::LabelButton/fl.controls:LabelButton::draw()
at fl.core::UIComponent/::callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/fl.controls:BaseButton::drawBackground()
at fl.controls::BaseButton/fl.controls:BaseButton::draw()
at fl.core::UIComponent/::callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/fl.controls:BaseButton::drawBackground()
at fl.controls::BaseButton/fl.controls:BaseButton::draw()
at fl.core::UIComponent/::callLaterDispatcher()
Clearly, it’s the component that’s causing it. Is there a particular way in which the component needs to be addressed in the codes? I’m using this to load text dynamically:
import fl.controls.UIScrollBar;
var my_sb:UIScrollBar = new UIScrollBar();
my_sb.x = my_txt.x + my_txt.width;
my_sb.y = my_txt.y;
my_sb.height = my_txt.height;
my_sb.scrollTarget = my_txt;
addChild(my_sb);
function loadMyText():void {
var url:String = “assets/text/testHTML.txt”;
var loadIt:URLLoader = new URLLoader();
loadIt.addEventListener(Event.COMPLETE, textCompleteHandler);
loadIt.load(new URLRequest(url));
}
function textCompleteHandler(event:Event):void {
var urlV:URLVariables = new URLVariables(event.currentTarget.data);
//my_txt.condenseWhite = true;
my_txt.htmlText = urlV.content as String;
my_txt.styleSheet = myStyleSheet;
}
var flash_css:URLLoader = new URLLoader();
flash_css.addEventListener(Event.COMPLETE, cssCompleteHandler);
flash_css.load(new URLRequest(”assets/text/brWht.css”));
var myStyleSheet:StyleSheet;
function cssCompleteHandler(event:Event):void {
myStyleSheet = new StyleSheet();
myStyleSheet.parseCSS(event.currentTarget.data);
my_txt.styleSheet = myStyleSheet;
loadMyText();
}
I can’t seem to find the answer anywhere. Can you help?
TIA.