开发者

Is my flash game local or on the internet?

开发者 https://www.devze.com 2022-12-20 21:18 出处:网络
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.

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 Flas开发者_StackOverflow中文版h?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号