00:00
00:00
Newgrounds Background Image Theme

Someone gifted VinityAryimin 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!

As: Api

21,392 Views | 162 Replies
New Topic Respond to this Topic

Response to As: Api 2005-07-15 10:25:35


oh no, that's not why. I tried to make my own gradient. It didn't come out right.

Response to As: Api 2005-07-16 14:59:11


Just wanted to add something..

You can set masks with actionscript using the MC.setMask(maskMC) code. Put the MC instance name that will be masked at the beginning followed by setMask, then in the brackets put the instance name of the MC that will be used as a mask in quotes ("").

For example:

_root.createEmptyMovieClip("box", 2);
with (box) {
lineStyle(0, 0x000000, 100);
beginFill(0x000000, 100);
lineTo(50, 0);
lineTo(50, 50);
lineTo(0, 50);
lineTo(0, 0);
}
_root.createEmptyMovieClip("box2", 3);
with (box2) {
lineStyle(1, 0x000000, 100);
lineTo(50, 0);
lineTo(50, 50);
lineTo(0, 50);
lineTo(0, 0);
}
box.onPress = function() {
startDrag(box);
};
onMouseUp = function () {
stopDrag();
};
_root.createEmptyMovieClip("wierd", 1);
with (wierd) {
lineStyle(0, 0x000000, 0);
beginFill(0xFF0000, 100);
lineTo(20, 0);
lineTo(50, 50);
lineTo(0, 50);
lineTo(0, 0);
endFill();
moveTo(20, 0);
beginFill(0x00FF00, 100);
lineTo(50, 50);
lineTo(80, 0);
lineTo(20, 0);
endFill();
moveTo(80, 0);
beginFill(0x0000FF, 100);
lineTo(100, 0);
lineTo(100, 50);
lineTo(50, 50);
lineTo(80, 0);
endFill();
_yscale = _xscale=200;
}
wierd.setMask("box");
onEnterFrame = function () {
box2._x = box._x;
box2._y = box._y;
};

http://img303.images..image=setmask3uh.swf


Sup, bitches :)

BBS Signature

Response to As: Api 2005-07-20 16:08:29


Example
I made a dodgy water spout thing.

34 Lines of code

function spray(nom) {
_root.createEmptyMovieClip("spray"+nom, nom);
with (_root["spray"+nom]) {
_root["spray"+nom].lineStyle(1, 0x0000ff);
_root["spray"+nom].beginFill(0xbbbbff);
_root["spray"+nom].moveTo(-5, 0);
_root["spray"+nom].curveTo(-5, 5, 0, 5);
_root["spray"+nom].curveTo(5, 5, 5, 0);
_root["spray"+nom].curveTo(5, -5, 0, -5);
_root["spray"+nom].curveTo(-5, -5, -5, 0);
_root["spray"+nom].endFill();
}
_root["spray"+nom]._x = 225;
_root["spray"+nom]._y = 380;
_root["spray"+nom].fx = -2+random(5);
_root["spray"+nom].fy = 10+random(11);
_root["spray"+nom].onEnterFrame = function() {
this.fx *= 0.95;
this.fy *= 0.95;
this.fy -= 0.5;
this._x += this.fx;
this._y -= this.fy;
if (this._y>400) {
_root.h(this, nom);
}
};
}
function h(mc, nom) {
removeMovieClip(mc);
_root.spray(nom);
}
for (z=1; z<20; z++) {
spray(z);
}

Response to As: Api 2005-07-20 16:24:15


At 7/20/05 04:08 PM, MJKram wrote: I made a dodgy water spout thing.

Cool, though you might want to make the circles smaller and make more of them so it looks more realistic :P

Like this, http://img342.images..mage=fountain8fg.swf
(just edited yours :P).

_root.createEmptyMovieClip("floor", _root.getNextHighestDepth());
with (floor) {
lineStyle(10, 0x993300, 100);
moveTo(0, 390);
lineTo((Stage.width), 390);
}
function spray(nom) {
_root.createEmptyMovieClip("spray"+nom, nom);
with (_root["spray"+nom]) {
_root["spray"+nom].lineStyle(1, 0x0000ff, 0);
_root["spray"+nom].beginFill(0xbbbbff);
_root["spray"+nom].moveTo(-2, 0);
_root["spray"+nom].curveTo(-2, 2, 0, 2);
_root["spray"+nom].curveTo(2, 2, 2, 0);
_root["spray"+nom].curveTo(2, -2, 0, -2);
_root["spray"+nom].curveTo(-2, -2, -2, 0);
_root["spray"+nom].endFill();
}
_root["spray"+nom]._x = 225;
_root["spray"+nom]._y = 380;
_root["spray"+nom].fx = -2+random(5);
_root["spray"+nom].fy = 10+random(11);
_root["spray"+nom].onEnterFrame = function() {
this.fx *= 0.95;
this.fy *= 0.99;
this.fy -= 0.5;
this._x += this.fx;
this._y -= this.fy;
if (this._y>400) {
_root.h(this, nom);
}
};
}
function h(mc, nom) {
removeMovieClip(mc);
_root.spray(nom);
}
for (z=1; z<40; z++) {
spray(z);
}


Sup, bitches :)

BBS Signature

Response to As: Api 2005-07-23 13:49:16



- Matt, Rustyarcade.com

Response to As: Api 2005-08-03 00:58:14


At 7/8/05 03:05 PM, Denvish wrote:
At 7/8/05 02:59 PM, T-H wrote:
At 7/8/05 02:55 PM, Galactica wrote: My high score: 62735
Pitiful, 150422
lol, 188406

I know this is random, but, 236904.

As: Api


These new signatures can suck on mah balls. My lolis don't fit in. Lol wut what are you guys still doing on NG, move on.

BBS Signature

Response to As: Api 2005-08-03 01:31:29


i still really dont get the matrix gradient thing, they dont explain what a,b,c,d,e,f,g,i do. i find it easier to do
matrix = {matrixType:"box", x:100, y:100, w:300, h:200, r:0};

as in:
_root.createEmptyMovieClip("grad", 1);
with (grad) {
matrix = {matrixType:"box", x:100, y:100, w:300, h:200, r:0};
beginGradientFill("linear", [0xFF0000, 0x0000FF], [100, 100], [0, 0xFF], matrix);
moveTo(100, 100);
lineTo(100, 300);
lineTo(400, 300);
lineTo(400, 100);
lineTo(100, 100);
endFill();
}

Response to As: Api 2005-08-03 02:05:21


And again! New record over 300 000 this time!

As: Api


These new signatures can suck on mah balls. My lolis don't fit in. Lol wut what are you guys still doing on NG, move on.

BBS Signature

Response to As: Api 2005-08-03 02:27:01


cool.....

Response to As: Api 2005-08-23 03:30:04


Jeez jeez! curveTo is so freakin complicated! I am sooo bad at it! >:( I've been sitting here for nearly an hour trying to figure out how to get make a line go from something on the left, curve up towards something in the middle, and end on something on the right. Is that even possible?


These new signatures can suck on mah balls. My lolis don't fit in. Lol wut what are you guys still doing on NG, move on.

BBS Signature

Response to As: Api 2005-08-23 08:18:47


At 8/23/05 03:30 AM, KinZo wrote: I've been sitting here for nearly an hour trying to figure out how to get make a line go from something on the left, curve up towards something in the middle, and end on something on the right.

curveTo(50,-20,100,0)

Basically

curveTo(CURVE AROUND X, CURVE AROUND Y, CURVE END X, CURVE END Y);

FIRST POST AS LEVEL 11, SEXI.

Sup, bitches :)

BBS Signature

Response to As: Api 2005-08-23 08:20:12


At 8/23/05 08:18 AM, -liam- wrote:
FIRST POST AS LEVEL 11, SEXI.

lol, your level-up day too? Sweet.


- - Flash - Music - Images - -

BBS Signature

Response to As: Api 2005-08-23 08:28:02


At 8/23/05 08:20 AM, Denvish wrote: lol, your level-up day too? Sweet.

I know =P

Can't wait to get used to my new icon heh..


Sup, bitches :)

BBS Signature

Response to As: Api 2005-08-23 10:37:04


Ahhh! Finally! 2 hours of work! :D I love you all!


These new signatures can suck on mah balls. My lolis don't fit in. Lol wut what are you guys still doing on NG, move on.

BBS Signature

Response to As: Api 2005-08-23 10:40:19


At 8/23/05 10:37 AM, KinZo wrote: Ahhh! Finally! 2 hours of work! :D I love you all!

The feeling is mutual.


Sup, bitches :)

BBS Signature

Response to As: Api 2005-08-23 10:40:33


none of you read my AS: API :P?>

Response to As: Api 2005-09-06 17:57:20


Hey,since I read this tutorial,I made this...

Enter code into AS panel...

_root.createEmptyMovieClip("ch", 10);
ch.lineStyle(5, 0x000000, 100);
ch.beginFill(0xFF9900, 100);
ch.lineTo(40, 0);
ch.lineTo(40, 40);
ch.lineTo(0, 40);
ch.lineTo(0, 0);
ch._y = 200;
ch._x = 225;
onLoad = function () {
gravity = 10;
maxJump = 6;
walkSpeed = 5;
};
onEnterFrame = function () {
if (Key.isDown(Key.LEFT)) {
ch._x -= walkSpeed;
}
if (Key.isDown(Key.RIGHT)) {
ch._x += walkSpeed;
}
if (ch.air == true) {
ch._y += gravity;
}
if (_root.pl.hitTest(_root.ch)) {
ch.air = false;
} else {
ch.air = true;
}
if (ch.air == false) {
ch.jump = false;
}
if (ch.air == false) {
jump = true;
jumpcount = 0;
jumpSpeed = 22;
}
if (Key.isDown(Key.UP)) {
ch.jumpcount += 1;
}
if (Key.isDown(Key.UP) && jump == true) {
ch._y -= jumpSpeed;
}
if (jumpcount>maxJump && jumpSpeed>-2) {
ch.jumpSpeed -= 2;
}
};
_root.createEmptyMovieClip("pl", 2);
pl.lineStyle(0, 0x000000, 100);
pl.beginFill(0x000000, 100);
pl.lineTo(550, 0);
pl.lineTo(550, 40);
pl.lineTo(0, 40);
pl.lineTo(0, 0);
pl._x = -0.2;
pl._y = 374.1;

It's gonna be a box fly around :D


wat

Response to As: Api 2005-09-06 18:05:46


Meh. Not so much drawing API, more of a simple physics example. Ok for a start though.

Response to As: Api 2005-10-15 17:20:47


Hey.. does anyone know what the heck is wrong with this?

SW=Stage.width; SH=Stage.height;
with(_root){
beginFill(0x7E8635,100);moveTo(0,0);
lineTo(0,0);lineTo(SW,0);lineTo(SW,SH);lin
eTo(0,SH);lineTo(0,0);
endFill()}
_root.createEmptyMovieClip("SL", _root.getNextHighestDepth());
with (SL) {
lineStyle(2,0xE60000,700);
moveTo(60,30);
lineTo(339,30);
endFill();
}
_root.createEmptyMovieClip("circle_mc", _root.getNextHighestDepth());
with (circle_mc) {
lineStyle(2, 0x000000, 700);beginFill(0x1BCB3E,100);moveTo(30, 30);
lineTo(369, 30);lineTo(369, 519);lineTo(30, 519);lineTo(30, 30);
endFill();}

Why doesnt "SL" appear?


"Actually, the server timed out trying to remove all your posts..."

-TomFulp

Response to As: Api 2005-10-15 18:09:33


Try "with (_root.SL) {"


BBS Signature

Response to As: Api 2005-10-15 21:00:18


hey i havw writen a realy cool program for all you guys =D its my API drawer =D

Pc version
Right here

Ma version
Right here

How to use
select your settings click ok then start drawing
hit ENTER when your done drawing and you will get the Flash API code for your drawing
(just make sure you select all of it)

=D its still kinda in development but it works you just cant reset the canvas.. =( i have made that yet and i dont think im going to ither lol just close and open the program to reset it sory about that =( so any way have fun with it

Response to As: Api 2005-10-15 21:31:17


At 10/15/05 09:00 PM, shazwoogle wrote: hey i havw writen a realy cool program for all you guys =D its my API drawer =D

Pc version
Right here

For people who don't trust unknown .exe files, it's OK, I checked it. It's a Flash projector .exe, 1.55Mb.

At 10/15/05 05:20 PM, IWantSomeCookies wrote: Why doesnt "SL" appear?

It does appear, it's a red line, and it's hidden behind the circle_mc because it's on a lower depth.


- - Flash - Music - Images - -

BBS Signature

Response to As: Api 2005-10-18 03:00:53


At 10/15/05 09:31 PM, Denvish wrote: For people who don't trust unknown .exe files, it's OK, I checked it. It's a Flash projector .exe, 1.55Mb.

what did ya think of it?

Response to As: Api 2005-10-18 07:37:27


At 10/18/05 03:00 AM, shazwoogle wrote:
At 10/15/05 09:31 PM, Denvish wrote: For people who don't trust unknown .exe files, it's OK, I checked it. It's a Flash projector .exe, 1.55Mb.
what did ya think of it?

2 things

1) www.imageshack.us / www.pufile.com
2) Either I didnt get how to use it or its shit


- Matt, Rustyarcade.com

Response to As: Api 2005-10-18 11:30:12


At 10/18/05 03:00 AM, shazwoogle wrote: what did ya think of it?

Considering we have Denvishes API generator/tracer, it's really shit. I was just clicking randomly, theres no way you could actually draw something serious with that. Also a simple API generator wouldn't take much longer than 20 minutes and it would probably be better than. Good try, but no.

Also, for colour pickers, use the Flash 8 BitmapData class (if you have Flash 8).. it will allow you to do something like this: link.


Sup, bitches :)

BBS Signature

Response to As: Api 2005-10-18 11:42:08


At 10/18/05 11:30 AM, -liam- wrote: Also, for colour pickers, use the Flash 8 BitmapData class (if you have Flash 8).. it will allow you to do something like this: link.

I haven't messed with 8 much yet, but I'm going to be taking full advantage of that class and the cacheAsBitmap thingie when I do. Does making a colour picker like that require much code?


- - Flash - Music - Images - -

BBS Signature

Response to As: Api 2005-10-18 11:50:12


At 10/18/05 11:42 AM, Denvish wrote: Does making a colour picker like that require much code?

Thats the great thing, no it doesn't :)

Basically the getPixel function returns the colour of the Bitmap at the specified _x and _y locations, the hard part is actually understanding that you need to import the BitmapData class then create an instance of it, then attach it somewhere (_root being easiest). Then it's actually pretty easy.

BitmapData.getPixel(_x, _y);


Sup, bitches :)

BBS Signature

Response to As: Api 2005-10-18 11:53:20


At 10/18/05 11:50 AM, -liam- wrote:
At 10/18/05 11:42 AM, Denvish wrote: Does making a colour picker like that require much code?
Thats the great thing, no it doesn't :)

Basically the getPixel function returns the colour of the Bitmap at the specified _x and _y locations, the hard part is actually understanding that you need to import the BitmapData class then create an instance of it, then attach it somewhere (_root being easiest). Then it's actually pretty easy.

BitmapData.getPixel(_x, _y);

I suppose I could open Flash 8 and have a look, but it refuses to work alongside MX2004 for some reason, and I'm working on something currently. Does getPixel return the hexadecimal value of the pixel? If not, is there a way to do that?


- - Flash - Music - Images - -

BBS Signature

Response to As: Api 2005-10-18 11:58:59


At 10/18/05 11:53 AM, Denvish wrote: Does getPixel return the hexadecimal value of the pixel? If not, is there a way to do that?

No, it returns a number. You could create a function to convert the number to hexidecimal, but I have no idea how to do that. Ask Delta ;D


Sup, bitches :)

BBS Signature

Response to As: Api 2005-10-18 15:36:48


Here's a quick decimal to hex function I made. It may not be efficient, but it works:

function decToHex(dec)
{
hexNum = '';
lookupTable = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'A', 'B', 'C', 'D', 'E', 'F'];
while (dec > 0)
{
modRem = dec % 16;
hexNum += lookupTable[modRem];
dec = int(dec / 16);
}
newHex = '';
for (i = hexNum.length - 1; i >= 0; i--)
{
newHex += hexNum.charAt(i);
}
return newHex;
}