jump to navigation

Howto: Add Basic Authentication Header to HTTPService July 4, 2008

Posted by Mayank in actionscript, flex.
Tags: , , , ,

HTTPService in flex supports addition of headers as required. Follow the steps below to add authetication headers to your HTTPService when accessing a service protected by basic authentication.

        import mx.utils.Base64Encoder;
        import mx.controls.Alert;
        private var baseUrl:String = "http://phprestsql.sourceforge.net/tutorial/user";
        private var auth:String = "p126371rw:demo";
        private function init():void{
            var encoder : Base64Encoder = new Base64Encoder();
            userService.headers["Authorization"] = "Basic " + encoder.toString();



Howto: Organise custom components in Flex? August 9, 2007

Posted by Mayank in flex.
1 comment so far

Most of the material on custom components in flex talks about their creation and their use within flex applications. As the number of components begin to grow one begins to feel the need for organising them in subfolders.

To use a custom component in a Flex application we usually add an attribute to the mx:Application tag:


and then use the components as


I recently solved the mystery behind this attribute :). If you would like to organise the components into subfolders, then create a folder as desired and while setting the namespace attribute in the mx:Application tag set it like this:


To access the components you would use


You can create additional folders and include their namespaces too :).


To take this a step further, you could nest your folders to mimick the way your organise your java packages:

Create sub1, and then sub2 under sub1

To use components under sub1 you could place a namespace declaration like:


and then to include sub2 components you would declare another namespace:


Hope that helps you in organising your custom flex components.

Happy Flex-ing! 🙂