-
I'm trying to have my movie clip pause/stop when you hit the space bar & on release it continues to play.
I've tried this, but i'm sure its horriblely wrong;
Code:
Key.SPACE.onKeyDown = function(stop) {
Key.SPACE.onKeyUp = function(play) {
};
};
-
Senior Member
Try attaching this to your movieclip this:
onClipEvent(enterFrame){
if (key.isDown(Key.SPACE){
_root.yourmovie.stop();
}
if (key.isUp(Key.SPACE){
_root.yourmovie.play();
}
}
-
opps my bad it's from the 'root of scene 1' i haven't combined it as a movie clip
maybe i should
o_0
-
Code:
_root.onKeyDown = function () {
if (Key.isDown(Key.SPACE) {
stop();
spaceDown = true;
}
}
_root.onKeyUp = function () {
if (spaceDown) {
play();
spaceDown = false;
}
}
vevmesteren's code wont work because there is no Key.isUP() meathod.
-
I tried yours and got this in the output:
Code:
Scene=Scene 1, Layer=action b, Frame=1: Line 2: ')' expected
if (Key.isDown(Key.SPACE) {
test url: http://www.hellmedia.com/xtr/space.html
-
OK, so i forgot a )...
That means this:
if (Key.isDown(Key.SPACE)
Should be:
if (Key.isDown(Key.SPACE))
-
hmm, that validates the code.
but it doesn't work.
test url: ( http://www.hellmedia.com/xtr/space.html )
test fla: ( http://www.hellmedia.com/xtr/space.fla )
-
Senior Member
sorry
sorry about that
Originally posted by etcettra
Code:
_root.onKeyDown = function () {
if (Key.isDown(Key.SPACE) {
stop();
spaceDown = true;
}
}
_root.onKeyUp = function () {
if (spaceDown) {
play();
spaceDown = false;
}
}
vevmesteren's code wont work because there is no Key.isUP() meathod.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|