Ah..
So the component is strictly data/control code, and the skin is strictly visual
code and layout. Very sweet.
Thanks for the insight.
Cheers!
~Aaron
--- In flexcoders@yahoogroups.com, "Ariel J" wrote:
>
> You are not tackling this right.
>
> The component does not create the title bar as a child.
> The skin will do that.
>
> Check this out:
>
> (1) Do the component in ActionScript. Declare the expected elements that the
> skin will define as variables. Define their behaviors and properties in the
> partAdded function.
>
> package com.mycompany {
> [SkinState("normal")]
>
> public class HostComponent extends SkinnableContainer
> {
> [SkinPart(required="false")]
> public var titleBar:IReportTitleBar
>
> override protected function
> partAdded(partName:String,instance:Object):void
> {
> if (instance == titleBar)
>{
> titleBar.label = "My Label";
> // or use Binding:
> BindingUtils.bindPropert(titleBar,"label",this,titleBarLabel);
> }
> }
> }
>
> // don't forget the partRemoved function, too
>
> }
>
> (2) Then, the skin only defines the titleBar using convenient MXML.
>
>
>
> [HostComponent("com.mycompany.HostComponent")]
>
>
>
>
>
>
>
>
>
> --- In flexcoders@yahoogroups.com, "amiller.demandlending" wrote:
> >
> > Hi Everyone,
> >
> > I have a sub-component which uses a String binding on a Label. The bindings
> > works fine if I do not use a skinClass on the host component. If I do use a
> > SparkSkin, my bindings do not execute on the sub-component. Instead, I get
> > the value which I initialized it to.
> >
> > Am I doing something wrong, or is this expected behavior?
> >
> > If this is expected behavior, then what is the purpose of a SparkSkin if I
> > have to explicitly redeclare all my control code in the skin?
> >
> > I could just be misunderstanding the intended usage, but from what I
> > understood in the docs it seems like a very powerful new feature.
> >
> > Would anyone be able to enlighten me on the topic a bit more?
> >
> >
> > Here is the trimmed code for my host/sub
> >
> > Host Component
> >
> >
> >
> > [SkinState("normal")]
> >
> >
> >
> >
> >
> > ---
> >
> > The title bar sub-component
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > The host component skin
> >
> >
> >
> > [HostComponent("demand.reports.DRDoc")]
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Thanks in advance!
> >
> > ~Aaron
> >
>