$text = String.new “World”

print “Hello #{$text}”

Archive for the ‘Flex’ Category

About Adobe Flex.

Offline Silverlight

Posted by siegem on March 4, 2008

That’s nice to know from Ryan Stewart that Microsoft would want to make Silverlight work offline, something may come in the MIX convention next week, or not. It’s good for developers to have a broad list of technologies to choose when creating some application, specially one as good as silverlight.

Silverlight is a browser plugin that let developers create rich internet applications using any .NET language. It make possible to develop using animations, sound and data access, dynamically loading XML data into the application and manipulating it with DOM interface. The control of XML content on Silverlight is similar to the way it’s done in Ajax, but it seems that is a lot faster if compared to the JavaScript way, as Michael Arrington wrote on TechCrunch. Take a look on the previous link to know more about Silverlight.

It seems that Microsoft want to compete with Adobe on creating RIAs that can be accessible on the desktop, like the AIR runtime environment. There’s a controversial point here where some people consider Silverlight more like Flash than the technology applied on Flex and integrated with AIR. I believe that the two are nice platforms and have their own strengths, but I only tested Flex until now, maybe I will play with Silverlight a little to know it better.

What do you think? Can Silverlight be as good as AIR, or it can’t be compared.

Posted in Browsers, Flex, SilverLight, Technology, Web | Tagged: , , , | Leave a Comment »

Popup on Flex

Posted by siegem on February 18, 2008

These days I was playing with PopUpManager component on Flex. I was searching for some way to create Popup windows, in the moment for a Login screen, and came across this component.

It’s simple to use, you need only to import it on the script and use it directly. There are four things that you can set on a popup from the component, you can add a popup to the Manager, put a window on the top of others, center it and remove it from the Manager.

I will put some examples here. Let’s first consider creating a popup, we need to extend some component to create a container for the popup.

In this sample, we will use the TitleWindow component as the extended component. Before it’s creation, we need to set up some properties, we will leave it with the default.

Next, we need to set up some basic behaviourof the window, like it’s title, show it’s close button and the code that will take place when someone closes the window. To set all these things up we will need to do the following:

  1. On the TitleWindow component set the parameter “showCloseButton” to true and set the function that will be called when the event “close” is captured (it can be anything, be creative);
  2. In the script component, you need to add the definition of the function you set to the close event and code the “PopUpManager.removePopUp(this)” to close the window, you can add some other code too;
  3. You can add, if you want, a title for the window using the”title” attribute.

With the new component implemented, we can now go to the main program and instantiate it to create the popup window, but, to achieve this, we can use two ways. In the first, we create an instance of the component you created and then add it to the PopUpManager, in the second, we use the PopUpManager to create the instance to us, then we cast it to the type of our component and send it to an empty variable.

The first way is done with this code:

var bar:foo;
bar = foo(PopUpManager.createPopUp(this,foo,true));

Being foo my customized component based on TitleWindow and bar the variable that will contain the instance of the popup. The first parameter is the parent component, the second the component type of the window to be created and the third is the modal definition (if other popups will be avaliable while this one is opened).

The second way:

var bar:foo = new foo();
PopUpManager.addPopUp(bar,this,true);

Being foo the same as above and bar the instance of the component, but this time we do instantiate it and only send it to the PopUpManager. The way you choose is almost identical, it’s up to you if you need to instantiate it manually or let the manager create it to you. In this case, the parameters changed a bit, the first is the component instance, the second the parent and the third is the modal definition, again.

I saw some usefulness in the second if your component have some parameters to be sent on the constructor, but I’m still meditating about it. Some day it can become one post or half…

Best Regards!

Posted in Flex, Howto, Technology | Tagged: , , , | 2 Comments »

Get FLEXible!

Posted by siegem on January 31, 2008

I loved Flex the first time I saw it’s framework open and the first tags appeared in my screen! It’s increadible how you can manage ActionScript classes with MXML (XML-like user interface language) and extend these classes to create RIAs (Rich Internet Applications) based on Flash that can be built on the fly usign the AJAX Bridge.

You can, using Flex, create applications that access REST and Web Services to retrieve XML information and present it in a Flash like way, with standard components or create your own. It’s simple to use, flexible to customize and powerfull to use.

Enough of my personal impression. I will show a simple Flex application and you take your own conclusions.

There we go! We are using here six MXML tags to create this example, there are: Application, HBox, Tree, VBox, TextArea and XMLList.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:HBox left="40" top="40">
<mx:Tree dataProvider="{TreeData}" labelField="@label" width="200"
height="500" change="output.text = event.currentTarget.selectedItem.@label;"/>
<mx:VBox>
<mx:TextArea id="output"/>
</mx:VBox>
</mx:HBox>
<mx:XMLList id="TreeData" xmlns="">
<item label="Item 1">
<item label="Item 1-1"/>
<item label="Item 1-2">
<item id="item121" label="Item 1-2-1"/>
</item>
</item>
<item label="Item 2"/>
</mx:XMLList>
</mx:Application>

Resulting in this:

Example 1

As you can see, it’s simple to create a RIA in some minutes using this powerfull tool, that can be customized in many ways to suit our needs.

Thant’s all folks! Hope you enjoy!

Posted in Flex, Technology | Tagged: , , | Leave a Comment »