Dienstag, 20. November 2007

Get data from a WebService

Getting data from a webservice is pretty easy, but the first time I had the problem that the ResultEvent object had two different definitions, one when there is only one line in the table and the second when there is more than one line in the table.
When the query returns only one line the type of the event.result object is ObjectProxy, if the query returns more than one line the definition is an Array.
I can check this with a very simple static function that I put in an utility class. The function looks like this:


public static function IsObjectArray(obj: Object): Boolean
{
var className: String = ObjectUtil.getClassInfo(obj).name;
if (className=="mx.collections::ArrayCollection"){
return true;
}
return false;
}



Now when you getting data from a webservice you only have to do things link this:


private function getSomeDataFromMyWebservice(event: ResultEvent): void{
if (event.result){
if (.IsObjectArray(event.result)){
for each(var item: Object in event.result){
}
}else{
//event.result is from type Object.
}
}

Sonntag, 11. November 2007

Flex Builder 3 Beta 2 design view doesn't show anything

I had this problem a few times. I thought it came from my own designed components but it also happened in my application component. Here is a link to solve this problem... The solution is pretty easy and works fine!

Mittwoch, 7. November 2007

SQL Script : Export Database

Here is a SQL Script that I use to export all the data from one MSSQL database to an other MSSQL.
It's very usefull when you quickly want to have the same database on your development machine but you are not able to backup the original database, because you don't have enought rights.

The file can be download here

Mittwoch, 31. Oktober 2007

Preloader in Flex 3 beta 2

Since the new beta release of the flex framework, the preloader wasn't working anymore. It looks like the problem has been solved in one of the nightly build pre-release of the sdk.
For more information please follow the links

Nightly build web site download build number 184063.

Where the bug was reported and the adobe solution here

Full sample code here

Samstag, 6. Oktober 2007

Custom preloader

Like a lot of people I wanted to add my own preloader in my application. In my google searches I found a very helpfull post from Ted Patrick here. In some ways it was a very good explanation about how the whole thing works but something was missing... the progress bar!

Here is my custom preloader example. Hope this while help.







Some stuff need to be added. for example the percent progress label. If someone is quicker than I to implement it please post a link in the comments.

PS: Right click and select "View Source..." to see how the things are working together.


New Sample with progress percent here