Sheetal,
Try out the following
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" creationComplete="init()">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.collections.ArrayCollection;
import mx.events.FlexEvent;
private var arr:Array = new Array();
[Bindable]
private var arr1:ArrayCollection= new ArrayCollection();
private function fillShelf(f:FlexEvent):void
{
arr[0] = "191970";
arr[1] = "00FF00";
arr[2] = "FF0000";
arr[3] = "6495ED";
arr[4] = "483D8B";
arr[5] = "6A5ACD";
arr[6] = "7B68EE";
arr[7] = "8470FF";
arr[8] = "0000CD";
arr[9] = "4169E1";
arr1=new ArrayCollection(arr);
// mainContainerColors.dataProvider=arr1;
}
public function showvalue(e:Event):void
{
Alert.show(e.currentTarget.getStyle
('backgroundColor'));
}
]]>
</mx:Script>
<mx:TileList id="mainContainerColors" height="114" width="334"
maxRows="1" rowCount="3" horizontalScrollPolicy="off"
borderStyle="solid" borderColor="#000000"
direction="horizontal"
creationComplete="fillShelf(event)"
dataProvider="{arr1}">
<mx:itemRenderer>
<mx:Component>
<mx:Canvas height="75" width="75"
backgroundColor="{new uint('0x'+data.toString())}"
borderColor="#FFFFFF" borderStyle="solid"
click="{this.outerDocument.showvalue(event)}" >
</mx:Canvas>
</mx:Component>
</mx:itemRenderer>
</mx:TileList>
</mx:Application>
Hope this would work for you. But i would suggest you to use external
itemRenderer instead of inline itemRenderer. That really provides you
more flexibility.
-Ravi
On Jun 24, 2:56 pm, sheetal <[email protected]> wrote:
> Tried it.Not working.I have noticed the value of data is fluctuating
> between null and color code.I dont c any reason for that.
>
> <mx:TileList id="mainContainerColors" height="114" width="334"
> maxRows="1" rowCount="1" horizontalScrollPolicy="off"
> borderStyle="solid" borderColor="#000000"
> direction="horizontal"
> creationComplete="fillShelf(event)"
> dataProvider="{arr1}">
> <mx:itemRenderer>
> <mx:Component>
> <mx:Canvas height="75" width="75"
> backgroundColor="{data as uint}"
> borderColor="#FFFFFF" borderStyle="solid"
> click="{this.outerDocument.showvalue(event)}" >
> </mx:Canvas>
> </mx:Component>
> </mx:itemRenderer>
> </mx:TileList>
>
> script:-
> private var arr:Array = new Array();
> [Bindable]
> private var arr1:ArrayCollection= new ArrayCollection();
>
> private function fillShelf(f:FlexEvent):void
> {
> arr[0] = "#191970";
> arr[1] = "#000080";
> arr[2] = "#4169E1";
> arr[3] = "#6495ED";
> arr[4] = "#483D8B";
> arr[5] = "#6A5ACD";
> arr[6] = "#7B68EE";
> arr[7] = "#8470FF";
> arr[8] = "#0000CD";
> arr[9] = "#4169E1";
> arr1=new ArrayCollection(arr);
> // mainContainerColors.dataProvider=arr1;
> }
> public function showvalue(e:Event):void
> {
>
> Alert.show(e.currentTarget.getStyle('backgroundColor'));
> }
>
> On Jun 24, 2:42 pm, Ravi Mishra <[email protected]> wrote:
>
> > Sheetal,
>
> > Try converting the color string in UINT.
>
> > Let me know if it helps.
>
> > -Ravi
>
> > On Jun 24, 2:04 pm, sheetal <[email protected]> wrote:
>
> > > @Ravi
> > > Hey bang on.i checked the value of backgroundColor on click.it shows
> > > '0'.Thanks for pointing that out.But i still dont know how to resolve
> > > this issue.I mean dataprovider has correct data,but while applying it
> > > is not taking it.
>
> > > On Jun 24, 1:55 pm, sheetal <[email protected]> wrote:
>
> > > > Hey thanks for ur response.
> > > > i have debugged to check the value and it is showing the string
> > > > correct-fr ex:"#4169E1"
> > > > But it is not showing that color.
>
> > > > On Jun 24, 12:44 pm, Ravi Mishra <[email protected]> wrote:
>
> > > > > Sheetal,
>
> > > > > Have you checked what is coming in 'data' under the itemRenderer? I
> > > > > doubt the value of data is becoming zero in every case...that is why
> > > > > you are getting black color for every item.
>
> > > > > HTH,
>
> > > > > -Ravi
>
> > > > > On Jun 24, 11:38 am, sheetal <[email protected]> wrote:
>
> > > > > > This one is for using colors in Tilelist,i have tried using Canvas
> > > > > > as
> > > > > > ItemRenderer giving it background color from dataProvider.There
> > > > > > seems
> > > > > > to be some rendering issue where all the colors are appearing
> > > > > > BLACK.Please help with ur inputs.
> > > > > > <mx:itemRenderer>
> > > > > > <mx:Component>
> > > > > > <mx:Canvas height="75" width="75"
> > > > > > backgroundColor="{data.toString
> > > > > > ()}" borderColor="#FFFFFF" borderStyle="solid"
> > > > > > themeColor="{data.toString()}"/>
> > > > > > </mx:Component>
> > > > > > </mx:itemRenderer>
>
> > > > > > On Apr 28, 10:58 am, Ravi Mishra <[email protected]> wrote:
>
> > > > > > > Sheetal,
>
> > > > > > > Its itemRenderer again :)
>
> > > > > > > Use image as an itemrenderer for the tile list and set the source
> > > > > > > property of itemRenderer equal to the actual image path.
>
> > > > > > > HTH,
>
> > > > > > > -Ravi
>
> > > > > > > On Apr 28, 10:51 am, sheetal <[email protected]> wrote:
>
> > > > > > > > hey thznks for sharing ur idea.Will try it.Between if i have a
> > > > > > > > array
> > > > > > > > collection of images.i want to see the images intilelisthow do
> > > > > > > > i set
> > > > > > > > the dataprovider?
> > > > > > > > when i do myTilelist.dataProvider=imageArraycollection.source;
>
> > > > > > > > i see image names in thetilelistand not actual images.Can you
> > > > > > > > help?
>
> > > > > > > > On Apr 28, 10:23 am, Ravi Mishra <[email protected]> wrote:
>
> > > > > > > > > Hi Sheetal,
>
> > > > > > > > > Use itemrenderers onTileList. Let's say you are using canvas
> > > > > > > > > as
> > > > > > > > > itemrenderer then assign its backgroundColor property to the
> > > > > > > > > value of
> > > > > > > > > color code.
>
> > > > > > > > > HTH
>
> > > > > > > > > -Ravi
>
> > > > > > > > > On Apr 28, 9:57 am, sheetal <[email protected]> wrote:
>
> > > > > > > > > > Hello,
> > > > > > > > > > I want to show colors inTileList.I have an array of color
> > > > > > > > > > codes and i
> > > > > > > > > > want to display them as tiles in theTileList.I am looking
> > > > > > > > > > for a
> > > > > > > > > > solution,plz share your ideas.
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---