00:00
00:00
Newgrounds Background Image Theme

GIO-CARTER 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!

426,487 Views | 7,948 Replies
New Topic

Response to Actionscript codes here! 2007-08-20 07:30:58


Here is a great basic circle to shape hitTest:

onClipEvent (load) {
radius = #
//make that the radius of your circle
}
onClipEvent (enterFrame) {
for (=0; i<360; i+=5) {
X = (Math.cos(i*(Math.PI/180))*radius)+_x;
Y = (Math.sin(i*(Math.PI/180))*radius)+_y;
if (_root.shape.hitTest(X, Y, true)) {
trace("teh boomzors!")
//written by RiotFlash!
}
}
}

That checks for hitTest every 5 degrees. No lag!

Response to Actionscript codes here! 2007-08-20 10:09:18


At 8/20/07 07:30 AM, RiotFlash wrote: onClipEvent (load) {
radius = #
//make that the radius of your circle
}
onClipEvent (enterFrame) {
for (=0; i<360; i+=5) {
X = (Math.cos(i*(Math.PI/180))*radius)+_x;
Y = (Math.sin(i*(Math.PI/180))*radius)+_y;
if (_root.shape.hitTest(X, Y, true)) {
trace("teh boomzors!")
//written by RiotFlash!
}
}
}

No, you didn't write that. It's from 23450's tutorial in AS: Main on Circle to Shape Collisions. All you did was make a tiny edit in the for() loop after posters suggested that he change the loop. Which means it wasn't really your edit. And then you changed the text to trace. Which doesn't really count as an edit. Nice job.

Response to Actionscript codes here! 2007-08-20 10:15:33


At 8/20/07 10:09 AM, Pedochu wrote: No, you didn't write that.

_root.pwned=true;


- - Flash - Music - Images - -

BBS Signature

Response to Actionscript codes here! 2007-08-20 12:27:54


I have Flash AS2.0 Garage


I can't actually imagine why you're looking down here, but while you are...

MSN: acidsoldier@gmail.com, Steam: boomman123321

BBS Signature

Response to Actionscript codes here! 2007-08-29 09:31:55


hi! Does anybody know how to make a code that you create people with properties like just with numbers. I've only got Flash MX .

What i mean is that i am trying to make a game which needs alot of made up people for example like an AI of a lot of people. I've got an idea of giving those people a number of several things e.g. confidence, strength, income, hitpoints. I need to give a random number for each of these things for each person with out making loads of textfield myself, because it was way too much if i need 10000 for example.

I was wondering if there is any code that can generate the number of people i want that has got properties from the random number?

THANK YOU SO MUCH

success of the helped code will definatly be in the credit

Response to Actionscript codes here! 2007-09-05 07:38:43


Hi
I was wondering if you could help me ?
have you got a code tht will cancel left and right click

thx

Response to Actionscript codes here! 2007-09-05 11:37:44


At 9/5/07 07:38 AM, bennej1 wrote: Hi
I was wondering if you could help me ?
have you got a code tht will cancel left and right click

thx

What do you mean? Can you explain that a bit more?

Response to Actionscript codes here! 2007-09-06 07:04:43


I've made a flash game (http://bennej1.deviantart.com/art/MOUSE -POINTER-GAME-2-58923224)
but you can cheat by holding in the left mouse button and moving to the end
and i was wondering if you knew a actionscript code that will not allow left mouse click

Response to Actionscript codes here! 2007-09-06 15:55:56


Can somebody quickly give me the actionscript for a magic 8 ball plz? I've tryed but,...

Response to Actionscript codes here! 2007-09-06 19:26:18


can someone please post an AS code for multiplayer in your game? cuz i really suck at flash and i just copy and paste codes. idk how everyone knows all this kind of stuff its just so confusing. (the only AS i know by heart are buttons and drag and drop) :(


rar! AS so hard! grrrrrrrrrrrrrrrrrr!!!! someone help me out with this crap, i cant even make a side scrolling game (like mario) someone! help!

Response to Actionscript codes here! 2007-09-25 02:32:27


guys how do we show the person in the back ground

Response to Actionscript codes here! 2007-10-01 04:42:14


make a variable called "mySoundVolume"
and name the sound "mySound"
Then add this actionscript to the button:

mySoundVolume=0;
mySound.setVolume(mySoundVolume);

HTH


(\ (\

( ^_^)

(_(")(") This is Bunny. Copy and paste bunny into your signature to let him achieve WORLD DOMINATION!

BBS Signature

Response to Actionscript codes here! 2007-10-01 05:19:16


At 10/1/07 04:42 AM, Nyubis wrote: make a variable called "mySoundVolume"
and name the sound "mySound"
Then add this actionscript to the button:

mySoundVolume=0;
mySound.setVolume(mySoundVolume);

HTH

that's for a mute button


(\ (\

( ^_^)

(_(")(") This is Bunny. Copy and paste bunny into your signature to let him achieve WORLD DOMINATION!

BBS Signature

Response to Actionscript codes here! 2007-10-01 05:25:23


bookmark button in flash!!
give a button on release the get url action
and make it like this

on (release) { getURL ("javascript:window.external.AddFavorite ('http://www.newgrounds.com','everything by everyone)"); }

i translated it from dutch, got the script on his site

http://www.bewired.nl/actionscript.php?t itel=bookmark


(\ (\

( ^_^)

(_(")(") This is Bunny. Copy and paste bunny into your signature to let him achieve WORLD DOMINATION!

BBS Signature

Response to Actionscript codes here! 2007-10-01 08:59:36


At 9/6/07 03:55 PM, Somedude123459 wrote: Can somebody quickly give me the actionscript for a magic 8 ball plz? I've tryed but,...

make 2 layers;
in the first one: 10 frames with answers(each frame has a stop() action
in the second layer: a button with the following code

on (release) { what_number = Number(random(10))+2; tellTarget ("/random_number") { gotoAndStop(/:what_number);

ctrl+enter to test

hth


(\ (\

( ^_^)

(_(")(") This is Bunny. Copy and paste bunny into your signature to let him achieve WORLD DOMINATION!

BBS Signature

Response to Actionscript codes here! 2007-10-03 07:49:54


At 9/6/07 07:04 AM, bennej1 wrote: I've made a flash game (http://bennej1.deviantart.com/art/MOUSE -POINTER-GAME-2-58923224)
but you can cheat by holding in the left mouse button and moving to the end
and i was wondering if you knew a actionscript code that will not allow left mouse click

I suppose in your game everything except the path is a button.
so this button should have a code like on (rollOver); goto...
you should add: on (dragOver); goto...

that disables the left-mouse-button way of cheating. for the right mouse button: no single idea

but if these people want to cheat: their problem


(\ (\

( ^_^)

(_(")(") This is Bunny. Copy and paste bunny into your signature to let him achieve WORLD DOMINATION!

BBS Signature

Response to Actionscript codes here! 2007-10-03 11:50:54


Ok, I don't really have time to read through 283 pages, so here is my question. Im trying to make a pause button for a pong game and nothing is working. I started a thread and what I was told to do didn't work. If you check out the thread "making a pause button for pong" you can see what the people told me to do. When I did what they say, either the game freezes or nothing happens at all. If anyone knows what I am doing wrong or know how to do it, some suggestions would be appreciated, because flash is really starting to piss me off right now, because whatever I try doesn't work. Someyimes there are lots of errors like "statement must appear within a handler" or "statement must be terminated by "}" " or "syntax error" Someone plz help!


BBS Signature

Response to Actionscript codes here! 2007-10-03 12:34:44


At 10/3/07 11:50 AM, Ringwraith1 wrote: Ok, I don't really have time to read through 283 pages, so here is my question. Im trying to make a pause button for a pong game and nothing is working. I started a thread and what I was told to do didn't work. If you check out the thread "making a pause button for pong" you can see what the people told me to do. When I did what they say, either the game freezes or nothing happens at all. If anyone knows what I am doing wrong or know how to do it, some suggestions would be appreciated, because flash is really starting to piss me off right now, because whatever I try doesn't work. Someyimes there are lots of errors like "statement must appear within a handler" or "statement must be terminated by "}" " or "syntax error" Someone plz help!

create a variable called game, game = 1, and wrap all movement code inside if(game == 1){ then when you pause make game = 0... when you want to play make game = 1... simple as that...


My Coding Portfolio (updated frequently)

If you stay in bed for long enough it will be socially acceptable to go to bed again

BBS Signature

Response to Actionscript codes here! 2007-10-03 16:27:25


Wow this post helps so much


Rawr Bannana Time :)

BBS Signature

Response to Actionscript codes here! 2007-10-03 18:59:47


At 10/3/07 11:50 AM, Ringwraith1 wrote: Sometimes there are lots of errors like "statement must appear within a handler" or "statement must be terminated by "}" " or "syntax error" Someone plz help!

The actionscript debugger is very good with finding out exactally what is wrong with your code in a clear way. When it says statement must be on handler it means you have code on an MC or button with out including the code in a mc or button event.

//Like this for MCs
onClipEvent(enterFrame) //execute everyframe
{ //All working code goes here
}

Just find a tutorial for MC and button events. Really basic stuff, essential for every scripter.

When it says statement must be terminated by "}" it means that you have a "{" with out a matching "}" Remember this applies no matter what so if your program has 1000 "{"s it MUST have 1000"}". THe fuction of the "}" is to end a block of code.

syntax error means you typed something that the compiler doesn't recognize entirely.
This error isn't that common because the debugger is usually more specific. So you just need to look at the lines with the error on them.


Flash is happy and it knows it.

BBS Signature

Response to Actionscript codes here! 2007-10-03 21:00:14


what's wrong with this script?

function sPlus(){
duplicateMovieClip("enemy", "enemy"+i, i);
_root["enemy"+i]._x = random(Stage.width);
_root["enemy"+i]._y = -50;
_root["enemy"+i].rotation = random(360);
}
setInterval(sPlus, 1500);

i'm trying to have it duplicate the enemy movie clip above the stage.

Response to Actionscript codes here! 2007-10-04 16:37:38


Well, nothing seems to be working, so I'm just gonna give up on the pause button for now, maybe come back to it later when I understand actionscript a bit more. Thanks for the help guysm but it just isn't working. Look for my submission coming up right away, the name will have the word "pong" in it somewhere. Just look for the author and see if it's me, and if you play it , play both versions, and leave a review on what could be improved. But ya, thanks alot for all your help.


BBS Signature

Response to Actionscript codes here! 2007-10-13 10:06:21


has anyone got an actionscript code to adjust the frame speed?

I want to use it in my game for a slowmotion effect when the final punch is deliverd

plz anyone???


(\ (\

( ^_^)

(_(")(") This is Bunny. Copy and paste bunny into your signature to let him achieve WORLD DOMINATION!

BBS Signature

Response to Actionscript codes here! 2007-10-13 10:31:36


Movie Clip goes to mouse position with ease

onClipEvent(load){
_x=0;
_y=0;
}
onClipEvent(mouseDown){
targetx=_root._xmouse;
targety=_root._ymouse;
}
onClipEvent(enterFrame){
_x+=(targetx-_x)/2;
_y+=(targety-_y)/2;
}


Dont Steal Music or Movie

Proud User of : Firefox 3 : Mac OS X : Flash 9 : AS2

Response to Actionscript codes here! 2007-10-13 11:07:21


I love this thread


BBS Signature

Response to Actionscript codes here! 2007-10-13 11:26:43


how would i make a 3d missle game thanks in advanced

Response to Actionscript codes here! 2007-10-13 13:43:18


At 10/13/07 11:26 AM, stealthxtoons wrote: how would i make a 3d missle game thanks in advanced

Lol! You obviously don't know the first thing about actionscript, math, or physics. Start here.

Response to Actionscript codes here! 2007-10-24 12:03:58


can someone plz give me a actionscript to adjust frame speed?

plz guys i really need it

thnx in advnce


(\ (\

( ^_^)

(_(")(") This is Bunny. Copy and paste bunny into your signature to let him achieve WORLD DOMINATION!

BBS Signature

Response to Actionscript codes here! 2007-10-24 13:17:37


At 5/2/03 03:02 AM, EviLudy wrote: I just got myself a book Flash MX actionscript ans i've learned a lot already. So i'll post some codes. You should post too!
codes

cool! I got that book aswell, but im only half way through since im working on a game as well! sweet, now i know what il be learning!


If a man that always tells the truth comes up to you and says that another man always tells lies, and the man who always lies come up to you and says "I'm lying", then is he?

BBS Signature

Response to Actionscript codes here! 2007-11-09 02:20:46


hello my names daniel norman im 12 years old and im learning about flash but im stuck on somthing can you please tell me how to make objects move with your screen because im making a game but i dont know how to make this button move along with the player can you please help me?