Archive for the ‘Flex’ Category

Filter Data with ArrayCollection

Jun
6

After watching a Lynda.com tutorial realized I didn’t have to do as much work to filter data.

the filterFunction is a public property of the ICollectionView witch is the class that the ArrayCollection extends from.

So this function/method is accessible to a ArrayCollection.
[as]

< ?xml version="1.0" encoding="utf-8"?>

< ![CDATA[
import mx.collections.*;

private var collectionArray:Array;
[Bindable]
private var collectionData:ArrayCollection;

private function init():void
{
collectionArray = [{first: 'Dave', last: 'Matthews'},
{first: 'Amy', last: 'Grant'},
{first: 'Bilbo', last: 'Baggins'},
{first: 'Jessica', last: 'Tandy'},
{first: 'Paris', last: 'Hilton'}];
collectionData = new ArrayCollection(collectionArray);
}

public function filter():void {

//pass my filter function to the method w/ no ()
// you must also refresh it
collectionData.filterFunction = filterFirst;
collectionData.refresh();

}
// function see's if the searchField's text is equal to the "first" object of the collectionData

//if true it show results, if false it shows nothing
private function filterFirst(item:Object):Boolean
{
return (item.first == searchField.text)

}
]]>
[/as]

Problems w/ this:

  1. I have not found a way to match with just typing in “Da” and it is case-sensitive
  2. When you type in a non-matching string it will not reset to beginning state. (I’m sleepy so maybe that’s why I can’t figure it out.)

Programmin Flex 2 pre-review

May
6

Programming Flex 2 imageI have been reading O’Reilly’s new book Programming Flex 2: The comprehensive guide to creating rich media applications with Adobe Flex. I’m enjoying it, I’m trying for this to be the first programming book I read cover cover and don’t just read the first 2 chapters and then act like I know what I’m doing. After 5 days I’m on chapter 8/19.

I like the book it reads well and is not confusing at all. When the book finally came in my Barnes and Noble, after a month and a half delay, this past Tuesday; I was hesitant to us my gift card on a book that may tell me the same stuff I can find on Adobe’s quick start pages. I thought I really want to learn Flex. No just from a going through the motions sence but know when, why and where I’m using components or Flex all together. The only way know to that is reading, not copy and pasting. The book has already given me some ideas for an Apollo app for work. I’m now realizing what Flex if for.

I’ll post when I finish it to give a final review.

SecurityError: Error #2122. Anyone?

May
5

This guy lays it out on how to stop that stupid error in Flex 2.0.

http://tinyurl.com/2ytl43