00:00
00:00
Newgrounds Background Image Theme

htffan2000 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,037 Views | 7,981 Replies
New Topic

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


At 12/29/03 11:00 AM, Nova_dragon wrote: what the hell is that thing you're playing?

KingsofChaos. Check it out!
http://www.kingsofchaos.com/recruit.php?uniqid=jta698cj


Swing a Little more!

.. ROCK OUT!

BBS Signature

Response to Actionscript codes here! 2003-12-29 11:02:35


mings of chaos please join my army, its just 3 clicks away no forms and signs you up to nuffin.

Response to Actionscript codes here! 2003-12-29 11:08:01


At 12/29/03 11:02 AM, mexxa wrote: mings of chaos please join my army, its just 3 clicks away no forms and signs you up to nuffin.

Please stop this is an actionscript tread.
Ok ive been going of the route too but its time to pick up the line again.


Swing a Little more!

.. ROCK OUT!

BBS Signature

Response to Actionscript codes here! 2003-12-29 11:09:27


Ok I said join the war and registered nwo when I try to sign in I need a password but I didn't get one or make one GODDAMNIT!!!

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


At 12/29/03 11:08 AM, CrookedAsterisk wrote:
At 12/29/03 11:02 AM, mexxa wrote: mings of chaos please join my army, its just 3 clicks away no forms and signs you up to nuffin.
Please stop this is an actionscript tread.
Ok ive been going of the route too but its time to pick up the line again.

good idea,so is anyone gonna answer my question?i'm gonna post a bit on API,just wait up a minute.

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


Alrigth enter this code on a keyframe to create a filled triangle:
_root.createEmptyMovieClip("drawing", 5);
drawing.linestyle(10, 0x0000FF, 90);
drawing.beginFill(0x0000FF, 100);
drawing.moveTo(0, 0);
drawing.lineTo(240, 110);
drawing.lineTo(0, 220);
drawing.lineTo(0, 0);
drawing.endFill();

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


At 12/29/03 02:32 AM, RejectProductions wrote:
onClipEvent (enterFrame) {
if (_root.remote.hitTest(_root.nate)) {
_root.gotoAndPlay("cutscene1", 1);
}
}
Tell me if it does or doesnt.

It ended up working, after a few changes. it wouldn't go to the scene, so it moved the scene to the same scene as the game, and made it _root.gotoandplay(3)

and P.S. i think this thread has ADD ( hehehe : ) )

Response to Actionscript codes here! 2003-12-29 12:27:42


How do you set the registration point of an api object again?

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


3d sphere:
root.createEmptyMovieClip("sphere", 1);
sphere.onEnterFrame = function() {
_x = 275;
_y = 200;
};
with (sphere) {
d = 400;
pointx = new Array();
pointy = new Array();
pointz = new Array();
numStrips = 10;
degPerStrip = 180/numStrips;
numAround = 20;
degPerAround = 360/numAround;
for (i=0; i<=numStrips; i++) {
pointx[i] = new Array();
pointy[i] = new Array();
pointz[i] = new Array();
for (j=0; j<=numAround; j++) {
ang = j*degPerAround;
ang2 = i*degPerStrip;
rad = Math.sin(ang2*(Math.PI/180))*100;
x = rad*Math.sin(ang*(Math.PI/180));
z = (rad*Math.cos(ang*(Math.PI/180)))+500;
y = Math.cos(ang2*(Math.PI/180))*100;
pointx[i][j] = x;
pointy[i][j] = y;
pointz[i][j] = z;
}
}
for (i=0; i<numStrips; i++) {
for (j=0; j<numAround; j++) {
// Grab the 4 points of the quad
x1 = pointx[i][j];
y1 = pointy[i][j];
z1 = pointz[i][j];
x2 = pointx[i+1][j];
y2 = pointy[i+1][j];
z2 = pointz[i+1][j];
x3 = pointx[i+1][j+1];
y3 = pointy[i+1][j+1];
z3 = pointz[i+1][j+1];
x4 = pointx[i][j+1];
y4 = pointy[i][j+1];
z4 = pointz[i][j+1];
sx1 = (x1*(z1/d));
// Corner 1, on screen
sy1 = (y1*(z1/d));
sx2 = (x2*(z2/d));
// Corner 2, on screen
sy2 = (y2*(z2/d));
sx3 = (x3*(z3/d));
// Corner 3, on screen
sy3 = (y3*(z3/d));
sx4 = (x4*(z4/d));
// Corner 4, on screen
sy4 = (y4*(z4/d));
// Test to see if this quad is visible or not
if (sx1<sx4) {
dx = Math.abs(x4-x1);
this.beginFill(dx*6, 100);
this.moveTo(sx1, sy1);
this.lineTo(sx2, sy2);
this.lineTo(sx3, sy3);
this.lineTo(sx4, sy4);
this.endFill();
}
}
}
}

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


Put this on a keyframe to create some cool looking flowers(animated):
createFlower = function (flower, numberOfPetals, fWidth, fHeight, fX, fY) {
// create the empty movie clip 'flower' that will become the flower,
// and inside it create the movie clips that will become the petals...
var flower, numberOfPetals, petals, fWidth, fHeight, fX, fY;
_root.createEmptyMovieClip(flower, fDepth);
fDepth++;
Stage.scaleMode = "exactFit";
_root[flower]._x = fX;
_root[flower]._y = fY;
Stage.scaleMode = oldMode;
_root[flower].numberOfPetals = numberOfPetals;
_root[flower].fWidth = fWidth;
_root[flower].fHeight = fHeight;
initializeFlower.apply(_root[flower]);
};
initializeFlower = function () {
// initialize the flower variables and events...
this.createPetals = function(numPetals) {
var numPetals, petals;
for (petals=0; petals<numPetals; petals++) {
this.createEmptyMovieClip("petal"+petals, petals);
this["petal"+petals]._rotation = petals*(360/numPetals);
}
};
this.drawpetal = function(petal, color, alpha) {
path = this[petal];
path.clear();
path.lineStyle(0, 0x505060, 30);
path.beginFill(color, alpha);
path.moveTo(this.x[0], this.y[0]);
path.curveTo(this.x[1], this.y[1], this.x[2], this.y[2]);
path.curveTo(this.x[3], this.y[3], this.x[0], this.y[0]);
path.endFill(this.x[0], this.y[0]);
};
this.petalControl = function() {
for (i=0; i<4; i++) {
this.x[i] += this.sX[i];
this.y[i] += this.sY[i];
if (Math.abs(this.x[i])>this.fWidth) {
this.sX[i] = -this.sX[i];
}
if (Math.abs(this.y[i])>this.fHeight) {
this.sY[i] = -this.sY[i];
}
}
this.col = 0xFF0000;
for (i=0; i<this.numberOfPetals; i++) {
this.drawpetal("petal"+i, this.col, 200/this.numberOfPetals);
this.col += 0x001040;
}
};
this.init = function() {
this.x = new Array();
this.y = new Array();
this.sX = new Array();
this.sY = new Array();
this.x[0] = 0;
this.y[0] = 0;
this.x[1] = 0;
this.y[1] = -this.fHeight;
this.x[2] = -this.fWidth;
this.y[2] = -this.fHeight;
this.x[3] = -this.fWidth;
this.y[3] = 0;
for (i=0; i<4; i++) {
this.sX[i] = Math.random()*4+2;
this.sY[i] = Math.random()*4+2;
}
this.col = 0xFF0000;
};
//
//
this.init();
this.createPetals(this.numberOfPetals);
this.onEnterFrame = this.petalControl;
};
fDepth = 0;
// createFlower (flower, numberOfPetals, fWidth, fHeight, fX, fY)
createFlower("daffodil", 8, 100, 20, 200, 200);
createFlower("orchid", 3, 40, 40, 100, 200);
createFlower("daisy", 5, 40, 100, 300, 200);

Response to Actionscript codes here! 2003-12-29 14:20:03


Transforming sound:
_root.createEmptyMovieClip("mySound_mc", 10);
mySound = new Sound(mySound_mc);
mySound.attachSound("myJazzSong");
myTransform = new Object();
myTransform.ll = 90;
myTransform.lr = 0;
myTransform.rr = 10;
myTransform.rl = 0;
mySound.setTransform(myTransform);
mySound.start();

Response to Actionscript codes here! 2003-12-29 14:22:02


Nice codes Nova, how about we have a topic for all interesting api drawings to go in?

Response to Actionscript codes here! 2003-12-29 16:05:48


Anyone know how to change a mouse icon?
Like to say turn it into a Crosshair?

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


At 12/29/03 04:05 PM, b1s8e3 wrote: Anyone know how to change a mouse icon?
Like to say turn it into a Crosshair?

I guess you havn't read the topic, it's in here numerous times including the first page and first topic.

Response to Actionscript codes here! 2003-12-29 16:29:59


At 12/29/03 12:27 PM, Sulphent wrote: How do you set the registration point of an api object again?

Nvm i remembered.

Response to Actionscript codes here! 2003-12-29 19:23:10


Hmm... seems as if I've started a trend with this API...

I'm starting to make a game purely out of ActionScript. This is what I've got so far [put on blank frame, set framerate to 20 and move with arrow keys]:

_global.sw = 550;
_global.sh = 400;
_global.DPTH = 0;
_global.rads = Math.PI / 180;

this.createEmptyMovieClip("bg", ++DPTH);
with (bg) {
beginFill(0x000000);
lineTo(sw, 0);
lineTo(sw, sh);
lineTo(0, sh);
lineTo(0, 0);
endFill();
}

for (var s = 0; s < 25; s++) {
this.createEmptyMovieClip("sr" + s, ++DPTH);
with (this["sr" + s]) {
lineStyle(3 + Math.random() * 4, 0xFFFFFF, 50 + Math.random() * 25);
lineTo(.5, 0);
_x = Math.random() * sw;
_y = Math.random() * sh;
}
}

this.createEmptyMovieClip("ship", ++DPTH);
with (ship) {
beginFill(0x0000AE);
lineStyle(1, 0x333333);
moveTo(0, -15);
lineTo(-10, 15);
curveTo(0, 5, 10, 15);
lineTo(0, -15);
endFill();
_x = sw / 2;
_y = sh / 2;

ship.onEnterFrame = function() {
if (Key.isDown(Key.LEFT)) _rotation -= 7;
if (Key.isDown(Key.RIGHT)) _rotation += 7;

angle = (_rotation - 90) * rads;
gx = Math.cos(angle);
gy = Math.sin(angle);
if (Key.isDown(Key.UP)) {
ax += gx * 2;
ay += gy * 2;
} else {
ax *= .9;
ay *= .9;
}
_x += ax;
_y += ay;

if (_x < 0) _x = sw;
if (_x > sw) _x = 0;
if (_y < 0) _y = sh;
if (_y > sh) _y = 0;

if (ax > 15) ax = 15;
if (ay > 15) ay = 15;
if (ax < -15) ax = -15;
if (ay < -15) ay = -15;
};
}

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


Crooked Asterisk-

Are you actually going to make a game out of only code? I think that would be pretty cool. When you're done you should submit it to the portal to show everyone what you can do.

Response to Actionscript codes here! 2003-12-30 03:22:42


At 12/30/03 01:30 AM, RejectProductions wrote: Crooked Asterisk-

Are you actually going to make a game out of only code? I think that would be pretty cool.

Ya, I do too. It will be pretty simple, yet addictive (I hope).

When you're done you should submit it to the portal to show everyone what you can do.

Hm, yeah, that's an idea. It'd probably get blammed, though.

Response to Actionscript codes here! 2003-12-30 05:31:36


At 12/29/03 07:23 PM, -CrookedAsterisk- wrote: Hmm... seems as if I've started a trend with this API...

I was going to almost exactly the same, I was still working on the script then you posted....
I got as far as this:

rotator=7;
_global.varw = Stage.width;
_global.varh = Stage.height;
// check the stage width and height
this.createEmptyMovieClip("line", 0);
with (line) {
lineStyle(5, 0x99CC66, 50);
lineTo(varw, 0);
lineTo(varw, varh);
lineTo(0, varh);
lineTo(0, 0);
// create the border
}
_root.createEmptyMovieClip("player", 1);
with (player) {
beginFill(0x993366, 85);
lineStyle(3, 333333);
moveTo(35, 350);
lineTo(20, 380);
lineTo(50, 380);
lineTo(35, 350);
endFill();
// create the player
this.onEnterFrame = function() {
if (Key.isDown(Key.LEFT)) {
_rotation -= rotatior;
}
if (Key.isDown(Key.RIGHT)) {
_rotation += rotatior;
}
gx = Math.cos((_rotation-90)*(Math.PI/180));
gy = Math.sin((_rotation-90)*(Math.PI/180));
if (Key.isDown(Key.UP)) {
ax += gx*2;
ay += gy*2;
} else {
ax *= .9;
ay *= .9;
}
_x += ax;
_y += ay;
if (_x<0) {
_x = varw;
}
if (_x>varw) {
_x = 0;
}
if (_y<0) {
_y = varh;
}
if (_y>varh) {
_y = 0;
}
if (ax>15) {
ax = 15;
}
if (ay>15) {
ay = 15;
}
if (ax<-15) {
ax = -15;
}
if (ay<-15) {
ay = -15;
// let the player move
}
};
}
_root.createEmptyMovieClip("bullet", 2);
with (bullet) {
beginFill(0x00CCFF, 100);
lineStyle(1, 000000);
moveTo(-59, 13);
lineTo(-60.5, 13.7);
lineTo(-60.5, 15.6);
lineTo(-59, 16.4);
lineTo(-57.6, 15.4);
lineTo(-57.6, 13.9);
endFill();
// create the bullet
}

Well Anyways I know API now...


Swing a Little more!

.. ROCK OUT!

BBS Signature

Response to Actionscript codes here! 2003-12-30 08:47:14


Stopwatch:
- Make the framerate 100
Put this inside a movieclip somewhere:

onClipEvent (enterFrame) {
_root.hundreds += 1;
if (_root.hundreds > 99) {
_root.secs += 1;
_root.hundreds=00;
}
if (_root.secs > 59) {
_root.mins += 1;
_root.secs=00;
}
if (_root.mins> 59) {
_root.hours += 1;
_root.mins=00;
}
}

Put 4 dynamic text boxes somewhere and link them to the variables:
'hundreds' 'secs' 'mins' 'hours'


Swing a Little more!

.. ROCK OUT!

BBS Signature

Response to Actionscript codes here! 2003-12-30 10:04:06


Hey guys i'm workign on a flash tutorial and i've done 2 thigns so fra:
preloader and wlakign animation,i'm now on API so it will have codes and a discription on the code so if you don't get API then this tutoial will hopefully explain it to you.

Response to Actionscript codes here! 2003-12-30 17:22:43


At 12/30/03 05:31 AM, EviLudy wrote:
At 12/29/03 07:23 PM, -CrookedAsterisk- wrote: Hmm... seems as if I've started a trend with this API...
I was going to almost exactly the same, I was still working on the script then you posted....
I got as far as this:

Wow. Sorry, but it’s so obvious that you copied completely off mine. :P

Response to Actionscript codes here! 2003-12-30 18:00:42


Hehe :P Evil did you make the stopwatch script so you could time to see who is faster at making scripts between you and crooked? :P Or are you still crooked? o_O

Response to Actionscript codes here! 2003-12-30 18:26:19


Can anyone Psot Actionscirpt for a Password system? I'm building some forums on Flash, and I really need them, I'l ldraw somthing for sombody if they post it up.

Response to Actionscript codes here! 2003-12-30 19:02:31


At 12/30/03 06:26 PM, Figurine_Master wrote: Can anyone Psot Actionscirpt for a Password system? I'm building some forums on Flash, and I really need them, I'l ldraw somthing for sombody if they post it up.

You're building forums in Flash? Good luck!

if (password_txt.toLowerCase() == password.toLowerCase()) {
// The password is correct
} else {
// The password is incorrect
}

If you don't even know how to make passwords, then I suggest you don't make the forum. It's harder than you think.

Response to Actionscript codes here! 2003-12-30 20:26:45


Does anyone know where I can find a good Javascript Tut that can explain the basics of starting a web page? I have a site already but I keep seeing Javascript pages and I just want to see the cool things you can do. Thanks. Later.

Response to Actionscript codes here! 2003-12-30 20:58:28


I have one more question. Does anyone know how to make an input text send whats in it into a dynamic text? What I have now is this:

input = inputcopy;

The one called input is an input text box. The second part, inputcopy, is dynamic text. I can't figure out how to make the dynamic text equal the input. HELP!

Response to Actionscript codes here! 2003-12-30 21:17:13


At 12/30/03 08:58 PM, RejectProductions wrote: I have one more question. Does anyone know how to make an input text send whats in it into a dynamic text? What I have now is this:

input = inputcopy;

The one called input is an input text box. The second part, inputcopy, is dynamic text. I can't figure out how to make the dynamic text equal the input. HELP!

Hmm... well, that should work. Make sure you didn't mistype anything.

Response to Actionscript codes here! 2003-12-30 21:27:40


I checked everything. None of it is wrong. It still won't work though. What the crap!

Response to Actionscript codes here! 2003-12-30 21:36:59


Are the names as the text boxes variables and not their instances?