Adding plugins to Flex Builder 3

30 08 2008

OK, so this isn’t rocket science, but I thought I’d just update other Flex developers who may be using the Standalone version of Flex Builder 3 and who haven’t added other eclipse plugins.

Say you want to add PHP support (PHP projects and files) to Eclipse. It’s as simple as 1,2,3

  1. Download the Eclipse plugin you want and extract to some temp directory.
  2. In Flex Builder goto Help -> Software Updates -> Find and Install -> Search for New Features -> New Local Site, and point to the folder that you extracted the plugin to.
  3. Follow the prompts and restart Flex Builder.

So, it’s pretty trivial, but I thought I’d heads up the community as I hadn’t seen anything out there about trying this.

One thing to note however, after you create a new PHP project, the “New” menu switches to PHP items as expected. However, when you close a PHP project and go back to a Flex one, the New menu doesn’t switch back. This is just the Perspective. It’s toggled to PHP. You’ll need to switch it back manually to Flex Development (you can see the tab in the top right of Eclipse).

FYI – there’s all sorts of plugins available from Eclipse sites. Try Help -> Software Updates -> Find and Install -> Search for New Features and see what’s there. You’ll probably find you’ll have to “Select Required Items” as many plugins rely on other basic ones.

Advertisements




Flex positioning: absolute vs vertical (canvas vs vbox)

28 08 2008

Not long ago I was at an Adobe conference and was talking to the speaker about VBox and HBox use. I’d read an article about trying not to nest too many HBox or VBox elements as it could inhibit redraw performance. The speaker couldn’t understand why I’d use vertical and horizontal positioning (VBox & HBox) elements instead of Canvas. I knew there was a reason but I couldn’t remember it.

It just struck me today. I have a global text increaser and decreaser in my application. A Canvas is great for layout, except when it’s children start to outgrow it. When that happens, you’ll get clipping and scrollbars and bang… there goes your accessible web app.

So if your Canvas’s children will remain smaller than the height of your canvas, then use it. Otherwise, start reaching for those Boxes.

Nevertheless, do try to limit your nested vertical/horizontal layout items as much as possible.





Flex Remoting: channels, destinations and SSL

26 08 2008

If you’re like me, then you’ve gotten well into flash remoting as a solution for Flex Data Messaging. You’re using AMF to allow the creation of remote objects between actionscript on the client and some server language (PHP, Java, .NET, etc).

I’ve been running into troubles with WebORB (v3.5) and setting channels that work.

Essentially, for whatever reason, my compiled app didn’t register the changes in my services-config.xml file that resides in the WEB-INF folder of whatever software you’re using to interface with the server side language. And believe me, I tried it a thousand different ways.

The easiest way to override this faulty behaviour is to set the channels and endpoints inside your flex app when you’re building the remote object.

You can see below a solution in weborb for .NET (hence the weborb.aspx endpoint)

Service.as

————————————————————————–

protected static function init(serviceName:String, isSecure:Boolean = false):void
{

var destination:String;

var remoteObject:RemoteObject = null;

var channelSet:ChannelSet = new ChannelSet();

var channel:Channel;

if (isSecure)
{
destination = “MySecureDestination”;

channel = new SecureAMFChannel(null,”weborb.aspx”);
}
else
{
destination = “MyDestination”;

channel = new AMFChannel(null,”weborb.aspx”);
}

channelSet.addChannel(channel);

remoteObject  = new RemoteObject(destination);

//30s timeout on requests
remoteObject.requestTimeout = 30;

remoteObject.showBusyCursor = true;

remoteObject.source = “My.Name.Space.” + serviceName;

remoteObject.channelSet = channelSet;

}

————————————————————————–

And in my remoting-config.xml file:

————————————————————————-

<destination id=”MyDestination”>
<properties>
<source>*</source>
</properties>
</destination>

<destination id=”MySecureDestination”>
<channels>
<channel ref=”my-secure-amf” />
</channels>
<properties>
<source>*</source>
</properties>
</destination>

———————————————————–

As you first start using the SSL option, you may find you start receiving an error about cross domain security issues between HTTP and HTTPS. The deal is that if you are loading your SWF from HTTP, you require a crossdomain.xml policy file in the root of your website to allow HTTPS access.

From Adobe Flex 3 Help: crossdomain.xml

<cross-domain-policy>

<allow-access-from domain=”*.mydomain.com” secure=”false”/>

</cross-domain-policy>

As the Help mentions, you don’t require the crossdomain policy if you’re calling HTTP from a HTTPS loaded swf.