Archive for October, 2007

Flex 3: Dynamic MenuBars via HTTPService

Sunday, October 21st, 2007

This is a quick code post on how to get a dynamic menu running in Flex 3. This will work for Menus, MenuBars, and PopUpMenuButtons.

For the sake of brevity, I will assume you already have your menu being generated by server-side scripts from a database or other data source. This output should be in XML/E4X format.

Click here if you’re unfamiliar with how to form your XML for Flex Menus

The below code is the minimum required to get a menu dynamically loading its hierarchy from a well-formed XML file:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
	layout="absolute"
	creationComplete="{menuSrv.send();}">
	<mx:HTTPService
		id="menuSrv"
		url="menudata.xml"
		resultFormat="e4x" />
	<mx:MenuBar
		showRoot="false"
		labelField="@label"
		dataProvider="{menuSrv.lastResult as XML}">
	</mx:MenuBar>
</mx:Application>

We have defined only an HTTPService and MenuBar. In the <mx:Application> tag we have the creationComplete event call the send() method of the HTTPService. This makes sure that when our application loads, so does the XML data.

Next, in HTTPService we give it an id, which was used to call the send() method previously. We give it a url to get the data from, which here is a .xml file but as long as it is well formed XML in the file it will work absolutely fine. Finally, we define the resultFormat as being E4X.

In MenuBar, we decide not to show our root item. If we don’t set this, Flex will simply create a single menuitem with the entirety of our XML file as the label. We also define the labelField as being @label, as this will allow Flex to access the proper attribute in the E4X format. Finally, we pass the lastResult of the HTTPService as XML to the dataProvider attribute.

Now we’re done! Your menu should run perfectly smoothly as long as the XML is well formed.

Starting in Freelancing - Part 1

Wednesday, October 17th, 2007

This is the first in a series of articles describing how to start yourself in freelancing. Each article will focus on a few main points that are important to consider as you start this new branch in your career. Specifically, it will focus on Web Design, as that is where I started my freelancing career.

Have a Plan

Above all else you should have a plan for what you want to do. They are many ways to make a plan, but at the very least you need a simple goal, such as “I want to have 5 steady clients within the first 18 months of operation.” It’s a good idea to plan for both long term and short term goals. The main goal here is to not set yourself up for disappoint or to over exert yourself. Make plans and goals that are reasonably attainable within the time frame you give yourself. It’s also important to reevaluate these goals as your business develops.

Operate Like a Business

One thing people are often looking for when they hire a freelancer is a more personal interaction with you. While this is a fine way to do business if it works for you, it does have occasional pitfalls:

  • You may get communications at odd hours. If you work from home it is a good idea to state your hours (or at least your phone-answering hours)  upfront. Also, using a mobile phone for business is a good idea since it can be turned off and provides a separate line that can’t so easily be connected to your residence. This can help keep the family/spouse at ease.
  • Personal business relationships can encourage unbusinesslike behavior on both sides. It’s best to keep things at least semi-formal.
  • A lack of professionalism can sometimes be scary for a client. It makes him/her hesitant to sign off on that contract.

Of course, you need to find what works best for you, your personality and the personalities of clients and their businesses. However, if trouble ever comes, it’s much easier to manage through with professionalism

Contract, Contract, Contract

Unless you’re doing a website for your mother or best friend, always have a contract drawn up. I’m not going to go into examples of these, as there is plenty of information around about it. A contract will protect both parties and can help reassure a client if they have not worked with you before. Most people hesitate to use contracts when they enter freelancing for a number of reasons the main one being that they feel like it hinders developing business relationships with client. I beg to differ however, the contract, when used properly, defines the relationship between client and service provider (you). It’s clear, specific, and signed by both parties. If there were to ever be a dispute or misunderstanding, you and the client should be able to go back to the contract to determine the best resolution as defined by it.

Important things to include on this are payment, payment schedules, deadlines, rights to intellectual property and  distribution of these rights to the client. Include whatever additional clauses you find necessary but try to be direct and don’t try to sound like a lawyer if you aren’t one. Offer to your client to put in any clauses they would like (and that you agree to, of course).

That wraps up the first installment. Keep an eye out for future ones!

“Beginning in Freelance” Article Series Coming Soon

Tuesday, October 9th, 2007

I have decided to post a series of blog entries on making an entrance to the freelance world. It’s been done before, yes, but I feel that I’ve learned much over the last year that I can share with emerging freelancers.

My hope is that if even a few people find these posts useful it will improve freelancing in general by educating the beginners.

“Beginning in Freelance” Article Series Coming Soon

Tuesday, October 9th, 2007

I have decided to post a series of blog entries on making an entrance to the freelance world. It’s been done before, yes, but I feel that I’ve learned much over the last year that I can share with emerging freelancers.

My hope is that if even a few people find these posts useful it will improve freelancing in general by educating the beginners.