bind - Adobe Flex - Display a Visual Element from HostComponent in MXML -
i have got skinnablecomponent:
public class contentview extends skinnablecomponent { [bindable] public var titlebar:ivisualelement; public function contentview(pcontentxml:xml) { this.setstyle("skinclass", contentviewskin ); } }
and want display titlebar in mxml skin file.
<?xml version="1.0" encoding="utf-8"?> <s:skin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"> <fx:metadata> [hostcomponent("emm.app2go.viewer.component.contentview")] </fx:metadata> <s:datagroup width="100%" > <s:dataprovider> <s:arraylist source="{hostcomponent.titlebar}" /> </s:dataprovider> </s:datagroup>
as can see managed datagroup kind of ugly, , thinking easier way like
<fx:object source="hostcomponent.titlebar" />
or that.
i hope can me.
you seem have deep misunderstanding of how spark skinning model should work. should not reference hostcomponent skin in order display items. should create element in skin; , use same name. if hostcomponent has skin part defined this:
[bindable] [skinpart] public var titlebar:ivisualelement;
the skin should have this:
<s:datagroup width="100%" id="titlebar" > </s:datagroup>
i suggest reading through information on spark skinning, , learn component lifecycle.
Comments
Post a Comment