[flexcoders] Re: Flex Application Memory Footprint
Are you referring to the following bug? http://bugs.adobe.com/jira/browse/FLEXDMV-1968 I think this is fixed in the latest release 3.0.2 not sure. --- In flexcoders@yahoogroups.com, Alex Harui aha...@... wrote: If you have more header renderers than columns, I'd be checking them for leaks using the Profiler. See http://blogs.adobe.com/aharui/2008/09/using_the_flex_builder_3x_prof.html for tips on using the Profiler. From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of djbrown_rotonews Sent: Friday, November 14, 2008 7:23 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Flex Application Memory Footprint I'm seeing the same behavior. DataGrid headerRenderer is a simple Label with a toolTip, and there's just 15 columns in the grid itself. Before the data is even populated, I have 75 instances of the header renderers (5 for each column), and they never get cleaned up. Around 35-40% of my application memory is then tied up in non- recycled headerRenderers. any ideas? --- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com, Dimitrios Gianninas dimitrios.gianninas@ wrote: hi, when you go to a tab for the first time, it gets created along with all of its components and they will stay in memory so long as the app exists. If you are using creationPolicy=all on your TabNavigator, that is really bad, dont. That means all tabs are being created and maybe the user will never go to most of them. Also if you are caching data that you no longer need, set it to null to let the GC clean it up. hope that helps. Dimitrios Gianninas RIA Developer Team Lead Optimal Payments Inc. From: flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com] On Behalf Of Nirav Gosalia Sent: Thursday, November 06, 2008 10:21 AM To: flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com Cc: mayank.vora@ Subject: [flexcoders] Flex Application Memory Footprint Hi, We are developing a CRM application using Flex. The SWF size is 1.5 MB. The application has around 15 tabs. When all the tabs are visited once the application shows a memory foot print of 400 MB in the windows task manager. I used flex profiler but there is no memory leak. I was wondering that how flex handles garbage collection because once the tabs are created they never seem to be releasing any memory. Also flex profiler shows that my Datagrid header renderer occupies 40% of the total memory consumed. Can someone suggest ways of reducing the memory foot print and show an ideal way of writing a header renderer (we use it for full database sort). Regards, Nirav Gosalia -- WARNING --- This electronic message and its attachments may contain confidential, proprietary or legally privileged information, which is solely for the use of the intended recipient. No privilege or other rights are waived by any unintended transmission or unauthorized retransmission of this message. If you are not the intended recipient of this message, or if you have received it in error, you should immediately stop reading this message and delete it and all attachments from your system. The reading, distribution, copying or other use of this message or its attachments by unintended recipients is unauthorized and may be unlawful. If you have received this e-mail in error, please notify the sender. AVIS IMPORTANT -- Ce message électronique et ses pièces jointes peuvent contenir des renseignements confidentiels, exclusifs ou légalement privilégiés destinés au seul usage du destinataire visé. L'expéditeur original ne renonce à aucun privilège ou à aucun autre droit si le présent message a été transmis involontairement ou s'il est retransmis sans son autorisation. Si vous n'êtes pas le destinataire visé du présent message ou si vous l'avez reçu par erreur, veuillez cesser immédiatement de le lire et le supprimer, ainsi que toutes ses pièces jointes, de votre système. La lecture, la distribution, la copie ou tout autre usage du présent message ou de ses pièces jointes par des personnes autres que le destinataire visé ne sont pas autorisés et pourraient être illégaux. Si vous avez reçu ce courrier électronique par erreur, veuillez en aviser l'expéditeur.
[flexcoders] Reduce the height of sortItemRenderer ( AdvancedDataGridHeaderRenderer )
I extended the AdvDataGridHeaderRenderer and added a TextInput for displaying column totals. All is fine except that i want my TextInput to occupy the complete column width (=100%) and push the sortItemRenderer down. Any comments anybody? === ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; mx:AdvancedDataGrid id=advancedDataGrid headerRenderer=SimpleADGHeaderRenderer variableRowHeight=true mx:columns mx:AdvancedDataGridColumn dataField=index width=180 textAlign=right/ mx:AdvancedDataGridColumn dataField=food width=180/ mx:AdvancedDataGridColumn dataField=type width=180/ /mx:columns mx:dataProvider mx:Array mx:Object index=1 food=Apple type=Fruit/ mx:Object index=2 food=Pear type=Fruit/ mx:Object index=3 food=Banana type=Fruit/ mx:Object index=4 food=Chicken type=Meat/ mx:Object index=5 food=Beef type=Meat/ mx:Object index=6 food=Milk type=Dairy/ /mx:Array /mx:dataProvider /mx:AdvancedDataGrid /mx:Application = package { import mx.controls.TextInput; import mx.controls.advancedDataGridClasses.AdvancedDataGridHeaderRenderer; public class SimpleADGHeaderRenderer extends AdvancedDataGridHeaderRenderer{ protected var headerLabel:TextInput; public function SimpleADGHeaderRenderer(){ super(); setStyle(verticalAlign,bottom); } /** * @protected */ override protected function createChildren():void { super.createChildren(); if(!headerLabel){ headerLabel = new TextInput(); headerLabel.styleName = this; headerLabel.setStyle (editable,false); headerLabel.setStyle (borderSides,bottom); headerLabel.setStyle (borderStyle,solid); headerLabel.setStyle (fontWeight,bold); headerLabel.setStyle (backgroundAlpha,0); headerLabel.setStyle (themeColor,getStyle(backgroundColor)); headerLabel.text = $11.734699; addChild(headerLabel); } } /** * @protected */ override protected function commitProperties():void { super.commitProperties(); } /** * @protected */ override protected function measure():void { super.measure(); measuredHeight = measuredHeight + headerLabel.getExplicitOrMeasuredHeight(); } /** * @protected */ override protected function updateDisplayList (unscaledWidth:Number, unscaledHeight:Number):void{ super.updateDisplayList(unscaledWidth, unscaledHeight); headerLabel.setActualSize (headerLabel.getExplicitOrMeasuredWidth (),headerLabel.getExplicitOrMeasuredHeight()); //sortItemRenderer.setActualSize (sortItemRenderer.getExplicitOrMeasuredWidth(),); } } } =
[flexcoders] Re: unable to bind to property 'width' on class 'Object'
dont worry its only a warning. You can get ride of it by typecasting your Object into an XML like this: { XML(object).width } --- In flexcoders@yahoogroups.com, Juan Carlos M. [EMAIL PROTECTED] wrote: Hi... may this is weird I´ve extended a Canvas component using mxml. When I use that component inside a titlewindow it works... but it doesn´t work inside other components and flex's console shows this error: warning: unable to bind to property 'width' on class 'Object' (class is not an IEventDispatcher) (it seems that measure method is in an infinite loop... )
[flexcoders] Re: updating display of GroupingCollection on AdvancedDataGrid with refresh
450 rows shouldnt take so long unless u have summaryfunction and labelfunc etc. First check the performance by removing the SummaryFunction Here is an example on filtering: http://flexpearls.blogspot.com/2008/02/groupingcollection-to-group-mails-on.html If all else fails you might want to try Async refresh ...GroupingCollection.refresh(false); http://flexpearls.blogspot.com/2007/10/async-refresh-of-groupingcollection.html --- In flexcoders@yahoogroups.com, poweribo [EMAIL PROTECTED] wrote: Hi All, I have an AdvancedDataGrid, a GroupingCollection and an ArrayCollection as a source of GroupingCollection. I update the display by setting a filter on arraycollection and calling refresh. But the AdvancedDataGrid doesnt reflect the changes unless I call GroupingCollection.refresh(). Bad. My ArrayCollection contains only 450+ items but GroupingCollection.refresh() takes too long time to re-render the list. Is there any other way that I can do this faster? and without waiting and repopulating the WHOLE list? for example I just want to hide 1 item by adding it on my filter, the list should simply adjust by deleting that row only (just like how a normal List UIComp+ArrayCollection behaves). Any ideas? -Stephen p.s. I have seen the http://flexpearls.blogspot.com/2008/06/groupingcollection-with-some- better.html but it still re-draw the whole thing and doesnt keep the state of the list (expanded/collapsed).
[flexcoders] Re: DataGridHeader with TextInput : text values lost on scroll
Hopeully these will help you arrive at the solution. 1. You need to override the measure and updateDisplayList function whenever u override the createChildren function. 2. I would just extend TextInput rather than AdvDataGridHeaderRender. 3. Note that data object in the HeaderRenderer is an instance of AdvDataGridColumn. Extend your own AdvDataGridColumn and have new property called myTxtValue then in the HeaderRenderer u can use binding and use it like this (data as MyAdvDataGridColumn).myTxtValue = 'sometext' 4. When using renderers (since they are recycled) always have the else block when u have if condition http://weblogs.macromedia.com/pent/archives/flex_solutions/index.html --- In flexcoders@yahoogroups.com, gaurav1146 [EMAIL PROTECTED] wrote: Hi, I have a datagrid to which I am adding a TextInput in the Header by overriding the createChildren() method of AdvancedDataGridHeaderRenderer. The problem is that when I have certain text in the header textinput and the user performs a scroll on the DataGrid the createChildren() method is called again and it creates a new TextInput. Thus whatever value the user has typed in the textinput is lost on a scroll. Is there any way I could pass the original text of the textinput to the newly created text input. TIA Gaurav
[flexcoders] Re: AdvancedDataGridHeaderRenderer loses focus on set dataProvider
Dont think you should be setting the dataprovider for every key stroke instead Use a timer to see if user has finished typing (~2sec). http://www.adobe.com/cfusion/exchange/index.cfm? event=extensionDetailextid=1047291 --- In flexcoders@yahoogroups.com, Ryan Gravener [EMAIL PROTECTED] wrote: Take a look at this video (sorry the mouse cursor does not appear in it): http://screencast.com/t/VECik0vjuk Every time the dataProvider is set the textfield loses focus, and I can't find a way to restore it. So essentially on each key stroke the textfield loses focus, which renders it useless inside the advanceddatagridheaderrenderer. I'll provide source if necessary, just looking for a quick fix if there is one. Sincerely, Ryan Gravener http://twitter.com/ryangravener
[flexcoders] Re: AdvancedDataGridColumn sorting lost when i set my own HeaderRenderer
Never mind i figured out the answer...i extend the AdvancedDataGridHeaderRenderer public class MyAdvancedDataGridHeaderRenderer extends AdvancedDataGridHeaderRenderer{ [Embed(source=common/assets/icon_filter_16.jpg)] [Bindable]private var icon_filter_16:Class; protected var filterButton:Button; public function MyAdvancedDataGridHeaderRenderer(){ super(); } /** * @protected */ override protected function createChildren():void { super.createChildren(); if (!filterButton){ filterButton = new Button(); filterButton.setStyle (borderThickness,0); filterButton.setStyle(icon, icon_filter_16); filterButton.setActualSize(16, 16); filterButton.mouseFocusEnabled = false; filterButton.styleName = this; filterButton.useHandCursor = true; filterButton.buttonMode = true; filterButton.mouseChildren = false; filterButton.addEventListener (MouseEvent.CLICK, function(e:MouseEvent):void{ trace('filterButton clicked'); e.stopPropagation(); }); addChild(filterButton); } } /** * @protected */ override protected function commitProperties():void { super.commitProperties(); filterButton.toolTip = Filter +(data as AdvancedDataGridColumn).headerText; } /** * @protected */ override protected function measure():void { super.measure(); measuredWidth = measuredWidth + getStyle (horizontalGap) + filterButton.getExplicitOrMeasuredWidth(); } /** * @protected */ override protected function updateDisplayList (unscaledWidth:Number, unscaledHeight:Number):void{ super.updateDisplayList(unscaledWidth, unscaledHeight); filterButton.x = 2; filterButton.y = 2; } } --- In flexcoders@yahoogroups.com, Vijay Anand Mareddy [EMAIL PROTECTED] wrote: The following sample code has a simple Label as HeaderRenderer. 1. The background sort icon on AdvDataGridColumn is gone. 2. Default Column Sorting is lost (when sortExpertMode=false) Any help on how to retain the above functionailty and yet use my own HeaderRenderer? ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=vertical mx:Label text=AdvancedDataGrid fontWeight=bold/ mx:CheckBox label=sortExpertMode id=sortExpertMode selected=false/ mx:AdvancedDataGrid id=advancedDataGrid sortExpertMode={sortExpertMode.selected} mx:dataProvider mx:Array mx:Object food='Apple' type='Fruit'/ mx:Object food='Pear' type='Fruit'/ mx:Object food='Banana' type='Fruit'/ mx:Object food='Chicken' type='Meat'/ mx:Object food='Beef' type='Meat'/ mx:Object food='Milk' type='Dairy'/ /mx:Array /mx:dataProvider mx:columns mx:AdvancedDataGridColumn width=150 dataField=food sortable=true headerRenderer=mx.controls.Label/ mx:AdvancedDataGridColumn dataField=type/ /mx:columns /mx:AdvancedDataGrid mx:Label text=DataGrid fontWeight=bold/ mx:DataGrid id=myGrid mx:dataProvider mx:Array mx:Object food='Apple' type='Fruit'/ mx:Object food='Pear' type='Fruit'/ mx:Object food='Banana' type='Fruit'/ mx:Object food='Chicken' type='Meat'/ mx:Object food='Beef' type='Meat
[flexcoders] AdvancedDataGridColumn sorting lost when i set my own HeaderRenderer
The following sample code has a simple Label as HeaderRenderer. 1. The background sort icon on AdvDataGridColumn is gone. 2. Default Column Sorting is lost (when sortExpertMode=false) Any help on how to retain the above functionailty and yet use my own HeaderRenderer? ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=vertical mx:Label text=AdvancedDataGrid fontWeight=bold/ mx:CheckBox label=sortExpertMode id=sortExpertMode selected=false/ mx:AdvancedDataGrid id=advancedDataGrid sortExpertMode={sortExpertMode.selected} mx:dataProvider mx:Array mx:Object food='Apple' type='Fruit'/ mx:Object food='Pear' type='Fruit'/ mx:Object food='Banana' type='Fruit'/ mx:Object food='Chicken' type='Meat'/ mx:Object food='Beef' type='Meat'/ mx:Object food='Milk' type='Dairy'/ /mx:Array /mx:dataProvider mx:columns mx:AdvancedDataGridColumn width=150 dataField=food sortable=true headerRenderer=mx.controls.Label/ mx:AdvancedDataGridColumn dataField=type/ /mx:columns /mx:AdvancedDataGrid mx:Label text=DataGrid fontWeight=bold/ mx:DataGrid id=myGrid mx:dataProvider mx:Array mx:Object food='Apple' type='Fruit'/ mx:Object food='Pear' type='Fruit'/ mx:Object food='Banana' type='Fruit'/ mx:Object food='Chicken' type='Meat'/ mx:Object food='Beef' type='Meat'/ mx:Object food='Milk' type='Dairy'/ /mx:Array /mx:dataProvider mx:columns mx:DataGridColumn width=150 dataField=food headerRenderer=mx.controls.Label/ mx:DataGridColumn dataField=type/ /mx:columns /mx:DataGrid /mx:Application
[flexcoders] Re: Unique values on the CategoryAxis
UniqueCategoryAxis -- CategoryAxis with unique values import mx.charts.CategoryAxis; import mx.collections.ListCollectionView; import mx.collections.Sort; import mx.collections.SortField; public class UniqueCategoryAxis extends CategoryAxis { private var theDataSort:Sort = new Sort(); private var tmp:Object = {}; // used to removeDuplicates override public function set dataProvider (value:Object):void{ // trace('UniqueCategoryAxis.set dataProvider'); tmp = {}; var label:Object = categoryField? categoryField:dataFunction as Object; super.dataProvider = (value value.toArray ())? value.toArray().filter( function (item:Object,idx:uint,arr:Array):Boolean { var pk:String = item[label] as String; if (tmp.hasOwnProperty(pk)){ return false; } else { tmp[pk] = item; return true; } }):value; theDataSort.fields = [new SortField(label as String,false,true,false)];/** Sorting desc*/ super.dataProvider.sort = theDataSort; super.dataProvider.refresh(); } } --- In flexcoders@yahoogroups.com, Tim Hoff [EMAIL PROTECTED] wrote: Hey Vijay, For some reason, I don't have the com.adobe.utils.ArrayUtil class; so I can't compile your app. But, instead of using an array for the CategoryAxis's dataProvider, you may want to switch to an ArrayCollection. Binding doesn't play nice with arrays. If that doesn't help, you could change the logic to find duplicates to use a Dictionary or just use a loop to see if the item already exists. You're definitely close, so I'm sure that you'll figure it out; if you haven't already. Cheers, -TH --- In flexcoders@yahoogroups.com, Vijay Anand Mareddy vam2@ wrote: Thanks Tim, the hardcoded uniqueArr as dataprovider works but it doesnt work when i try to use it as a derived function as follows. ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute mx:Script ![CDATA[ import mx.controls.Alert; import mx.collections.ArrayCollection; import com.adobe.utils.ArrayUtil; [Bindable] public var someData:ArrayCollection = new ArrayCollection([ {editedEndDate:01/01/2006, mpid:GRAPES}, {editedEndDate:05/01/2007, mpid:APPLE}, {editedEndDate:11/01/2009, mpid:APPLE}, {editedEndDate:05/01/2008, mpid:ORANGE}, {editedEndDate:05/01/2009, mpid:MANGO} ]); //[Bindable] //public var uniqueArr:Array = [GRAPES,APPLE,ORANGE,MANGO]; [Bindable] private var _uniqueArr:Array = new Array(); public function set uniqueArr(arry:Array):void{ _uniqueArr = arry; } public function get uniqueArr():Array{ _uniqueArr = new Array(); for each( var o:Object in mychart.dataProvider){ Alert.show(o.mpid.toString()); if(!ArrayUtil.arrayContainsValue(_uniqueArr,o.mpid)){ //Alert.show(o.mpid.toString()); _uniqueArr.push(o.mpid); } } return _uniqueArr; } ]] /mx:Script mx:Panel title=DateTimeAxis width=100% height=100% mx:PlotChart id=mychart dataProvider={someData} mx:horizontalAxismx:DateTimeAxis dataUnits=days //mx:horizontalAxis mx:verticalAxismx:CategoryAxis dataProvider={uniqueArr} //mx:verticalAxis mx:seriesmx:PlotSeries yField=mpid xField=editedEndDate displayName=myData//mx:series /mx:PlotChart /mx:Panel /mx:Application -VM --- In flexcoders@yahoogroups.com, Tim Hoff TimHoff@ wrote: Hi Vijay, This will get rid of your duplicate Apple. mx:CategoryAxis dataProvider={uniqueArr}/ Although you have the uniqueArr hardcoded, you can derive that from the data. -TH --- In flexcoders@yahoogroups.com, Vijay Anand Mareddy vam2@ wrote: How do i make the CategoryAxis show only unique values In my example, I dont want the Apple to apear twice on the vertical axis. ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute mx:Script ![CDATA[ import mx.controls.Alert; import mx.collections.ArrayCollection; import com.adobe.utils.ArrayUtil
[flexcoders] Re: Differences between itemUpdated and setItemAt for ArrayCollections
###itemUpdated notifies the view that an item has been updated. Flex says to the view ..you are stale now ...please update yourself with latest changes from the arraycollectionlike a view.refresh() ###SetItemAt is replacing the dataItem in the ArrayCollection. Like when u manually edit the viewu may want to call the setItemAt to propagate the changes from the view to the arraycollection. I know this is automated but when u do validations u may want to put a logic wheather u want oldValue or newValue in the arraycollection . In such cases u may have to call arraycollection.setItemAt to manually update the arraycollection. --- In flexcoders@yahoogroups.com, j_lentzz [EMAIL PROTECTED] wrote: Ok. Thanks. Makes sense. John --- In flexcoders@yahoogroups.com, Alex Harui aharui@ wrote: itemUpdated implies you changed properties of some item. setItemAt implies you replaced that instance with another instance. Things like selection will be abandoned. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of syndicate_ai Sent: Wednesday, November 28, 2007 12:51 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Differences between itemUpdated and setItemAt for ArrayCollections --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , j_lentzz jelentz@ wrote: Hi, I have a general question about when to use the two methods itemUpdated and setItemAt on ArrayCollections. if you use obj = getItemAt(someIndex) and then change some properties in the obj, what difference is there between using setItemAt(obj,someIndex) or using itemUpdated(obj)? Is there a particular reason to choose one over the other? Thanks, John you generally use setItemAt if you need to completly replace the object in that part of the arraycollection. For instance, we have a backend delegate class that instantiates new objects all the time, each being different but needs to replace the item that already exists in the collection (each object being replaced is progressivly more lightweight) so SetItemAt is necessary for us, its more costly because the view has to completly rerender for that item. getItemAt would be better if you are just changing a few attributes on the object, because a view only needs to change if certain attributes are different from before. Thants what i think anyway
[flexcoders] Re: Differences between itemUpdated and setItemAt for ArrayCollections
###itemUpdated notifies the view that an item has been updated. Flex says to the view ..you are stale now ...please update yourself with latest changes from the arraycollectionlike a view.refresh() ###SetItemAt is replacing the dataItem in the ArrayCollection. Like when u manually edit the viewu may want to call the setItemAt to propagate the changes from the view to the arraycollection. I know this is automated but when u do validations u may want to put a logic wheather u want oldValue or newValue in the arraycollection . In such cases u may have to call arraycollection.setItemAt to manually update the arraycollection. --- In flexcoders@yahoogroups.com, j_lentzz [EMAIL PROTECTED] wrote: Ok. Thanks. Makes sense. John --- In flexcoders@yahoogroups.com, Alex Harui aharui@ wrote: itemUpdated implies you changed properties of some item. setItemAt implies you replaced that instance with another instance. Things like selection will be abandoned. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of syndicate_ai Sent: Wednesday, November 28, 2007 12:51 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Differences between itemUpdated and setItemAt for ArrayCollections --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , j_lentzz jelentz@ wrote: Hi, I have a general question about when to use the two methods itemUpdated and setItemAt on ArrayCollections. if you use obj = getItemAt(someIndex) and then change some properties in the obj, what difference is there between using setItemAt(obj,someIndex) or using itemUpdated(obj)? Is there a particular reason to choose one over the other? Thanks, John you generally use setItemAt if you need to completly replace the object in that part of the arraycollection. For instance, we have a backend delegate class that instantiates new objects all the time, each being different but needs to replace the item that already exists in the collection (each object being replaced is progressivly more lightweight) so SetItemAt is necessary for us, its more costly because the view has to completly rerender for that item. getItemAt would be better if you are just changing a few attributes on the object, because a view only needs to change if certain attributes are different from before. Thants what i think anyway
[flexcoders] Re: Icon Click and iconFunction on ListItemRenderer
Figured out the answer to my question. You dont need to extend ListeItemRenderer. The default one is good enough. The currentTarget property of the ListEvent.Click (Not ListEvent.ItemClick) will tell you whether you clicked on the icon (if it exists) or the textfield. --- In flexcoders@yahoogroups.com, Vijay Anand Mareddy [EMAIL PROTECTED] wrote: I am using a simple List with icons and labelText using the iconFunction and labelfunction respectively ...is there a way to tell on mylist.itemClick if the user has clicked on the icon or the labelText ? Both ListEvent.target and ListEvent.currentTarget are mx.controls.List ...is there any other property i can look at ? I even tried my own simple MyListItemRenderer but myClickHandler is not invoked! public class MyListItemRenderer extends ListItemRenderer { private function myClickHandler(e:MouseEvent):void{ trace('myClickHandler invoked'); } override protected function commitProperties():void{ super.commitProperties(); if(icon){ trace('icon is NOT null'); icon.addEventListener(MouseEvent.CLICK,myClickHandler); } else { trace(' icon is null'); } } }
[flexcoders] Icon Click and iconFunction on ListItemRenderer
I am using a simple List with icons and labelText using the iconFunction and labelfunction respectively ...is there a way to tell on mylist.itemClick if the user has clicked on the icon or the labelText ? Both ListEvent.target and ListEvent.currentTarget are mx.controls.List ...is there any other property i can look at ? I even tried my own simple MyListItemRenderer but myClickHandler is not invoked! public class MyListItemRenderer extends ListItemRenderer { private function myClickHandler(e:MouseEvent):void{ trace('myClickHandler invoked'); } override protected function commitProperties():void{ super.commitProperties(); if(icon){ trace('icon is NOT null'); icon.addEventListener(MouseEvent.CLICK,myClickHandler); } else { trace(' icon is null'); } } }
[flexcoders] HorizLine btween last 2 datapoints of a PlotChart[CategoryAxis DateTimeAxis]
I have a PlotChart whose Horizontal axis is a CategoryAxis and Vertical axis is a DateTimeAxis. Each dataPoint is plotted against Category[like Apple,Mango] verses DateTime[like 01-Jan-08,01-Feb-08,06-Mar-09 ] There could be more than one datapoint for each category. Now what i am looking for is a Straight horizontal line between the last two datapoints for each of the Category. In short,I am looking for one horizontal line per Category but it should appear only between last 2points The regular Plotchart is done and working fine. I am looking for some ideas on how to implement this Stroke bold line (should be clickable) between the last two datapoints. Thank You.
[flexcoders] Unique values on the CategoryAxis
How do i make the CategoryAxis show only unique values In my example, I dont want the Apple to apear twice on the vertical axis. ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute mx:Script ![CDATA[ import mx.controls.Alert; import mx.collections.ArrayCollection; import com.adobe.utils.ArrayUtil; [Bindable] public var someData:ArrayCollection = new ArrayCollection([ {editedEndDate:01/01/2006, mpid:GRAPES, modelId:1}, {editedEndDate:05/01/2007, mpid:APPLE, modelId:23}, {editedEndDate:11/01/2009, mpid:APPLE, modelId:160}, {editedEndDate:05/01/2008, mpid:ORANGE, modelId:4}, {editedEndDate:05/01/2009, mpid:MANGO, modelId:5} ]); [Bindable] public var uniqueArr:Array = [GRAPES,APPLE,ORANGE,MANGO]; private function uniqueMPIDFunc(axis:CategoryAxis, item:Object):Object { if(ArrayUtil.arrayContainsValue(ArrayCollection (axis.dataProvider).toArray(),item.mpid)){ Alert.show(exist:+item.mpid+:); return new Object(); } else { Alert.show(new:+item.mpid+:); return item.mpid; } } ]] /mx:Script mx:Panel title=DateTimeAxis width=100% height=100% mx:PlotChart id=mychart dataProvider={someData} showDataTips=true mx:horizontalAxis mx:DateTimeAxis dataUnits=days / /mx:horizontalAxis mx:verticalAxis mx:CategoryAxis dataFunction=uniqueMPIDFunc/ /mx:verticalAxis mx:series mx:PlotSeries yField=mpid xField=editedEndDate displayName=myData/ /mx:series /mx:PlotChart /mx:Panel /mx:Application
[flexcoders] Re: Unique values on the CategoryAxis
Thanks Tim, the hardcoded uniqueArr as dataprovider works but it doesnt work when i try to use it as a derived function as follows. ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute mx:Script ![CDATA[ import mx.controls.Alert; import mx.collections.ArrayCollection; import com.adobe.utils.ArrayUtil; [Bindable] public var someData:ArrayCollection = new ArrayCollection([ {editedEndDate:01/01/2006, mpid:GRAPES}, {editedEndDate:05/01/2007, mpid:APPLE}, {editedEndDate:11/01/2009, mpid:APPLE}, {editedEndDate:05/01/2008, mpid:ORANGE}, {editedEndDate:05/01/2009, mpid:MANGO} ]); //[Bindable] //public var uniqueArr:Array = [GRAPES,APPLE,ORANGE,MANGO]; [Bindable] private var _uniqueArr:Array = new Array(); public function set uniqueArr(arry:Array):void{ _uniqueArr = arry; } public function get uniqueArr():Array{ _uniqueArr = new Array(); for each( var o:Object in mychart.dataProvider){ Alert.show(o.mpid.toString()); if(!ArrayUtil.arrayContainsValue(_uniqueArr,o.mpid)){ //Alert.show(o.mpid.toString()); _uniqueArr.push(o.mpid); } } return _uniqueArr; } ]] /mx:Script mx:Panel title=DateTimeAxis width=100% height=100% mx:PlotChart id=mychart dataProvider={someData} mx:horizontalAxismx:DateTimeAxis dataUnits=days //mx:horizontalAxis mx:verticalAxismx:CategoryAxis dataProvider={uniqueArr} //mx:verticalAxis mx:seriesmx:PlotSeries yField=mpid xField=editedEndDate displayName=myData//mx:series /mx:PlotChart /mx:Panel /mx:Application -VM --- In flexcoders@yahoogroups.com, Tim Hoff [EMAIL PROTECTED] wrote: Hi Vijay, This will get rid of your duplicate Apple. mx:CategoryAxis dataProvider={uniqueArr}/ Although you have the uniqueArr hardcoded, you can derive that from the data. -TH --- In flexcoders@yahoogroups.com, Vijay Anand Mareddy vam2@ wrote: How do i make the CategoryAxis show only unique values In my example, I dont want the Apple to apear twice on the vertical axis. ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute mx:Script ![CDATA[ import mx.controls.Alert; import mx.collections.ArrayCollection; import com.adobe.utils.ArrayUtil; [Bindable] public var someData:ArrayCollection = new ArrayCollection([ {editedEndDate:01/01/2006, mpid:GRAPES, modelId:1}, {editedEndDate:05/01/2007, mpid:APPLE, modelId:23}, {editedEndDate:11/01/2009, mpid:APPLE, modelId:160}, {editedEndDate:05/01/2008, mpid:ORANGE, modelId:4}, {editedEndDate:05/01/2009, mpid:MANGO, modelId:5} ]); [Bindable] public var uniqueArr:Array = [GRAPES,APPLE,ORANGE,MANGO]; private function uniqueMPIDFunc(axis:CategoryAxis, item:Object):Object { if(ArrayUtil.arrayContainsValue(ArrayCollection (axis.dataProvider).toArray(),item.mpid)){ Alert.show(exist:+item.mpid+:); return new Object(); } else { Alert.show(new:+item.mpid+:); return item.mpid; } } ]] /mx:Script mx:Panel title=DateTimeAxis width=100% height=100% mx:PlotChart id=mychart dataProvider={someData} showDataTips=true mx:horizontalAxis mx:DateTimeAxis dataUnits=days / /mx:horizontalAxis mx:verticalAxis mx:CategoryAxis dataFunction=uniqueMPIDFunc/ /mx:verticalAxis mx:series mx:PlotSeries yField=mpid xField=editedEndDate displayName=myData/ /mx:series /mx:PlotChart /mx:Panel /mx:Application