As3 - How To Check What IDE the SWF is Running From with Code?
Hello, I know this is kind of a strange thing to I want to find, but here is a little backstory as to why I'm trying to do this:
I am making an online multiplayer flash game. I am using flash builder and flash professional for writing as3 and working with graphics. I am also running a development server (by playerio in visual studio ultimate). The way I am testing this online multiplayer game is by running the swf once from flash professional and once from flash builder. They are both connected to the exact same action script 3 code and flash movie clips (via a swc file). I like this setup a lot because flash pro and flash builder each have their own little output area, and I can see the debugging output for each user separately.
The Problem
Although the two swf's are running the exact same code, I want them to behave differently. For example, the flash pro version gets a reference to the image from:
_gameOverPopup = this["gameOverPopup"];
and the flash builder user gets it like this:
_gameOverPopup = new GameOverPopup;
There are many other differences as well. For example, I am automatically authenticating and logging in with a different user in each case by just hardcoding username and password in. So now my code looks something like this:
if (inFlashBuilder) {
// this only happens when debugging in Flash Builder
authenticateWith("billyboy", "Secret123");
}
else {
// this only happens when debugging in Flash Professional
authenticateWith("joeshmoe", "password1");
}
This works great, but I am manually changing the inFlashBuilder variable in my code. I basically just have it at the top of the class:
private var inFlashBuilder:Boolean = true;
and I have to manually changing it from true to false each time before I compile. Oh man, I wish there were a method in System or something like that which I could use control this flag variable. If only...
