Piccolo trucco per legare uno skin ad un componente di Flex

Flex oscar Commenta l'articolo

Piccolo trucco per legare uno skin ad un componente di Flex senza che venga restituito il seguente errore:

TypeError: Error #2007: Parameter child must be non-null.
 at flash.display::DisplayObjectContainer/addChildAt()
 at fl.controls::BaseButton/drawBackground()
 at fl.controls::BaseButton/draw()
 at fl.core::UIComponent/drawNow()
 at fl.controls::ScrollBar/draw()
 at fl.core::UIComponent/callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
 at flash.display::DisplayObjectContainer/addChildAt()
 at fl.controls::BaseButton/drawBackground()
 at 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/drawBackground()
 at 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/drawBackground()
 at 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/drawBackground()
 at fl.controls::BaseButton/draw()
 at fl.core::UIComponent/callLaterDispatcher()

Rendere non abilitato e invisibile il componente:

 var btn:Button = new Button();
 btn.setStyle( "upSkin", new Button_upSkin());
 btn.enabled = false;
 btn.visible = false;
 addChild( btn );

Questo permette di resettare lo skin.

Scrivi un Commento

Home | Graffiti e Disegni | Educazione | Chi siamo | Blog | Progetti | Contatti
RSS Feed Comments RSS Accedi