00:00
00:00
Newgrounds Background Image Theme

Bowtotheman just joined the crew!

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!

Actionscript codes here!

393,068 Views | 7,981 Replies
New Topic

Response to Actionscript codes here! 2003-12-06 18:49:08


Help with a kickups game... ya I know. I have a topic on this, but the guy that was helping me called it quits :(

Okay, so far I have it where a ball falls to the ground and bounces, and when you click it it moves. But it moves WAY too fast, like it flies everywhere and it doesnt bounce off the walls. Ill send anyone who is willing to help the alpha.

Response to Actionscript codes here! 2003-12-06 19:55:28


Here's a little function I wrote.
It plays all the sounds in an array, with the option to loop.

MovieClip.prototype.playArray = function(playlist, doLoop) {
var i;
function playSound() {
i++;
if (i < playlist.length) {
var snd = new Sound();
snd.attachSound(playlist[i]);
snd.start();
snd.onSoundComplete = function() {
playSound();
};
} else if (doLoop) {
begin();
}
}
function begin() {
i = -1;
playSound();
}
begin();
}

Here's an example:

playArray(["Sound1", "Sound2", "Sound3"], true);

That would then play Sound1, Sound2 and Sound3 and then loop forever.

Response to Actionscript codes here! 2003-12-07 06:32:00


At 12/6/03 05:33 PM, Freek_Sk8er wrote:
At 12/6/03 04:42 PM, Mercanary wrote:
Character jumping script
__________________________________________
NOTE: if you want to have the character to stop at a ground point, you must make a movieclip and label it ground
Someone wrote this jump script but...:
The Jump script works but when you land you just go right thrue the ground :S I make a ground called ground and it doesn't work! Please help me because I really like this jump script!
that should do it, but you can just use my jump script.

onClipEvent (load) {
grav_y = 0;
jumping = false;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.SPACE) && !jumping) {
grav_y = 20;
jumping = true;
}
if (jumping == true) {
grav_y -= 1;
if (grav_y<=-10) {
grav_y = -10;
}
this._y -= grav_y;
}
if (_root.ground.hitTest(this._x+x, this._y+45, true)) {
grav_y = 0;
jumping = false;
}
}

It stil don't work. I think I'm doing something wrong :D
I select my ground then >> Convert to Symbol >>> Name = ground >>> movieclip
And then I set the actionscript on my figure and he jumps but he just go right thrue the floor :S

Response to Actionscript codes here! 2003-12-07 06:35:48


Hi, I need some help with some actionscript . I need my main character to walk around the screen and hit into multiple boundaries and even more as I progress. I show'll u a pic of the boundaries (the boundaries being the houses) at the bottom of the post . I tried to insert part of EvilLudys' code into this :

onClipEvent(load){speed=5;this.stop();}
onClipEvent(EnterFrame){Xspeed=0;Yspeed=0;
if(Key.isDown(Key.DOWN)){Yspeed=speed;this.gotoAndStop(1);}
else if(Key.isDown(Key.LEFT)){Xspeed=-speed;this.gotoAndStop(2);}
else if(Key.isDown(Key.UP)){Yspeed=-speed;this.gotoAndStop(3);}
else if(Key.isDown(Key.RIGHT)){Xspeed=speed;this.gotoAndStop(4);}
this._x+=Xspeed;this._y-=Yspeed;}

And came out with this:

onClipEvent(load){this.stop();}
onClipEvent(enterFrame){Xspeed=0;Yspeed=0;
} else if (Key.isDown(Key.DOWN)) {
if(Key.isDown(Key.DOWN)){Yspeed=-5;_root.LINKDIR=1;gotoAndStop(1);}
} else if (Key.isDown(Key.DOWN)) {
if (_root.Walls2.hitTest(getBounds(_root).xMin,_y,true)) {
} else {
this._x -= moveSpeed;
this.gotoAndStop(2);
else if(Key.isDown(Key.LEFT)){Xspeed=-5;_root.LINKDIR=2;gotoAndStop(2);}
else if(Key.isDown(Key.UP)){Yspeed=5;_root.LINKDIR=3;gotoAndStop(3);}
else if(Key.isDown(Key.RIGHT)){Xspeed=5;_root.LINKDIR=4;gotoAndStop(4);}
this._x+=Xspeed;this._y-=Yspeed;}

Can anyone help me?

Actionscript codes here!

Response to Actionscript codes here! 2003-12-07 08:15:25


At 12/7/03 06:32 AM, Mercanary wrote: It stil don't work. I think I'm doing something wrong :D
I select my ground then >> Convert to Symbol >>> Name = ground >>> movieclip
And then I set the actionscript on my figure and he jumps but he just go right thrue the floor :S

you need to give it the INSTANCE name ground. You're just naming the movie clip, and not giving it an instance name. In flash 5, you have to right-click on the ground and select Instance, In Flash MX... it's somewhere on the bottom of the screen, I'm sure it's clearly labeled, though.

Response to Actionscript codes here! 2003-12-07 11:47:07


I've been trying to figure this out for awhile now. I've tried coming up with my own codes, asking and searching the forums and going to flashkit, yet I know it is something very simple. I still can't figure it out. I have a button. When you press the button, I want it to play a certain sound once. That's all. Can someone please help me?

Response to Actionscript codes here! 2003-12-07 13:51:54


At 12/7/03 08:15 AM, KillingTimeFlash wrote:
At 12/7/03 06:32 AM, Mercanary wrote: It stil :
you need to give it the INSTANCE name ground. You're just naming the movie clip, and not giving it an instance name.

Thats what I said

Response to Actionscript codes here! 2003-12-07 13:55:39


At 12/7/03 11:47 AM, Itys wrote: I've been trying to figure this out for awhile now. I've tried coming up with my own codes, asking and searching the forums and going to flashkit, yet I know it is something very simple. I still can't figure it out. I have a button. When you press the button, I want it to play a certain sound once. That's all. Can someone please help me?

on(press){
var = snd;
snd = newSound ();
snd.attachSound("thesoundyouwant");
snd.start ();}

and label the soubds linkage in the library soumething, and then substitute that for "thesoundyouwant"

Response to Actionscript codes here! 2003-12-07 17:45:47


At 12/7/03 01:55 PM, Freek_Sk8er wrote:
At 12/7/03 11:47 AM, Itys wrote: I've been trying to figure this out for awhile now. I've tried coming up with my own codes, asking and searching the forums and going to flashkit, yet I know it is something very simple. I still can't figure it out. I have a button. When you press the button, I want it to play a certain sound once. That's all. Can someone please help me?
on(press){
var = snd;
snd = newSound ();
snd.attachSound("thesoundyouwant");
snd.start ();}

and label the soubds linkage in the library soumething, and then substitute that for "thesoundyouwant"

Okay, your script is quite flawed. It should look like this:

on (release) {
var snd = new Sound();
snd.attachSound("linkageName");
snd.start();
}

You gotta remember to put spaces between new and Sound in your constructor. And, also, you can't say var = myValue;. The structure for declaring local variables is like this:

var myLocalVar, myOtherLocalVar;

OR

var myLocalVar = "myValue", another = value;

Response to Actionscript codes here! 2003-12-09 06:52:29


k guys,
im makin a game/movie an was wonderin if there was an actionscript way to make that look when your TV is out of reception or there is no channel and its all fuzzy
if you could it would be verry helpful

thanks

Response to Actionscript codes here! 2003-12-10 00:45:51


At 12/7/03 05:45 PM, CrookedAsterisk wrote:
At 12/7/03 01:55 PM, Freek_Sk8er wrote:
At 12/7/03 11:47 AM, Itys wrote: I'v
OR

var myLocalVar = "myValue", another = value;

Dude, I have flash 5 and the script works just fine there. did you even try it?

Response to Actionscript codes here! 2003-12-10 00:48:24


At 12/9/03 06:52 AM, BroADfooT wrote: k guys,
im makin a game/movie an was wonderin if there was an actionscript way to make that look when your TV is out of reception or there is no channel and its all fuzzy
if you could it would be verry helpful

thanks

Man, I say its much easier to draw a grey background, then put plack and white fuzz all over it and motion tween it so it looks right. Its easier than ASing it, because then you'de have to make them pop out from a radom location of not only on the y axis of where the tv is, but the x, not that its too hard to do, its just easier to animate the fuzz.

Response to Actionscript codes here! 2003-12-10 01:28:15


You would only need one pic of the fuzz and then just keep flip flopping it


- Sig provided by ME of the NGSM

- If you try to stay high, your bound to stay low. -

- If I make you a sig, please credit me here -

BBS Signature

Response to Actionscript codes here! 2003-12-10 04:33:41


At 12/10/03 12:45 AM, Freek_Sk8er wrote:
At 12/7/03 05:45 PM, CrookedAsterisk wrote:
At 12/7/03 01:55 PM, Freek_Sk8er wrote:
At 12/7/03 11:47 AM, Itys wrote: I'v
OR

var myLocalVar = "myValue", another = value;
Dude, I have flash 5 and the script works just fine there. did you even try it?

It couldn't have worked if you didn't have any space in your constructor. :P

Response to Actionscript codes here! 2003-12-10 05:11:45


At 12/10/03 12:48 AM, Freek_Sk8er wrote:
At 12/9/03 06:52 AM, BroADfooT wrote: k guys,

:: Man, I say its much easier to draw a grey background, then put..

ok ill do that, thanks.

Response to Actionscript codes here! 2003-12-10 11:47:15


ok...i figure this it'd be the place to post this...i'm trying to make a game...but i've only been using flash for like a week now...and i can't quite get the scripts down for the following actions...i wanted to know if someone could help me...here they are

1) i can get a mc to be the mouse pointer...but i can't make it so when i click on something it changes clips (ex...let's say the pointer is a gun...when i click i would want it to look like a gun firing)

2)how do i make a score board

3)how do i make it so when i click on something it changes to another MC

4)how do i make it so i have to click on it multiple times in order to change to a different mc...kinda like the mc that i'm clicking on has energy

i have an actionscripts bookl...but it doesn't really have anything in there...like it shows you how to make a preloiader...and it doesn't work...and like i downloaded the NG one...and the script was a bit different...so i kinda got screwed...PLEASE HELP ME!!!

Response to Actionscript codes here! 2003-12-10 11:50:42


JUst download the ng 1 and change the logo or something else that won't screw up the script. I learndea from it using the same codes (well on the onload stuff cos I can't do loadin bars yet).

Response to Actionscript codes here! 2003-12-10 20:08:03


What's the code for a zoom in? on a movie

Response to Actionscript codes here! 2003-12-10 20:49:31


At 12/10/03 11:47 AM, Drumminjay wrote: ok...i figure this it'd be the place to post this...i'm trying to make a game...but i've only been using flash for like a week now...and i can't quite get the scripts down for the following actions...i wanted to know if someone could help me...here they are

You've only had Flash for a week?! Why are you attempting to make a game so early?! Start small. Games aren't easy to make, y'know.

1) i can get a mc to be the mouse pointer...but i can't make it so when i click on something it changes clips (ex...let's say the pointer is a gun...when i click i would want it to look like a gun firing)

onClipEvent (mouseDown) {
this.gotoAndPlay("frame");
}

2)how do i make a score board

With PHP or MySQL or some other server-side programming language. Ask the programming forum for some help.

3)how do i make it so when i click on something it changes to another MC

You can't actually do that. But, you can make it look like it is.

onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
this.gotoAndStop("frame");
}
}

4)how do i make it so i have to click on it multiple times in order to change to a different mc...kinda like the mc that i'm clicking on has energy

onClipEvent (load) {energy = 5;}
onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse, true) && ++i >= energy) {
this.gotoAndStop("frame");
}
}

i have an actionscripts bookl...but it doesn't really have anything in there...like it shows you how to make a preloiader...and it doesn't work...and like i downloaded the NG one...and the script was a bit different...so i kinda got screwed...PLEASE HELP ME!!!

There are so many different ways to make a preloader. The preloader in your book would have worked, it's probably just because you were doing something wrong. If that was the case, I recommend you experiment with Flash first, before making a game.

Response to Actionscript codes here! 2003-12-11 10:02:49


anyone wouldnt happen to know a script which lets you move a symbol with the arrow keys?

Response to Actionscript codes here! 2003-12-11 10:27:15


At 12/11/03 10:02 AM, smiffy_uk wrote: anyone wouldnt happen to know a script which lets you move a symbol with the arrow keys?

There's one that moves MC's in the first page of this thread

Response to Actionscript codes here! 2003-12-11 12:55:19


Can anyone help me ? I posted eariler with my problem but SOME ASS!!!!!!!!!!!!!!!!!!!!! has to go 'n' post another question ( a fkin stupid one) and then i get god damn ignored. it was the last post I made with question.

Response to Actionscript codes here! 2003-12-13 05:25:59


This may of been asked for before.
But how do you make it so that you can make your character walkign along the scene and make it like play a movie clip or something to make it look like he is realling walking?

Response to Actionscript codes here! 2003-12-13 17:24:53


At 12/11/03 10:02 AM, smiffy_uk wrote: anyone wouldnt happen to know a script which lets you move a symbol with the arrow keys?

Very simple...

onClipEvent (load) {speed = 5;}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) _x += speed; else if (Key.isDown(Key.LEFT)) _x -= speed;
if (Key.isDown(Key.UP)) _y -= speed; else if (Key.isDown(Key.DOWN)) _y += speed;
}

Response to Actionscript codes here! 2003-12-14 05:34:07


How do you make a MC where you can control it but when u wanna jump u first have to hold down DOWN the release to go high an the longer u hold it the higher he will jump??

Response to Actionscript codes here! 2003-12-14 08:19:06


AS is too har for me to learn...

Response to Actionscript codes here! 2003-12-14 08:34:32


IM BORED SO HERES SOMETHIN I CAME UP WITH:
draw a little ball in the centre and make it a MC
put this code to it:
onClipEvent (load) {
_root.targXscale = 50;
_root.targYscale = 200;
}
onClipEvent (enterFrame) {
cXscale = this._xscale;
cYscale = this._yscale;
difXscale = cXscale-_root.targXscale;
difYscale = cYscale-_root.targYscale;
setProperty(this, _xscale, cXscale-(difXscale/5));
setProperty(this, _yscale, cYscale-(difYscale/5));
}

now make a rectangle and turn it into a button
add this to the button:
on (release) {
_root.targXscale = random(500);
_root.targYscale = random(500);
}

now test it and press the button!

Response to Actionscript codes here! 2003-12-14 16:43:01


At 12/14/03 08:34 AM, BroADfooT wrote: IM BORED SO HERES SOMETHIN I CAME UP WITH:
draw a little ball in the centre and make it a MC

Don't you think it would be much more simple to just say:

onClipEvent (enterFrame) {
_xscale += (_root.targXscale - _xscale) / 5;
_yscale += (_root.targYscale - _yscale) / 5;
}

...rather then...

onClipEvent (enterFrame) {
cXscale = this._xscale;
cYscale = this._yscale;
difXscale = cXscale-_root.targXscale;
difYscale = cYscale-_root.targYscale;
setProperty(this, _xscale, cXscale-(difXscale/5));
setProperty(this, _yscale, cYscale-(difYscale/5));
}

Nice script, though. Keep it up.

Response to Actionscript codes here! 2003-12-15 06:23:25


yer im always doin things hell long when theres a real shorter way of doin them.
im still learning actionscript though...................

Response to Actionscript codes here! 2003-12-15 12:28:18


that is crazy i wish i cud do action script like dat. where did u find the book id like to check that out?

peace out