 |
Featured jobs
Featured template
View more templates
 |
 |


Next 5
Anti Flood Protection
 |
 |
s = new Object();
s.onKeyDown = function() {
if (Key.isDown(Key.ENTER)) {
do_link();
}
};
Key.addListener(s);
function do_link() {
antiflood();
}
function antiflood() {
btn.enabled = false;
Key.removeListener(s);
var c = 0;
temp = setInterval(function () {
if (c++>2) {
clearInterval(temp);
Key.addListener(s);
}
}, 1000);
}
Posted by: andi haas | website
http://www.andihaas.de
|
 |
 |
 |
Key as input for the Key.isDown method
 |
 |
1) Place a dynamic textfield on your stage, name it 'output'.
2) Add the following actionscript to an MC:
onClipEvent (enterFrame) {
if (Key.isDown(Key.CONTROL)) {
_root.output = "The Control key is down!";
} else {
_root.output = "Not down!";
}
}
You'll have to substitute control for command.
Heres another example which might suit your needs better, you shouldn't have to alter the code. It uses the key number instead so just copy & paste it directly into your actions panel:
onClipEvent (keyDown) {
if (key.getCode()==17) {
_root.output = "The Control key is down!";
} else {
_root.output = "Not down!";
}
}
Posted by: No name | website
http://
|
 |
 |
 |
Key combination
 |
 |
Well, say I wanted Ctrl-F as my combo to make my name appear
onClipEvent (enterFrame) {
if (Key.isDown(Key.CONTROL) and Key.getCode() == 70) {
_root.name = "Jesse";
}
}
Posted by: Jesse Stratford | website
http://actionscript.org/
|
 |
 |
 |
keyTimer
 |
 |
// general keyTimer for amount of time
// the key is held down for in seconds
// (this example uses the arrow down key)
onClipEvent(load) {
startTime = getTimer();
}
onClipEvent(enterFrame) {
if(Key.isDown(Key.DOWN)) {
if(!timerStarted) {
trace("restarted");
startTime = getTimer();
timerStarted = true;
}
now = getTimer();
elapsed = int((now-startTime)/1000)
trace("Counting: "+elapsed);
}
if(!Key.isDown(Key.DOWN)) {
timerStarted = false;
elapsed = 0;
startTime = 0;
}
}
// add code to your favorite dummyclip for
// testing and give it a try :)
// ef#Flash
Posted by: SHiZNiT | website
http://www.m39.net
|
 |
 |
 |
make a Movie Clip move around the screen
 |
 |
/*Create a Movie Clip (F8)draw your object that you want to move around.
Go Back to the scene and open up the actions window for your soon to
be moving object (If your using Flash MX the action screen should be down
at the bottom. once in the action Screen type the folloring- */
onClipEvent (load) {
moveSpeed=10;
}
onClipEvent (eventFrame) {
if (Key.isDown(Key.RIGHT)) {
this._x+=moveSpeed;
} else {
if (Key.isDown(Key.LEFT)) {
this._x-=moveSpeed;
if (Key.isDown(Key.Down)) {
this._y+=moveSpeed;
} else {
if (Key.isDown(Key.Up)) {
this._y-=moveSpeed;
}
}
}
}
}
Posted by: Jack S | website
http://www.angelfire.com/or3/intro
|
 |
 |
 |
Next
5
|  |
Search Entire Site
Advertisements
Latest New Articles
- Set up a simple IIS Server for Flash
by Peter McBride - Day 1 at FITC Toronto 2008
by Anthony Pace - Simple reflection effect with AS2
by Jean André Mas - ActionScript.org Meets Josh Tynjala (aka dr_zeus)
by ActionScript.org Staff - Rapidly Create Online Flash Movies to Help Users Market, Sell and Support Software and Hardware
by Sabrina F
|
 |