I receive a number of inquiries as to the best way to develop Flex apps for multiple Salesforce.com orgs. My methodology might not be the best but it certainly gets the job done by allowing me to easiy develop locally, test on one of our 10+ sandboxes and deploy to production.
Since the code never lies, here is the skeleton that I essentially use for each new project.
To call this SWF from your Visualforce page, you will need to upload it to your org as a Static Resource. You can then call the SWF in your Visualforce page with the following code. Notice that the userId parameter is being passed via the flashvars and then picked up in the init() method. It's only here as an example on how you can pass variables to the SWF and is not actually needed for this demo.
The login method is very interesting as it provides the flexibility for running in different orgs. When the SWF runs locally, the Flex Toolkit logs into the endpoint with the specified username and password. When you upload the SWF to your org and run it from the Visualforce page below, the flashvars attribute passes the current user's session_id and server_url to the SWF allowing it to login and make call back as the authenticated user.
Note: you will want to remove the hardcoded username and password before uplaoding the SWF to your production org as the SWF can be decompiled, thus exposing your credentials.