views:

43

answers:

1

I'm currently developing a flash game and I need to be able to test it on my local machine and also on the web.

When running locally I use some dummy test data and when online it is joined to an API.

While in development I would like to be able to detect where I'm running so I can switch between these automatically. Is there a way to detect this in Flash?

+1  A: 

Check on your base movie clip (the root movie) the loaderInfo.url property,

when you're running locally loaderInfo.url will start with file://

Use substr() to extract the beginning and check against that value.

That's how I do it for my flash apps.

Ben
Thanks! That's ace.
Richard