Archive for the ‘Flex’ Category

Code formatting for Adobe Flex - Flex Formatter

Thursday, December 9th, 2010

After using Flash Builder for a log time I think everyone has a lot of custom settings for the workspace they use so whenever you put a fresh OS or just reinstall Flash Builder first think you do is setting up the workspace and I think everyone has his own special thinks to setup. Me for example I install subclipse, setup some custom key shorcuts, edit some perspectives and much more but I think the most useful plugin and a plugin that all of my colleagues use is Flex Formatter, this plugin it’s a must and I install this all the time, again and again and they do the same.

So because of this, most of the time people ask me: From where to download Flex Formatter ? How do I install Flex Formatter ? Can I share my format settings ? so I decided to write the answer to all this questions in a blog article.

From where to download Flex Formatter ?

Answer: You can download a .zip of Flex Formatter from : http://sourceforge.net/projects/flexformatter/

How do I install Flex Formatter ?

Answer: After you have download the .zip  archive all you have to do is to copy all the three .jar files from the archive in the Adobe Flash Builder plugins directory. For example in my case I had to copy the three files here “C:\Program Files\Adobe\Adobe Flash Builder 4\plugins\“.

Can I share my format settings ?

Answer: Yes
The formatting settings I use is :  format.properties

Using AMF and RemoteObject without services-config.xml

Saturday, January 23rd, 2010

This article will be very short but I hope it will be very useful. The goal of this article is to show you how to use a RemoteObject without service-config.xml. The example in this post will be very simple, we will connect to a AMFPHP service and get a hello message from it.

First let’s see the service:

1
2
3
4
5
6
7
8
9
10
11
<?php
// hello.php
class Hello
{
	public function sayHello()
	{
		return "Hello back!";
	}
}
 
?>

Now in Flex all we have to do is to load a XML file ( channel.xml ) and read the channel from it:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
protected function addedToStageHandler( event :Event ) :void
{
 
	var loader :URLLoader = new URLLoader();
	loader.addEventListener( Event.COMPLETE, completeHandler );
	loader.addEventListener( IOErrorEvent.IO_ERROR, ioErrorHandler );
	loader.load( new URLRequest( "channel.xml" ));
 
}
 
protected function completeHandler( event :Event ) :void
{
 
	// Load info from XML
	var xml :XML = new XML( event.target.data );
	var amfEndpoint :String = xml..channel.( @id == "my-amfphp" ).@endpoint;
 
 
	// Create a AMF channel
	var channel :AMFChannel = new AMFChannel( "my-amf", amfEndpoint );
 
 
	// Add channel to our RemoteObject
	rmtObj.channelSet = new ChannelSet();
	rmtObj.channelSet.addChannel( channel );
 
}

Now if you use the loaded channel for all your RemoteObjects you don’t have to compile again your application if you decide to change your AMF endpoint, all you have to do is to edit the channel.xml file.

This is very useful when you upload your application to a server, you don’t have to compile again the application to work on different servers all you have to do is to use different channel.xml.

You can download the code here ( click to download ).

And this is all. If you have any questions post them here.

Adobe Community Professionals 2010

Tuesday, January 19th, 2010

I’m happy to announce that from 2010 I am an Adobe Community Professional in Flex. I really appreciate the recognition from the Adobe and I will try to contribute  more this year for the development of the community.

Formerly known and recognised as an A.C.E (Adobe Community Expert), the name has been changed to A.C.P to ensure that the Adobe Certified Experts and Adobe Community Professionals are recognised separately.

This year, 300 developers and community members were awarded the ACP title, 59 of which were from
the Flex programme.

As you know, the Adobe Community Experts Program is a community based program made up of Adobe customers who share their product expertise with the world-wide Adobe community. The Adobe Community Experts’ mission is to provide high caliber peer-to-peer communication educating and improving the product skills of Adobe customers worldwide.

A full list of 2010 Community Professionals can be found here:
http://lizfrederick.blogspot.com/2010/01/new-acps-for-2010.html

I’d like to thanks to my friends for the support.

And this is the badge :D :

acp_logo