Actionscript :: Define Multiple ItemRenderers In A Flex List?
Jun 9, 2009
Basically I want to override some function in the flex/actionscript list class which creates a new ItemRenderer and passes it the required data ready to be displayed. I need to do this because I wish to show a different renderer based on the type of data being displayed. Is there such a function?
I don't really want to pass the list a single itemRenderer which calls its addChild function depending on the type of data it has - It just doesn't seem right.
View 1 Replies
Similar Posts:
Jun 28, 2010
I'm creating a list of scores for a game. now most of the list i need to have the same ItemRenderer. but in one specific row of the list where the user who's playing is listed, it should show different information and with different background color. how can i achieve this ?
I already tried to resolve the issue with states, i created 2 states, one state called 'mine' and the 2nd state called 'others'.
the problems that i got is that when users click on one of the list rows that state changes to i donno clicked or something and that's why i assumed that states are not the right action for me.
View 3 Replies
Mar 22, 2011
I have a List class with an itemrenderer. How can I get the itemrenderers to divide the List width between them? Normally, I would think this would be a easy as giving the renderers a percent width but that no worky.
Application:
<?xml version="1.0" encoding="utf-8"?>
<s:Application
minHeight="600"[code]..............
View 1 Replies
Mar 13, 2012
In flex 4.5, I have an application that has a BorderContainer that loads a spark list (mxml style - _myList and the borderContainer is stored in a library outside of the parent application) that loads an arrayCollection with an itemRenderer (I should note said itemRenderer is not an inline renderer - on selection of an item in the list, the itemRenderer expands, loads a particular control within the item renderer based on data passed from the selected item in the list) and allows the user to perform a search. This works all well and good on startup/load, until I try to change the dataProvider for the list (my app allows users to switch data sources which then creates a new dataProvider with new variables). I have tried:
[Code]...
View 1 Replies
Jan 25, 2012
I have a list that has alternating item colors.
<s:List id="myList" change="selectionChanged(event)" alternatingItemColors="[0x000000, 0xFFFFFF]" dataProvider="{alResults}" itemRenderer="itemRenders.Results" width="100%"></s:List>
[code].....
View 1 Replies
Jan 18, 2012
To allow you to tab through itemrenderers in spark you simply set hasFocusableChildren="true". However when you tab to a row/tile which is not visible, it doesn't automatically scroll the List.
What's the easiest way of making this happen?
View 1 Replies
Apr 6, 2010
I have item renderers in an mx.controls.Tree that I need to refresh on demand.
I have code in the updateDisplayList that fires for only some of the visible nodes no matter what I do. I've tried triggering a change that they should all be listening for; I have tried clearing and resetting the dataProvider and the itemRenderer properties.
private function forceCategoryTreeRefresh(event : Event = null) : void
{
trace("forceCategoryTreeRefresh");
[Code]....
The nodes refresh properly when I scroll them into view (e.g. the .data gets set), but I cannot force the ones that already exist to refresh or reset themselves.
View 2 Replies
May 14, 2008
I'm building fairly simple item renderers, in fact, here's the code for one of them...
Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
implements="mx.controls.listClasses.IListItemRenderer"
[Code].....
It's a really simple renderer that has an image and some text sitting next to it, or just the text if no image is in that item's data provider. There is also some basic rollover, rollout and click functionality...
So my question: Why is it that if my list needs to scroll it gets messed up? By "messed up" I mean that the text changes from being to the right of the image (when image is present) to moving over top of the image, as if it isn't realizing that the image is there. There's also sometimes an issue of the item renderer shrinking down so there is no longer anything even visible in the box (just some black with a grey border on the bottom about 5 - 10 pixels big...
I'm wondering if maybe my item renderer is too complex? I'm having the same issue with text working like that in another renderer, but no images, just text placed in certain positions (as well as some strage blue tints showing up at the top or bottom depending on how I am scrolling)
By the way... here is the MXML where I am initializing my list...
Code:
<mx:Canvas width="100%" height="100%" id="list">
<mx:List
width="100%"
[Code].....
View 1 Replies
Aug 4, 2011
I have following itemrenderer
[Code]...
My question is Should above logic go in updtaeDisplayList or remain in set data() itself. The output is smae from both. Whats the performance impact difference if we consider it from lifecycle perspective.(The heavy computations should be pushed towards the end of the frame rendering)
View 1 Replies
Oct 4, 2011
I've got a spark ListForm with a custom mxml itemRenderer,all the itemRenderer has is[code]...
View 1 Replies
Mar 20, 2012
A question about ItemRenderers: let's say I have an ArrayCollection that is my application data sitting inside a global object. I them populate a sparks list with this data, setting the ArrayCollection as the dataProvider.
So each ItemRenderer gets a copy of an item sitting in the array. You can override the "set data" method to set the data something more domain-specific. The problem is that the data is a copy of the original item.
Now let's say we want to add some data to the item while inside the ItemRender. For example, it could call a method on the item telling it to load some details about itself, or maybe we allow the user to modify something on the item.
Obviously, we can't do any of this if we are operating on a copy because it will be thrown away as soon as the ItemRenderer is destroyed and the original object doesn't know anything about what happened.
So what's the best practice? Should I just use the itemIndex of the renderer to pull out the original item from my global array like this:
{globalArrayCollection}.getItemAt(this.itemIndex) But it seems kind of clunky to me. Is there a best practice for dealing with this?
View 2 Replies
Feb 19, 2010
I'm developing on Flex 4. I have a datagrid container and custom itemrenderer with a text field, a button and a few boxes. Every time some data is displayed, the app stalls for a second or two before rendering completely. Is there any way to make it render more fluidly or render one after another...?
View 1 Replies
Feb 23, 2011
I'm trying to have multiple item renderers in a list, as I have several different types of objects that I want to display. I tried creating a new class that extends ListBase, and adding override public function createItemRenderer with my code within this function. I then instantiate the new class and give it my array of data as its dataProvider, but createItemRenderer is never called within my new class,
View 2 Replies
Mar 30, 2011
Im currently creating a list in Adobe Flex/Actionscript for a person search app. At the moment, the list shows 1 line of text:
<fx:Script>
<![CDATA[
import model.PersonSummary;
[Code].....
View 3 Replies
Jan 20, 2012
I want each item in a list to change to a totally unique view file. Instead of 10 items in a list all going to 1 new view but with different info being generated I want 10 different view, 1 per item in the list. I can't find any examples of how to do this and I have been tryingo to make it for for a while. This is for a mobile app.
<fx:Script>
<![CDATA[
import spark.events.IndexChangeEvent;
[code].....
View 1 Replies
Aug 3, 2010
In a spark list I could use the change event to find out which item has been selected or deselected. The dispatched IndexChangeEvent object has the properties newIndex and oldIndex holding this information.
But with multiple selection allowed this doesn't work anymore because newIndex and oldIndex could refer to indices of still selected elements.
A solution would be to copy the selectedIndices vector to another variable and compare this variable with selectedIndices after a change in selection, but this seems to be somewhat complex.
Does anyone know if there is an easy way two get the index/item a user is deselecting while other elements are still selected?
View 2 Replies
Dec 21, 2010
what I need to do is combine 5 arrays with 5 individual strings (which have come from a JSON webservice) into one single list item in FlashBuilder Burrito. [code]I've pulled these out successfully and each one traces in the debugger, although as I need them all in the same list I'm struggling to establish them as a dataprovider together.If I push the strings and arrays together it is impossible to read properly, as the main Titles are at a different level to any descriptors for the products which are in the arrays.
View 1 Replies
Jan 10, 2012
I've got a Gridcolumn in a Datagrid (Spark). The Column's dataprovider is a Number value that gets updated via Binding.Now, without an item renderer the cell displays the correct values.If I set an item renderer, I can't access the values in this renderer.My renderer looks like this, so nothing really do here (for now) but to trace the value, but the value is always NaN.
<?xml version="1.0" encoding="utf-8"?>
<s:GridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" width="100%" height="100%" >[code].......
without the renderer, the column displays the correct values, so apparently the DefaultGridItemRenderer works fine.As requested, here is my Datagrid;
<s:DataGrid id="dataGrid" dataProvider="{_listItems}">
<s:columns>
<s:ArrayList>[code]..........
_listItems is an ArrayList with instances of a model class, which has (amongst others) a property called change of type Number.
View 1 Replies
Mar 26, 2010
I'm looking for a way to do something similar to a c/c++ #define in adobe flex.
I'd like to have lots of different paths a project build can take depending on wither or not something was defined. Does such a thing exist in flex?
I know there is ways to set global variables but that wont really suit my purpose. being able to have structures with numerous #ifndefined and such is really what i'm in need of.
thanks!
View 2 Replies
Aug 11, 2010
I'm using flex 4.1 to write an application. i read in the documents that has the rowCount property to set how many items to display. the does not have that property. how can I limit the list to display 3 items ?
View 3 Replies
May 26, 2011
Flex 3 List control had a itemRollOver event. Flex 4 List doesn't have it. Is there an equivalent or a workaround for this issue?
View 2 Replies
Feb 1, 2010
I'm a complete Flex/Flash noob, running Adobe Flash Builder 4 Beta 2. I have a main component that needs to be able to call several popups, each mostly the same except for one function and a few labels. Obviously, I'd prefer to be able to define this function and change those labels when calling the popup instead of having tons of .mxml files with nearly the same code, I just don't know how to do it. I figured out how I can change the labels, but not sure how to redefine the function.For simplicity's sake, let's say my code looks like this:
main.mxml:
<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:fx="http://ns.adobe.com/mxml/2009" :s="library://ns.adobe.com/flex/spark"
[code].....
View 2 Replies
May 11, 2010
I'm looking for method to create Vector and push some values without defining variable Vector. For example:I have function:
public function bla(data:Vector.<Object>):void { ... }
this function expects Vector as parameter. I can pass parameters this way
var newVector:Vector.<Object> = new Vector.<Object>();
[code].....
View 4 Replies
Dec 31, 2009
Here is a snip from within my code:
[Code]...
The 'recommendations' dataProvider is an ArrayCollection of String, which are generally sentences about as long as this one. By setting the variableRowHeight and wordWrap properties as shown, if a sentence is too long to fit on a single line, everything works fine- the row expands and the messages show on two lines, or occasionally three.
The space allocated for this panel within the entire canvas means if the total text size of 'recommendations' exceeds six lines, I need for the entire list scroll. This is also working just fine. The trouble is when using the mouse wheel to do the scrolling- Flex scrolls both the entire list and the single item where the mouse is hovering. Often this results in only the second half of a sentence being visible. Non-programmer friends I have asked to look at this noticed this, and tell me it as a problem. If a user does not notice the dual scrolling, and sees only a fragment of a sentence, it will be perceived as an error in the application.
[Code]....
View 1 Replies
Jul 6, 2011
When a user selects a category from the first drop down box then i want the 2nd drop down to be updated based on the selection of the first drop down. I have created multiple ArrayCollections whose names are set to the "data" values of the first drop down, for instance:
[Bindable]
public var countries:ArrayCollection = new ArrayCollection([
{label:"USA",data:"USA"},
[code].....
View 2 Replies
Aug 31, 2011
I am currently working on a project in Flex and I am having a hard time having a list's contents ALL be selected by default. Wondering how to do this.
<mx:List id="list" dataProvider="{dp}" allowMultipleSelection="true"/>
I'm just trying to have the list all selected.
View 2 Replies
Aug 30, 2010
how can I define a CSS style for html hyperlinks inside a mx|Label component such as a, a:link, a:hover and a:active ?
(I can't use s|Label since it doesn't dispatch link events I tried everything (even really stupid ones), but am unable to find anything that actually works:
[Code]...
View 1 Replies
Jun 28, 2010
I'm trying to animate a list as I delete the top row. All the examples I can find use itemsChangeEffect to bind to the effect, but this property exists only in MX lists, not spark lists.
Any idea how I can get the same effect done in Spark Lists?
I'm trying to remove the top most item in the list with a slight fade out effect before the rest of the items move up to replace the gap.
View 2 Replies
Nov 22, 2011
I'm quite new to flex and ActionScript and I'd like to create a custom component acting as a calendar (using a Sprite), in which the calendar events are represented as rectangles the user can interact with (click to get information about the event, drag and drop for setting start and end dates...). It seems that using a subclass of DataGroup is a good way to do it, but some things are obscure to me.For example, how should I use the Sprite? as a child of the DataGroup? Also, the calendar events will be drawn using a custom ItemRenderer, and I will have to use a BasicLayout in my DataGroup, but where should I tell that an ItemRenderer should draw its rectangle in the Sprite at the corresponding (x,y) coordinates?
View 1 Replies
Apr 20, 2010
Essentially this is what I want to accomplish, however it doesn't work like this. Is there any solution: - The problem is I can't dynamically name a new object..
import views.printingView;
public function initComponent(o:Array):void{
SomeObject::Array = o;
[Code].....
View 1 Replies