Adobe Flex and .NET using WebORB

Two weeks back  got a chance to write a technical article on my present company’s blog where I decided to write something related to my current project where we have an application being developed with Adobe Flex on the front end and .NET as the server side technology. In order to invoke .NET objects into the Flex client we are using WebORB for .NET and my experience with it till now is pretty good.

Check out the article which explains how to create a simple Flex application which communicates with .NET objects using WebORB and also it’s configurations – http://tinyurl.com/weborb-flex

Cheers 🙂

Advertisements

FX4 Event in Ahmedabad

Ahmedabad Flash Platform User Group is organizing a special UG meet named FX4 Event. For the very first time we will have some one from Adobe to speak for the User Groupin Ahmedabad. Sujit Reddy from the Adobe evangelist team will be taking sessions for this event on Flex 4, Flash Builder. Livecycle DS, Flash Player etc.In Ahmedabad since we are only maturing as a user group it is pretty hard to pull out people from their comfort zone to attend such events but I believe events like this will make a change in the mindset of the crowd and we are trying hard to pull in more crowd to this event.

Initially we were a little hung up with the venue since first we targeted a technical institute then due to some wrong communications and the norms of the Institute we had to change the venue two days back to my office premise where we have a pretty decent conference room.Now everything seems to be set and all geared up for the event.Also will be exciting to see Sujit in action.

Often I have heard companies in Ahmedabad stating that we do not get enough of quality Flash/Flex developers from Ahmedabad and I would say as a user group we can help you out and that is why the user group across the world organize such events. Until and unless people get to know some new things/share experience about the technology they work on, there is no scope for improvement at any level. Hope all the companies in Ahmedabad take these events seriously enough to allow their developers/designers to be a part of such event. The event details are as shown below and for registration http://fx4eventahmedabadfug.eventbrite.com/. Fingers crossed and lets hope for the best.

TextArea with dynamic height based on the text

I am sure all the Flex/Air developers might have to use text area most of the times when you are building an application. Text area control with dynamic height seems not be an issue in normal cases but if the height needs to calculated based on text in the control then we need to think. I had the same requirement. Of course no SCROLLS.

I extended mx.controls.TextArea and here is what  I did quickly.

This worked for me.Maybe there is a better way to do this. Let me know if you have tried this in a different way

Cheers. 🙂

Adobe DevSummit, ’09 Hyderabad

I was  busy and  a bit lazy about writing for the last two months 😉 Well,  This was the very first time for me  to attend an event held by Adobe. I always wanted to attend similar developers conferences(in most of the cases the busy schedules do not permit me to attend such conferences) which I believe will make you aware of the new things in the market as well as an introduce you to the enhancement made to platform that you work on. The major thing which you feel after attending such conferences is that it gives you a clear idea on where you stand in terms of the technology of platform that you are working on.

The event held at Taj Krishna, Hyderabad was really a grand one which pulled in huge amount of people from different technical backgrounds. The event started off with the session from Ramesh Srinivasaraghavan, senior scientist @ Adobe about the future of Adobe Flash Platform which was a real inspiration for people like me. Also , the sessions on Flash Catalyst by Harish and about DCD in Flash Builder by Sujit was really rocking. Other sessions from people from Adobe and other community geeks was also interesting. Overall, the event was very informative for the community and an oppurtunity for networking.

It is true and I did feel that sessions become more interesting once the speaker start showing live demos. The audience love it and get more involved.
Looking forward to be there in such events next year.

Encoding & Decoding functions in Flex

The other day one of my colleagues asked me whether do we have any functions inside flex that can encode a URL . Even though it quite obvious that something can be done manually to replace the strings, but in order to find some answers I looked into the Top level packages where I found encodeURI() and decodeURI() . What does these functions actually do?
encodeURI():
This function bascially encodes the string into a valid URI. The following shown below are not encoded by encodeURI() unless it is a small group of basic characters as given in the documentation.

Characters that are not encoded
0 1 2 3 4 5 6 7 8 9
a b c d e f g h i j k l m n o p q r s t u v w x y z
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
; / ? : @ & = + $ , #
- _ . ! ~ * ' ( )

There is another encoding function that is slightly different from encodeURI()encodeURIComponent() which also does the same encoding of strings to URI but.Before we talk about the major difference we should be aware of some terms :

URIComponent: is the text that appears in between any special characters..for eg: http and http://www.google.com are the  URI components in http://www.google.com.
Component Seperatorsare the special characters used in a URI (: ; / ?)

Now coming back to the major difference the encodeURIComponent() in encodes the same as encodeURI() and additionally also encodes special characters (; / ? : @ & + $ , # )

decodeURI():
This function does the exact reverse of encodeURI() , it decodes the encoded URI into string where all encoded characters are restored into unencoded representation.

Escape sequence not decoded Characters equivalents
%23 #
%24 $
%26 &
%2B +
%2C ,
%2F /
%3A :
%3B ;
%3D =
%3F ?
%40 @

Using the decodeURIComponent() the escape sequence in the above table can be decoded.
All the above functions are in addition to the already existing escape() and unescape() functions which were also used in flash.escape() encodes all nonalphanumeric charachters into format % and hexadecimal sequence and unescape() decodes the URL encoded format to string.
So , there are plenty of things to play with when you need some strings to be encoded, each function does look similar but it has some variations which needs to be closely observed.Before concluding here is a small code snippets which includes the usage of above functions:


var redirectUrl:String = "http://www.somedomain.com?loggedin=true& username=Sun";
    
var escaped:String = escape(redirectUrl);
var unescaped:String = unescape(escaped);
    
var encoded:String = encodeURI(redirectUrl);
var decoded:String = decodeURI(encoded);
    
var encodedURI:String = encodeURIComponent(redirectUrl);
var decodedURI:String = decodeURIComponent(encodedURI);
    
trace("escaped: "+escaped); //escaped: http%3A//www.somedomain.com%3Floggedin%3Dtrue%26username%3DSun
trace("unescaped: "+unescaped); //unescaped:
http://www.somedomain.com?loggedin=true&username=Sun
    
trace("encoded: "+encoded); //encoded:
http://www.somedomain.com?loggedin=true&%20username=Sun
trace("decoded: "+decoded); //decoded: http://www.somedomain.com?loggedin=true&username=Sun
    
trace("encodedURI: "+encodedURI); //encodedURI: http%3A%2F%2Fwww.somedomain.com%3Floggedin%3Dtrue%26username%3DSun
trace("decodedURI: "+decodedURI); //decodedURI:
http://www.somedomain.com?loggedin=true&username=Sun


Meanwhile when I was googling more on this, I found out a bug reported to Adobe where it was reported that encodeURI and decodeURI misbehaves with httpservice which is mentioned to be deferred and will be fixed in 4.0 hmm..I am curious to know about your experiences when using these functions…

SimpleXMLEncoder and SimpleXMLDecoder

You might have heard or may be used these classes somewhere in your application where you had to deal with XML data. This classes are simple and pretty useful when you have convert some objects to XML or vice versa.
SimpleXMLEncoder:
SimpleXMLEncoder class takes object and encodes them into XML . This public method encodeValue takes the following as argument:
obj:Object – the object to be encoded
qname:QName  – the qualified name of the child node
parentNode:XMLNode – XMLNode under which the encoded value is put

Now letz try it out

code

and the trace should generate output  XML:

xml

SimpleXMLDecoder:
The simpleXMLDecoder will the do the exact reverse of the encoder with some changes in implementation.
Here the method is decode which takes in instance of XMLDocument as the argument.Now how its done:
decode

and the trace commands will give the output in the console as :
output

So this was a simple implementation example of both the classes …. 😉

AS 2.0 to AS 3.0

Our team is working on some really exciting projects nowadays and in one of them we have to migrate existing AS 2.0 codebase into AS 3.0 in order to improve the performance of the application. This process is quite handful of a job, but it is a great learning experience. This work can only be ideally carried out by a developer who is well aware of AS2.0 and AS3.0. Now, how difficult can it be for a person who has worked AS3.0 to understand on previous versions of Actionscript. I think it’s a bit hard for people who don’t have experience in working with Flash AS2.0.

There might be AS2 to AS3 convertor available in the market but most of them can only manage to change the syntax. This may help saving time in syntax changes but I won’t recommend that since the developer will not go through the code and will not be able to properly understand the code and moving forward he will find it difficult to work on it
Check out the links below which I think provides some informations:
http://www.mandalatv.net/fcny/
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/migration.html
I am open to suggestion from you to know how will you guys go about doing this 🙂