New Samsung Modding Group
Would you like to react to this message? Create an account in a few clicks or log in to continue.
New Samsung Modding Group

You are not connected. Please login or register

Volume button script in menu.

Go down  Message [Page 1 of 1]

1Volume button script in menu. Empty Volume button script in menu. Fri Aug 19, 2011 7:36 pm

newz93


Admin

This script is to make volume buttons have a function in the menu.


First create a variable to add a listener:

var keyListener = new Object();



Now create a function for the listener to detect:
keyListener.onKeyDown = function ()
{
if (Key.getCode() == 189)
{
//do something
} // end if
if (Key.getCode() == 187)
{
//do something
} // end if
if (Key.getCode() == 39)
{
//do something
}//end if
if (Key.getCode() == 37)
{
//do something
} // end if
};

Where the words "//do something" are you put something. keycode 189 and 39 are down button, and keycode 187 and 37 are up button.


Now you have to add the listener:
Key.addListener(keyListener);



Now to create the function:
function debugCreate(arg)
{
_root.dMc.removeMovieClip();
} // End of the function



Now create another function to trace:
function dTrace(str)
{
++dtraceN;
_root.dMc.dTxt.text = _root.dMc.dTxt.text + ("\n" + dtraceN + " : " + str);
_root.dMc.dTxt.scroll = _root.dMc.dTxt.maxscroll;
} // End of the function


Now change the variable:
_root._focusrect = false;



Now configure the stage:
Stage.scaleMode = "noScale";
Stage.align = "TL";



Now add a root for extended events:
_root.ExtEvt = ExtendedEvents;



Now add system capabilities variable:
var nowOs = System.capabilities.os;



Now add the variables:
var dtraceN;
var debugObj = new Object();



Now add the function:
debugObj.onEvent = function (arg)
{
_root.debugCreate(arg);
};



Now add listeners
_root.ExtEvt.debugOn.addListener(debugObj);
_root.ExtEvt.shakePhone.addListener(_loc2);



Now make a function work:
debugCreate(nowOs);
delete _root.debugBl;



And add the script:
_root.dTrace("nowOs : " + nowOs);
var mmCl = Ely_CIS_MenuManager.getMenuManager(this, 12, "Soft");



and to make sure after its done all that it finishes:
stop();



you could use this:
function nextWall ()
{
++_global.i
_root.wallpaper.unloadMovie();
_root.wallpaper.loadMovie("HD2/Wallpapers/" + _global.i + .jpg)
if(_global.i == 54)
{
_global.i = 1
}
}
function prevWall ()
{
--_global.i
_root.wallpaper.unloadMovie();
_root.wallpaper.loadMovie("HD2/Wallpapers/" + _global.i + .jpg)
if(_global.i == 0)
{
_global.i = 54
}
}

So when up/down button is pressed wallpaper changes, just put nextWall(); or prevWall(); where i put //do something
also first add the wallpaper movie if you are going to use this:
function createWall()
{
_root.createEmptyMovieClip("wallpaper", 0)
}
createWall();

https://starmods.forumotion.com

Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum