Posts in Category "Tips and Techniques"

Runtime Skinning In Flex 2

Check out Brian Riggs new post on runtime skinning in Flex 2.

Flex and Flash Player 8

Two articles posted that talk about Flex 1.5 and Flash Player 8.

Check ’em out!

Flash Player 8 and Flex 1.5
Using Flash Player 8 Features in Your Flex 1.5 Application

Embedding HTML in a Flex App?

Check out Christophe’s article on embedding HTML in a Flex app by using an IFRAME. There are plenty of times when this approach will be inappropriate, but when it’s right it’s pretty sweet.

Localizing Validator Errors

A common request I’ve seen is a way to localize the Validator error messages. Unfortunately the built-in Validator classes don’t make that easy in their current state (something we’re hoping to work on in the next version). In the meantime, here is one approach (and I’m sure there are more if you wanted) to changing the error messages using some form of resource file.

Continue reading…

Guest Post on File Upload

Jimmy Gianninas of Optimal Payments has been kind enough to write a quick example of one way to get file upload into your Flex app. Rather than write a full-blown devnet article which will take weeks to get edited and posted, we’re putting it up on my blog to get it out faster. You can get the examples here. There is a Word document describing some of the files, and then a number of files that you can use as templates to get yourself going. Note that none of it will run out of the box, you must edit files and set up your server as appropriate.

Thanks again to Jimmy for the community contribution. If you have questions you might be better off posting on flexcoders rather than in the comments since I’m not sure how often he’ll check them.

foo(Void) vs foo()

Sometimes the benefits of a scripting language can come back to bite you in the rump 🙂 One thing that I’ve seen a lot of recently is the practice of declaring a function to have a single parameter: Void. The intention here is to indicate that the function takes NO parameters, a feature that other languages sometimes support. However, in ECMAScript (and thus ActionScript) it does NOT have that meaning. In fact, the compiler instead declares a local variable called Void! You can debate all you want about how wrong or right this is, but it’s the way the language is designed.

Despite some of the additions to the language in AS2, ActionScript is still a scripting language and still allows you to pass a different number of parameters than what is declared in the function signature. In Flex we added some compiler checking to make sure that if you declare a variable or function that is already declared in the superclass, the type or signature matches between the two. This is to help prevent developers from accidentally overwriting a variable they didn’t know existed in the superclass. However it also catches something like our (Void) problem. All shipped Flex code does not use the (Void) convention. If you then override a function and use that convention (which may have been done a lot in in the V2 components with MX 2004) you will see the compiler give you an error about Void not matching the superclass type.

Not sure how clear this is but I hope it can be of some help.

Using a proxy to detect changes to models

Someone recently asked how you might intercept changes on an object so that you could know when it is dirty and needs saving. The catch was
that he wants to use binding to populate the object and doesn’t want to put event handlers on his controls just for this monitoring. Finally, he
wants the solution to be generic (meaning that writing your object to have setters and monitor its own dirty state is not acceptable).

I’ve written up one solution to the problem here, using a proxy object to pass changes through to the final object, and using the proxy as the
indicator of when things are dirty.

Continue reading…

Test from a distance

I’ve joined a project recently where I’ve been at the Macromedia office in San Francisco but the server I’ve been hitting is across the country. As soon as I started working I saw real performance problems where the application wouldn’t start for a long time. It turned out that there was a lot of data required for the app to initialize, but now that the data had to travel outside of the intranet its size became noticeable. This required a real adjustment for the application. The engineer decided to pass down thin versions of each object and as necessary load the additional details instead of getting all of the data at once . This reduced the amount of data on the wire significantly and allowed the app to start up in a reasonable time. Getting more data on demand produces a slight delay, but you can “entertain” the user easily enough to pass the time.

Continue reading…

Debugging Databinding

The Flex databinding system is a relatively simple yet powerful mechansim for moving data throughout your application. However, there are times when binding will appear not work, and I’d like to give some suggestions on tracking that down.

Continue reading…