Flex :: ArrayCollection Not Returning Absolute Length When Filterfunction Is Applied On It
Apr 24, 2011
My Dataprovider for a grid is an arrayCollection which is dynamically loaded with Objects . for example : a person object with persionID,PersonName ..etc . I applied a filter function on my dataprovider based on personID . below is my function
public function FilterFunc(item:Object):Boolean
{
var same:Boolean=String(item.personID ) == filterpersonID ;
return same;
[Code]....
this function is called whenever a new object is being added to the arraycollection . The problem now is dp.length in the above function is returning only the no of objects of the particular personID on which the filterFunction was applied instead of the absolute value . Its not limiting the size of the other objects which are runnning into thousand's causing memory issues . once i change the filterFunction to different personID , it slowly starts limiting the respective personID objects. So the sizeHandler() limits only the personID objects for which filterfunction was applied instead of the whole objects , this is the problem .
View 2 Replies
Similar Posts:
Jun 13, 2011
I am using Adobe Flash Builder 4 Premium. I have a mx:DataGrid and a s:TextInput, and I am trying to set up a search box that filters the DataGrid on each key press.his page shows a nearly perfect example of what I'm trying to do, except that I'm setting this up in a s:TitleWindow, which is brought up as a popup using the PopUpManager. The list I'm trying to filter can be very large. It is a list of usernames, fetched from a MySQL database via PHP. Since it can be so large, I want the list to be populated once in the main application and then referenced in the popup window so that it doesn't have to fetch all the usernames each time the user opens the popup.I have all of this working fine for the first time you bring up the popup, but if you close it and bring it up again, I get this runtime error:I also get this error if I attempt to set the filterFunction back to null just before closing the popup.See sample code below:
Main Application:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
[code]......
View 2 Replies
Nov 19, 2010
I need to display the number of items in a List component that has a filtered ArrayCollection as its data provider. I don't see a way to get the filtered collection's length.
View 1 Replies
Nov 12, 2009
I would like to put an eventListener on an ArrayCollection's length proprety, but I don't know how to go about this.
I want to do this because I only want code to execute when a certain number of things are in a certain ArrayCollection. I want Flex to wait to execute this code over the next object until that length property drops back to an acceptable level. I think I should do this with events instead of a while loop that sits there spouting NOOPs forever (which I don't know how to do either).
View 2 Replies
Dec 15, 2010
I have a component where I expose the property 'questions' with the following code:
private var _questions:ArrayCollection;
private var questionsChanged:Boolean;
[Bindable("questionsChanged")]
[Code]....
In this component, I use commitProperties() to implement my logic.
I use Cairngorm and the 'questions' is in the model and hence it's defined as a source for data binding.
When the 'questions' ArrayCollection's size changes elsewhere in the application, it is not invoking the setter method in the component that is destination for the data binding.
View 1 Replies
Mar 17, 2011
How to filter an Arraycollection by "array of values" rather than a single value (simple comparision) , the below code snippet is for filtering by single value now I went into scenario like filter out only price [10,4,1,8] (some random values from the master collection). Is there any better way to do the second code snippet
[Code]...
One point I haven't mentioned is my items in the filterBy array are custom data not the basic datatypes.
View 3 Replies
May 23, 2011
I have seen numerous examples on how to remove duplicates in ArrayCollection but I can't seem to transpose this to XMLList. In most ArrayCollection examples, the example compares the key of the array with hasOwnProperty method and return a bool. That's fine, but what would I compare to when using an XMLList? Let's say I have:
[Code]....
View 2 Replies
Oct 27, 2009
I'm new to Flex and am using TileList bound to an ArrayCollection. The array collection is empty at load time, and then updates with the results from am HTTPService call. The problem is that the item renderers aren't being rendered as expected, I'm guessing because there was no data when they were first rendered at load time. Here's simplified example:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" >
<mx:Script>
[code].....
View 2 Replies
Oct 9, 2010
I looked around, and the latest reference I saw was from 2008 stating that the standard FileReference browser does not support retrieving the user's file's absolute local path unless it's an AIR app, and indeed there's nothing in the docs suggesting otherwise. The reasoning behind this is apparently some misguided security concern... I get it's not a great idea to let any Flash app know your directory structure, but if the user actually grants your app a file, I think it doesn't invalidate the security model to know just that file's absolute path.
I'm wondering if the state of things has changed at all with Flex 4 and there's a method of getting the local filename of anything. I need it because I'm making an application that when distributed runs locally in 99% of cases, so doing a full file upload just to save it somewhere else on the local machine seems silly. (Plus the standard file uploading method doesn't support SOAP, which is what I'm using for all my other services...)
View 2 Replies
Aug 21, 2009
filterFunction is a method to apply a filter on the content of a collection.But the filter is not apply into the orginal Array (the one which use in the ArrayCollection) So, after apply a filterFunction, the original Array lenght doesn't change, neither the content because the Array is not update; Only the Arraycollection does changes after filterFunction method.is there anyway to synchronise the content of an arraycollection with an array ?
View 2 Replies
Apr 5, 2012
I have many dropdowns in my flex application. Now I want to set rowCount property so that as many rows as possible so there is less scrolling when see the dropdown items.The flex application was running on a popup window. So I think I have to know the distance from dropdown to bottom border of window, and then calculate what number should be for the rowCount. Like Height/per row height.As I known, the dropdown.y is the relative y coordinate of itself. But my dropdown has many parent UI layout component, and also I have many dropdowns, it is hard to calculate one by one.
View 1 Replies
Jan 5, 2010
I am working with Flex, and I need to take a relative URL source property and convert it to an absolute URL before loading it.
The specific case I am working with involves tweaking SoundEffect's load method. I need to determine if a file will be loaded from the local file system or over the network from looking at the source property, and the easiest way I've found to do this is to generate the absolute URL.
I'm having trouble generating the absolute URL for sound effect in particular. Here were my initial thoughts, which haven't worked.
Look for the DisplayObject that the Sound Effect targets, and use its loaderInfo property. The target is null when the SoundEffect loads, so this doesn't work.
Look at FlexGlobals.topLevelApplication, at the url or loaderInfo properties. Neither of these are set, however. Look at the FlexGlobals.topLevelApplication.systemManager.loaderInfo. This was also not set.
The SoundEffect.as code basically boils down to
var url:String = "mySound.mp3";
/*>> I'd like to convert the URL to absolute form here and tweak it as necessary <<*/
var req:URLRequest = new URLRequest(url);
var loader:Loader = new Loader();
loader.load(req);
I would also be perfectly satisfied with some way to tell whether the url will be loaded from the local file system or over the network. Looking at an absolute URL it would just be easy to look at the prefix, like file:// or http://.
View 1 Replies
Feb 14, 2011
With flex 4 you can't seem to just do layout="absolute" any more. Is there a way to get the application layout set as absolute in flex 4?
View 2 Replies
Feb 24, 2011
How do I change the CSS rules for a TextField that already has style associated with it ?
This TextField is inside a RichTextEditor.
Here's the code I'm trying:
_rSts: StyleSheet = new StyleSheet();
_rSts.parseCSS('font {font-family:Verdana; font-size:12;}');
_rTextField.styleSheet = _rSts;
but when I assign the new StyleSheet to the TextField it throws an exception stating that I cannot assign a style to an element already containing a style.
View 1 Replies
Jan 4, 2011
To situate things I am working on a translation utility with a datagrid having 3 columns : translation code, reference text and target text.
The DataGrid's dataProvider property is bound to an ArrayCollection instance. The user can edit the grid and on a successful edit, the underlying collection is updated using the setItemAt() method. The collection also has a filter function to make it easier to find certain texts.
When the user clicks the 'apply filter' button the filter function is updated. This works well. The problem I have is that rows are hidden as soon as the underlying collection item change in a way that doesn't comply with the filter. The row is hidden immediately, which is not very user friendly. Rows should only hide (or be shown) when the 'apply filter' button is pressed.
View 2 Replies
Jan 5, 2011
I load image to control than I applie some effects, and when I save image it's saving without effects. What should i do?
Here is the code:
private var byteArr2:ByteArray;
private var fileRef:FileReference = new FileReference();
public function process():void
[Code].....
UPDATE Appears new problem as I am using var data:BitmapData = new BitmapData(currImg.width, currImg.width); saved image is small(size like image control) but I need to save image with original size. With var data:BitmapData = Bitmap(currImg.content).bitmapData; it worked
View 2 Replies
May 13, 2010
Is there a way to rewite (or hijack) an absolute URL request made from a flash (swf) file in a browser?I have a flash application that is requesting URL..The code in the flash application cannot be changed but I want to be able to either use another flash or some javascript to write that URL as the image is beging requested - to something like URL...
View 1 Replies
Oct 7, 2011
I have a advanced datagrid and populating some data by using arraycollection. And i am filtering the arraycollection, the arraycollection index got changed.
Arraycollection:- [0] - name: abc
[1] - name: hello
[2] - name: hello1
[3] - name:hai
after filtering the arraycollection as 'hell' , the array collection is displaying like the below:
Arraycollection:-
[0] - name: hello1
[1] - name: hello
Can i know the reason why the index got changed after filter it?
* no server side code for filtering. it is only flex side filtering.
View 2 Replies
Mar 22, 2010
I am observing a problem with how an embedded font is applied to certain Flex components, namely mx:Label and mx:DataGrid. I have a CSS that declares three variations on an embedded font as follows:
@font-face
{
src:url("buttons.swf");
[Code].....
(I've snipped some stuff from both style rules, so if you think there's something that may be causing a conflict I can certainly post the entire definition. It's mostly color, line and padding stuff for the DataGrid.)
The problem that is for both Label and cells in the DataGrid the text is being rendered as sort of a times new roman font. The headers in the DataGrid are fine, just the text in the cells is wonky. All other components use the correct font as defined in the CSS/SWF.
View 1 Replies
Oct 4, 2011
I'm testing some font embedding in Flex 4. Using the tutorial below (modified a bit), I'm loading in fonts via compiling CSS into SWFs. [URL] When I apply those styles to my Flex components all is well, however, I need to add an AS3 component to my Flex app. This component has some Flash text fields in it. The only way I know to embed fonts in AS3 is completely different and I believe requires another load. What I want to know is if there is any way that the text fields in my AS3 component can use the same styles and embedded fonts that the Flex components are using.
View 1 Replies
Dec 21, 2011
I'm having issues with implementing a flex button componentI have applied a CSS style to button and set border-color to, say #555555.So far, it works as expected.Then, when my application is resized, the border of the button component becomes blurred and its width automatically changes from 1 pixel to 2 pixels, which doesn't look very well.hen I maximize the app again, after the border is blurred, the buttons' border becomes 1 pixel and looks nice.
View 1 Replies
Oct 27, 2009
how would the 3-tier architecture be applied in a Rich Internet Application?I thougt that flex was presentation, .net web services where busines and informix was data. But then when I started I feel that I must be wrong.
View 1 Replies
Mar 9, 2011
Let's say I have array foo and a positive integer y, where foo.length > y.I want to remove elements from foo so that foo.length becomes y (or very close to it).Also, I need to preserve the first and last element of foo. The indices of the removed elements must be spaced apart as equally as possible. Foo can be sliced, or it can be used to create a new array.
Example: if foo = [a,b,c,d,e,f,g,1,2,3,4,5] and y = 6, then trimmedfoo could be [a,c,e,g,2,4,5] or maybe [a,c,e,2,4,5], but not [a,c,e,g,2,4] because the last element of foo is missing.
View 4 Replies
Dec 22, 2011
how to do this
function foo(x:*, ...args):* {
}
function bar(x:*, ...args):* {[code].....
how to expand args ? when I call bar(1,2,3), I wish it call foo(1,2,3), but it call foo(1,[2,3])
View 2 Replies
Apr 19, 2011
Is there any way to determine if a (anonymous) function has defined the ...(rest) parameter in ActionScript 3? I know there's the function.length property, but it only counts the explicitly defined arguments.
View 2 Replies
Feb 4, 2011
i have a problem using the itemRenderer functionality. When using an ArrayCollection the visible Data in the DataGrid using the itemRenderer will be rendered just fine. But if i start scrolling the entries are repeating in the cells using the renderer. The cells are not filled with date according to the id. What mistake i'm doing here.
I read a lot of the explainations like:
[URL]
here is the code for the set data function (itemRenderer is extending HBox):
override public function set data(value:Object):void {
_data = value;
if(data!=null)
[code]....
View 1 Replies
Dec 16, 2004
I am trying to get the length of arrays within an array, here is my example (MX 2004):
[Code]...
I get an output of of 3. the number of variables within the first array, this is not what I had expedted.
View 2 Replies
Apr 20, 2010
the applicable differences between an ArrayCollection and a Vector in flex? I'm unsure if I should be using one over the other. I saw that Vector is type safe and that makes me feel better, but are there disadvantages?
public var ac:ArrayCollection = new ArrayCollection();
versus
public var vec:Vector.<String> = new Vector.<String>();
View 4 Replies
Oct 31, 2009
I am trying to save settings to an XML File and setting the relevant data if the check box is checked or not.
private static function createXMLData():void
{
prefsXML = <preferences/>;
prefsXML.application.@windowsstart =
[Code]....
well i assume that is what the error means, it cannot get details of something that is not set yet.. so how would i get it to check and if nothing then it is obviously a "false".
View 5 Replies
Dec 21, 2009
Say I have four sub-classes of 'Car'. One for each color. I want to have one function that can build and return a 'color-car' sub-class based on the passed value. This is a dumb example, I know, but it is precisely what I am trying to do only on a smaller scale.
public class Car
{
}
public class BlueCar extends Car
[code]....
Ok. You get it. This doesn't work for a reason unknown to me. I get 1118 errors which complain about conversion of BlueCar into Car, etc...
View 4 Replies