|
|||
|
Hello,
I made a MP3 Player with SWFkit... ( Link: http://www.syeef.com ) My questions are: 1. How do I associte it with MP3 files. 2. Everytime I click the exe file for the player a new copy of the player opens, how do I prevent it. I want only one copy of the player to run at a time. Thank You..... |
|
|||
|
Please add the following code into the "initialize" script, before the "return true;" clause. And please modify "Single Instance Sample" to your window name.
Code:
// ensure only one instance
// look for windows whose names are "Single Instance Sample",
// which is the name of this application
// the returned value is an array contains window objects
var wnds = Window.getWindowsByName("Single Instance Sample");
trace(wnds.length);
if (wnds.length > 0)
{
// more than one window found, which means there is at least one another
// window with the same name exists. That is to say,
// at least another instance exists. In this case,
// we should bring that window to top, and exist the current process
// c_wnd is the current window
var c_wnd = getMainWnd();
for (var i = 0; i < wnds.length; i++)
{
if (wnds[i].handle != c_wnd.handle)
{
wnds[i].bringToTop();
return false;
}
}
return false;
}
Application.associate(".mp3", "mp3file");
|
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|