00:00
00:00
Newgrounds Background Image Theme

Someone gifted MetalSlayer69 supporter status!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Problem with Actionscript 2.0

1,029 Views | 5 Replies
New Topic Respond to this Topic

Problem with Actionscript 2.0 2008-10-02 14:48:50


Hey guys. I have a question for you. I want to make a flash presentation, but my script doesn't work for some reason. I want to make that if you press Key.RIGHT, you go to frame 2, but if you press Key.LEFT, you go to frame 2. This is the script I put in:

onEnterFrame = function(){
if(Key.isDown(Key.RIGHT)){
gotoAndStop(2);
}
}
{
if(Key.isDown(Key.LEFT)){
gotoAndStop(1);
}
}

Can you write a new fixed one please?

Thanks Newgrounders!

Response to Problem with Actionscript 2.0 2008-10-02 15:15:32


Try:

 onEnterFrame = function(){
if(Key.isDown(Key.RIGHT)){
_root.nextFrame()
}
}
{
if(Key.isDown(Key.LEFT)){
_root.prevFrame()
}
}

It's untested though.


Formerly known as mwmike | I'm moderately active on last.fm | Before you post, read these. Please.

BBS Signature

Response to Problem with Actionscript 2.0 2008-10-02 15:22:28


This will work if you place it on the root timeline and put a stop(); on every frame.

onEnterFrame = function () {
	if (Key.isDown(Key.RIGHT)) {
		nextFrame();
	} else if (Key.isDown(Key.LEFT)) {
		prevFrame();
	}
};
stop();

Alternatively, you can replace nextFrame(); and prevFrame(); with gotoAndStop(frame);
Tested, and works.

Response to Problem with Actionscript 2.0 2008-10-02 15:46:09


At 10/2/08 02:48 PM, Bumbanut wrote: Hey guys. I have a question for you. I want to make a flash presentation, but my script doesn't work for some reason. I want to make that if you press Key.RIGHT, you go to frame 2, but if you press Key.LEFT, you go to frame 2. This is the script I put in:

onEnterFrame = function(){
if(Key.isDown(Key.RIGHT)){
gotoAndStop(2);
}
if(Key.isDown(Key.LEFT)){
gotoAndStop(1);
}
}

You added an extra bracket.

Response to Problem with Actionscript 2.0 2023-04-21 04:59:49


I love you, I was looking for this for hours!

Response to Problem with Actionscript 2.0 2023-04-24 02:39:54


At 10/2/08 02:48 PM, Bumbanut wrote: Hey guys. I have a question for you. I want to make a flash presentation, but my script doesn't work for some reason. I want to make that if you press Key.RIGHT, you go to frame 2, but if you press Key.LEFT, you go to frame 2. This is the script I put in:

onEnterFrame = function(){
if(Key.isDown(Key.RIGHT)){
gotoAndStop(2);
}
}
{
if(Key.isDown(Key.LEFT)){
gotoAndStop(1);
}
}

Can you write a new fixed one please?

Thanks Newgrounders!


better learn as3 , when you know it completely then ruffle will fully work


I am ready to program in as3/as2 or website