Dienstag, 25. März 2008

Create an OLAPCube in Actionscript

Great post about how to create an OLAPCube object in Actionscript. Very usefull when you keep it mind that you increase the query performance by only addings the levels and informations you need for your query.

Click here

Donnerstag, 10. Januar 2008

Custom preloader final version

Code updated!




I finally find 10 minutes to try to put a progress information in the progress bar control.
The solution was to use a TextField objet write some stuff in it, use a BitmapObject to copy the TextField object into it and then draw the new created BitmapData object on the big one.
Here is the code to only draw the progress text:

var textField: TextField = new TextField();
textField.htmlText = m_Progress.toFixed(0) + "%";
var textBitmapData: BitmapData = new BitmapData(textField.textWidth + 5, textField.textHeight);
textBitmapData.floodFill(0, 0, ProgressBarBackground);
textBitmapData.draw(textField);
var textBitmapMatrix: Matrix = new Matrix();
textBitmapMatrix.translate(px + (containerWidth) / 2, py + (ProgressHeight - textBitmapData.height) / 2);



The full source code can be found here . (Right click somwhere and select "View code..." to see the source code)

As usual, if someone improve the code please post a comment.

UPDATE:

Thanks for the info there is something wrong with the "view source..." function.
I added an archive file with the source code. this can be found here
Sorry for this.

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