[flexcoders] Spark: Best way to reference mxml component hierarchy

2010-01-20 Thread amiller.demandlending
Hello again,

I've been making some headway on my Spark experimentation, but I've run into 
another road block. I was wondering if someone would be willing to offer some 
possible solutions.

I'm trying to make a basic structured document. I would normally do this in 
Flex 3 by starting with the data and then creating some kind of factory to 
build the visual elements.

I was hoping that the new Spark architecture would allow me to bridge that gap 
by defining my document structure using Groups.

IE:

..
..


..
..


I'm sure you get the idea..

These pages are then laid out using a SparkSkin.

I need to be able to maintain a tree structure of document elements for various 
operations.

My initial plan was to capture this.contentGroup in the partAdded function, and 
update node references as needed. However, it turns out that the skin adds adds 
on an additional complexity to the element hierarchy (which makes sense once I 
saw it).

One solution is to recursively run up element.parent capturing my instances as 
I go, but I'm not sure if that's an ideal solution.

Is there a way to reference the mxml element hierarchy as it's listed in the 
group?

Any suggestions would be greatly appreciated.


Thanks!






[flexcoders] Re: Binding and Spark Skins

2010-01-18 Thread amiller.demandlending

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
> >
>




[flexcoders] Binding and Spark Skins

2010-01-17 Thread amiller.demandlending
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