Posted by Kyle | Posted on 09-01-2009
Category : Actionscript, Flex/Flash/AIR
I came across an issue in Flex where I was unable to set my filterFunction=null to bring back all data after it had been filtered. I was trying to use this on my reset function:
private function resetFilter():void {
advancedDataGrid.dataProvider.filterFunction = null;
advancedDataGrid.dataProvider.refresh();
}
Previously, when my dataprovider had been a simple ArrayCollection that would have worked fine. When using a groupingCollection you must do this:
private function resetFilter():void {
advancedDataGrid.dataProvider.filterFunction = returnAllItems;
advancedDataGrid.dataProvider.refresh();
}
private function returnAllItems(item:Object):Boolean {
return true;
}
This workaround will allow your grouped data to return to its original state.
Posted by Kyle | Posted on 06-01-2009
Category : Actionscript, Flex/Flash/AIR
I came across the need to convert a comma delimited string into an Array in AS3 today, and surprisingly the answer did not pop up on Google like I would have thought. First we start off with a string:
myString = "1-John,2-Barry,3-Stacy,4-Bob"
The end result will look like:
myObject[0].name="John"
myObject[0].id="1"
myObject[1].name="Barry"
myObject[1].id="2"
myObject[2].name="Stacy"
myObject[2].id="3"
myObject[3].name="Bob"
myObject[3].id="4"
Actionscript 3 actually makes this task very simple. You first need to use the split() function with a comma delimiter to separate each item and store it within a new array:
var peopleList:Array = myString.split(",");
Next, we create a new object to hold the data and split the data once more using the hyphen:
myObject[0].people = new Array();
for (var x:int=0;x<peopleList.length;x++){
var peopleDetail:Array = peopleList[x].split("-");
var obj:Object = new Object();
obj.id = peopleDetail[0];
obj.name = peopleDetail[1];
myObject[0].people.push(obj);
}
I’m sure there are plenty of ways to achieve this, but it seemed to work for me with not a whole lot of code. Hope this helps someone searching for the answer like I was.
Posted by Kyle | Posted on 23-12-2008
Category : Actionscript, Flex/Flash/AIR, Mate
I’ve been working with Mate for a couple weeks now and I’m still learning how to wrap my head around it. Today I spent about an hour trying to figure out why my events were not dispatching. After debugging, I found they were in fact being dispatched but my eventmap was never picking them up. A coworker of mine mentioned “hey, did you turn on bubbling” and it clicked… I forgot to turn on bubbling when I created the event class. When you are creating any event class, make sure you set bubbles:Boolean=true and everything will work great. One of those things you seem to overlook when in fact should have been the first thing to check. Stupid Brain.
Posted by Kyle | Posted on 02-10-2008
Category : Coldfusion
I recently switched from Coldfusion 7 to Coldfusion 8, and found today that one of my cfqueryparam tags was rounding off my values. My database column has a DECIMAL(3,1) datatype and up until now my inserts/updates have been working fine. Looking at the cf docs I came across the scale attribute, which has a default value of 0. So if you omit the scale attribute, coldfusion will apparently round your numbers. Adding this attribute fixed my problem, as well as changing my cfsqltype attribute to “cf_sql_float”. I’m thankful Coldfusion has great documentation!
Posted by Kyle | Posted on 29-09-2008
Category : Movies/TV
Tags: office wars