Advanced CSS Selector

With the Flex SDK Gumbo alpha release almost ready, I wanted to blog about the new advanced CSS selector capabilities.

We’ve added support for descendant selectors, class conditions for type selectors (previously class conditions were only registerd by themselves at the top level, i.e. “globally” instead of on a type by type basis), and id conditions for both type selectors as well as globally. These selectors were chosen as they were seen as the most requested by the community.

A few known issues that will be fixed shortly after alpha include allowing combinations of conditions at the top level (e.g. a top level id and class selector together in a selector chain, “.specialButton#button12″);

Targeting XMLSchema subtypes for anonymous ActionScript Objects

When encoding ActionScript objects to XML using a schema, such as when using a SOAP based WebService, it is not uncommon to provide a subtype (say, an Employee class) to an API that merely specifies a base type (say, a Person class). An issue is that the encoder does not know the subtype that your value is targeting so you must provide a hint. For the decoding XML to ActionScript case, an xsi:type attribute provides the decoder with such a hint… so an equivalent is needed in ActionScript for the encoding XML case.

For strongly typed objects, you can implement the mx.rpc.xml.IXMLSchemaInstance interface to provide a QName for the xsiType property to target the subclass to be used during encoding. See: http://livedocs.adobe.com/flex/3/langref/mx/rpc/xml/IXMLSchemaInstance.html#xsiType

For anonymous ActionScript Objects, however, you may not know that you can wrap your object in an mx.utils.ObjectProxy instance and set its type property with a QName to achieve the same effect. See:
http://livedocs.adobe.com/flex/3/langref/mx/utils/ObjectProxy.html#type

Continue reading…

Using AMF with flash.net.URLLoader

flash.net.NetConnection is a native Flash Player class that is the workhorse for AMF based communication. Flash and Flex applications make use of NetConnection to send AMF formatted requests over HTTP or HTTPS to servers such as Flash Remoting, ColdFusion, BlazeDS, etc. However, less HTTP features are exposed by NetConnection than those of flash.net.URLLoader.

This can be a pain when your network architecture has one or more firewalls between external Flash Player clients and your application server. If authentication or session management is performed at the firewall, session timeouts can introduce an annoying problem. If a client makes an AMF request after a session has timed out, the session management layer may challenge the client to re-authenticate. This challenge is unlikely to be an AMF formatted response and so NetConnection is unable to process the information. While the client knows the request failed, the exact cause of failure is not known.

So… I hacked together a prototype replacement for NetConnection based on flash.net.URLLoader. This new “AMFConnection” class creates binary flash.net.URLRequests and sends HTTP POST data as an AMF formatted request and processes the AMF formatted response returned to URLLoader. One could subclass AMFConnection and intercept the response data and try to detect that an HTML re-authentication page has been returned to the client.

Continue reading…

Flex User Group Boston

I’m looking forward to catching up with the Boston Flex User Group on next Tuesday, 8th April at 7pm.

http://www.bostonfug.org/

I’ll be speaking at this event, most of the demonstration will be hands on, but my slides as a PDF are here:

Download file

AIR, Flex 3, BlazeDS, and a new Adobe Open Source site!

Check out Flex 3 SDK and BlazeDS releases on Adobe’s new Open Source site!

http://opensource.adobe.com/

Flex Builder 3 is live too!

http://www.adobe.com/products/flex/

But wait, there’s more! AIR 1.0 is also live:

http://www.adobe.com/products/air/

Woo hoo!

360 Flex in Atlanta

I’m at 360 Flex this week in Atlanta!

http://www.360conferences.com/360flex/

I’ll be presenting at 10am on Tuesday with an in-depth look at the open source Flex 3 SDK! Drop on by if you’re around at the conference!

BlazeDS Beta 1

Blaze DS Beta 1 on Adobe Labs!

I’m not sure if the announcement of BlazeDS has quite sunk in yet, but with the open sourcing of BlazeDS this really does make many Flex applications that much easier to build.

For example, I’d really like people to see the community take advantage of the Proxy Service and to contribute to its functionality going forward.

The Proxy Service is often overlooked, but did you know that it provides the following capabilities?

1. It provides better REST functionality with support for HTTP 1.1 PUT, DELETE, HEAD, TRACE, OPTIONS in addition to just GET and POST methods?

2. It provides access to non-UTF8 formatted text as the Proxy should be able to read in many more character set encodings – because it is Java based the stream will be converted into UCS-2 internally and then the Proxy will always format this data back to the Flash Player as UTF-8?

3. It allows 3rd party URLs to be aliased so that they do not have to be hard coded or exposed in your application (and Proxy destinations can also be locked down so that only authorized users can tunnel though to a 3rd party destination).

4. It provides a way to get back the response data even when the HTTP status code is not 200?

5. It provides a way to login to a 3rd party endpoint that issues a Basic Authentication challenge without exposing the pop-up to the end user (that is, you can build a custom Flex UI as a login form and set the remote credentials for the proxy to use in pre-authenticating to a 3rd party endpoint).

Also, there’s more that could be done here. Features that I’d like to see in the future:

A. Restoring the ability to stream back binary data instead of just text data.

B. Multipart POST support.

C. Maybe further WEBDAV support?

Flex Camp Boston – Presentation Slides

There was a lot of technical information in my presentation that you probably didn’t get a chance to write down, so here’s a PDF of the slides!

Download file

Flex Camp Boston – 2007

If you’re in the Boston Area and are interested in catching up on advanced Flex 3 features and the LCDS release, sign up for the Flex Camp Boston 2007!

December 7, 2007
8am-5pm
Bentley College, Waltham

See the website:
http://flexcampboston.com/page.cfm/agenda

My session will be an advanced discussion covering LiveCycle Data Services configuration, a review of things to consider when deploying your application, and tips and tricks when debugging data driven Flex applications!

We need help testing web services!

We are asking for all Flex 3 customers to help test out the latest approved nightly build on Adobe Labs with any WebServices that they consume.

See Matt’s blog entry for details:
http://weblogs.macromedia.com/mchotin/archives/2007/10/we_need_help_te.cfm

Please help us out!!