Skip to content

Instantly share code, notes, and snippets.

@aerith
Created June 4, 2010 03:00
Show Gist options
  • Save aerith/424873 to your computer and use it in GitHub Desktop.
Save aerith/424873 to your computer and use it in GitHub Desktop.
<mx:VBox width="100%" height="100%">
<mx:Repeater id="rp" startingIndex="0" recycleChildren="false">
<flexlibContainer:WindowShade id="windowShade" width="100%" data="{rp.currentItem}" opened="false">
<flexlibContainer:headerRenderer>
<mx:Component>
<flexlibControl:CanvasButton
xmlns:mx="http://www.adobe.com/2006/mxml"
width="100%"
creationComplete="creationCompleteHandler(event)"
click="headerClickHandler(event)"
>
<mx:Script>
<![CDATA[
import flexlib.containers.WindowShade;
import mx.controls.Alert;
[Bindable] public var parentComponent:WindowShade ;
private function creationCompleteHandler(event:Event):void {
parentComponent = WindowShade(parent);
}
private function headerClickHandler(event:Event):void
{
if (parentComponent.data) {
for (var i:uint = 0; i < outerDocument.windowShade.length; i++) {
var shade:WindowShade = outerDocument.windowShade[i];
if (shade == event.currentTarget.parentComponent) {
setStyle('fontWeight',"normal");
icon.visible = icon.includeInLayout = false;
shade.data.isNew = false;
shade.data.isRead = true;
outerDocument.rp.dataProvider.itemUpdated(shade.data);
Alert.show("setStyle");
}
}
}
}
]]>
</mx:Script>
<mx:HBox width="100%">
<mx:Image id="icon" source="{outerDocument.newIcon}" visible="{parentComponent.data.isNew}" includeInLayout="{parentComponent.data.isNew}"/>
<mx:Label text="{parentComponent.data.label}" />
</mx:HBox>
</flexlibControl:CanvasButton>
</mx:Component>
</flexlibContainer:headerRenderer>
<mx:VBox width="100%" height="100%">
<mx:Label text=" {rp.currentItem.userName}"/>
<mx:Label text="{rp.currentItem.posted}"/>
<mx:Text width="100%" text="{rp.currentItem.body}"/>
</mx:VBox>
</flexlibContainer:WindowShade>
</mx:Repeater>
</mx:VBox>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment