Tag: flex

Filter an ArrayCollection and don’t lose the original data

by Alberto González on May.02, 2009, under ActionScript, Adobe AIR, Adobe Flex, Coding, Tips & Tricks

Yesterday, one of my students asked me about recovering the original data of an ArrayCollection if this ArrayCollection has a filter applied.In Adobe Flex, the ArrayCollection class has a property called filterFunction. We can assign a function reference directly to this property and then apply a refresh() to the ArrayCollection instance.This is an example.

// Defining the ArrayCollection instanceprivate var ac:ArrayCollection = new ArrayCollection([{label:"Adobe Flex", data:"Fx"},{label:"Adobe Flash", data:"Fl"},{label:"Adobe After Effects", data:"Ae"},{label:"Adobe Flash Player", data:"fp"}]);//Defining the filter functionprivate function flashFilter(obj:Object):Boolean{return obj.label.toLowerCase().indexOf("flash") != -1;}//Applying the filterac.filterFunction = flashFilter;ac.refresh();

Once the filter is applied, the ArrayCollection hides all the objects that don’t pass the validation in the function and shows the objects that do.
An ArrayCollection stores internally an instance of the Array class. You can see that in the previous example where I place an array inside the constructor of the ArrayCollection.
An ArrayCollection acts as a “wrapper” for the array instance enabling functionality that belongs to collections and lists. This functionality can be, filtering, sorting, add/remove/modify data and more.
After you filter an ArrayCollection instance the “wrapper” only shows the unhidden objects and it seems like it only has 2 elements (in my example), I mean if you test the “length” property after the filter you will see that it shows the value 2. But we know the truth, the ArrayCollection actually has 4 elements. If you want to get back this 4 elements without clearing the filter you have to deep into the ArrayCollection and find the source. This source, as I said previously, is an Array.
You will find the source using, in fact, the “source” property of the ArrayCollection. The array that will give you this property is the complete set of data that the ArrayCollection is storing without any filter. Just don’t forget that “source” is giving you an instance of an Array and not an instance of an ArrayCollection.

//continuing the previous example...//Applying the filterac.filterFunction = flashFilter;ac.refresh();//Test the length property of the ArrayCollectiontrace(ac.length); // 2//Test the source property of the ArrayCollectiontrace(ac.source) // [object Object],[object Object],[object Object],[object Object]//Test the length property of the source propertytrace(ac.source.length) // 4
6 Comments :, , more...

Adobe Flex 3 and AIR certification exam now available.

by Alberto González on Nov.01, 2008, under Adobe AIR, Adobe Flex, General, New Releases, Training

Well, good news for everyone who was waiting for the new certification in Flex 3 or AIR.
Few days ago Adobe released the ACE certification exam for Flex 3 and AIR (just one exam for both of them) and you can get all the information in certified community at Adobe.com.
The price of the exam is US$ 150 as usual and right now is only available as Certification exam and just in Pearson VUE not re-certification exam.
I don’t really know if there will be re-certification for Flex 3 because it’s an enterprise Technology and because the AIR certification is included in the exam, not just Adobe Flex.
Good luck everybody.
Versión en español de este por la pueden encontrar en -> http://riactive.com/2008/11/01/flex-3-y-air-certification-nuevo-examen-de-certificacion/.

5 Comments :, , more...

Zend and Adobe ( PHP and Flex )

by Alberto González on Sep.16, 2008, under Adobe Flex, General, New Releases, Technology

There are many people that use to work with Flex in the front layer and Java in the back layer, other people work with Flex and .NET but others usually work with Flex in front end and PHP for back end. I mean, you know that PHP is a very popular language as If you develop web pages / applications you must know at least how PHP works, who hasn’t created a typical mail sender for a contact page in a site?, well, now is time for integrating PHP with Adobe Flex.
Zend Technologies (The PHP Company) made an announcement saying that it’ll be collaborating with Adobe Systems Inc. for a better integration and performance of Flex applications that will be using PHP where one of the key features will be the integration of Action Message Format (AMF) Support in the Zend Framework.
You can read the complete article directly from Zend here and a review from the official flex team here.
I just wanna share this with you people. I’ll be waiting for the changes and improvements between this techs.
Regards.

2 Comments :, , , , more...

Profiling Flash Applications with Flex Builder 3

by Alberto González on Aug.03, 2008, under Adobe Flash, Adobe Flex, Tips & Tricks

If you use to create Flex Apps I’m almost sure you profile your applications with Flex Builder or with another tool related to. This time I’ll talk about profiling applications.
Profiling an application means to inspect the elements that your application is running, how much memory you application is consuming, how many instances of each class your application is executing and more information. You can compare memory snapshots of the same application but in different execution time, etc.
You can profile with Flex Builder any application generated as swf file, this includes Flex Applications, Flash Applications/Web sites/animations and any swf created with any tool that has the capability to export the project as swf file.
Before you profile an application you must ensure that the swf file has been compiled with debugging capabilities. Flex does this job for you every time you run, debug or profile your application from Flex Builder, but in Flash this doesn’t happen. You must explicitly tell Flash that your swf must be compiled for debugging. You can do this from the publish settings panel. In the flash tab you have a checkbox unselected by default which says “Permit debugging” and you must turn it on.
Flash debug option
When you turn on this option your application will be compiled with the compiler argument “debug=true”. (You can also compile your application directly with that compile argument if you have a Flash Compiler). The compiler will embed to the swf file information needed for debugging the application, also it will try to connect the application by socket to a socket server when it starts. Flex Builder starts up that socket server when you profile or debug a swf file from Flex Builder with the green buttons in the toolbar, so, as you can imagine, you should first start up the server and then execute the swf file.
From Flex builder you have to profile an external application. You will find this option in the Menu bar – Profile – Profile External Application. This will launch a pop up window that will ask you for the swf file of the application you want to profile. You also have the option to just prepare Flex Builder for profiling and let it wait for the application to execute and connect to Flex Builder (for this you have to choose “Launch the application manually outside Flex Builder”). I will emphasize the first option which profiles directly the selected application. In this window you can browse for the swf file compiled previously in Flash or Flex with the debug option and then you just launch the profiling process and that’s all.
Flex Profile External Option
Select swf file
Don’t forget to turn off the “Permit debug” option from Flash or clear the “debug” compile argument in production mode because someone could debug you application remotely from his computer.
Enjoy it.

5 Comments :, , , more...

Software Guru’08 Conference and Expo day 3

by Alberto González on Jun.23, 2008, under Adobe Flex, General

Today was the 3rd day in Software Guru 08 Conference and Expo. This time there were a lot of conferences related to project management, strategies for building software , technology, process improvements and more.
I attended to some sessions about, Share Point from Microsoft, Agile Modeling with UML, project management and a Rich Internet Applications conference where there were people from Adobe introducing Adobe Flex, Microsoft presenting Microsoft Silverlight, IBM talking about the web standards and Sun talking about JavaFX.
That was really good, many people were in the room, in fact, I embed some videos about that conference where you can see the quality and samples that were shown.
There was also an expo where some companies show their products, solutions and their offer to people that could be looking for business and providers.
Tomorrow it’ll be the last day of conferences and I hope I could have more pics from there. Here you have some media about the event.





Leave a Comment :, , , , , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!