News - Happenings at iGeeks

October 21st, 2004

Flash Projector: Stopping multiple instances from running

Sometimes we do not want user to launch multiple instances of a standalone(projector) Macromedia Flash application. A friend of mine had similar requirement and I came with a simple script that stops another instance from running. I am using LocalConnection Object for this and I know, you guessed it right? Yeah its very simple and intuitive approach.

Place the following code on the first frame of the application, before any other code.

var _lc:LocalConnection = new LocalConnection();
if(!_lc.connect("myapp")) {
 //You can handle the event in any way you want,
 //I am here just closing the projector.
 fscommand("quit");
}

So as soon as another instance is launched, it would check if connectionName(myapp) is in use, if yes then it quits. Hope it helps someone.

Abdul Qabiz

Comments

There are no comments for this post so far.

Post a comment

Policy on Comments : First-time comments are automatically put under moderation (and will not be displayed) until they are approved. However, your comments in future will show up immediately.

Join iGeeks

Sign up with your email to be an iGeek

Managed by Yahoo Groups

If you wish to advertize on iGeeks, please contact the manager for the same.

Contribute

iGeeks would love to publish your technical articles; contact the manager if you wish to write for iGeeks.

Contact

brajeshwar [at] brajeshwar.com