STORY   LOOP   FURRY   PORN   GAMES
• C •   SERVICES [?] [R] RND   POPULAR
Archived flashes:
229456
/disc/ · /res/     /show/ · /fap/ · /gg/ · /swf/P0001 · P2574 · P5148

<div style="position:absolute;top:-99px;left:-99px;"><img src="http://swfchan.com:57475/10709969?noj=FRM10709969-5DC" width="1" height="1"></div>

Flash Action Script Tut.swf

This is the info page for
Flash #35573

(Click the ID number above for more basic data on this flash file.)


Text
4000/4000

Next

Hello, and welcome to my
tutorial.

Here you will learn how to:

Back

Make An Object Movable With The Arrow Keys
Make an item draggable (Good for dress up game)
Make a custom cursor
And make a rotating 3D cube.

So lets get started!

(Click)----->

Lesson One: Object Movable With Keys

Below we have an example of what we'll be making.
It's really simple.
Try it out! (move ball with arrow keys)

Ok, lets get started.
First, draw what you want to move with the arrow keys
I'll use a circle

Then make your object a movie clip, do this by pressing a F8.
There should be 3 choices, "Movie Clip, Button And Graphic"

F8

Select Movie Clip

Then when you're done with that, select your movie clip. There
should be a blue box around it. Like the one below, once there is the
blue box around it you can move on.

Ok, now comes the tricky part. The actions. The actions tell the
movie clip what it's going to do.
So if you're ready to get the actions.
Click the "Next" button, and good luck lol.

F9

Press F9 to open the
actions panel

Ok, you pressed it. Here's the actions.
Just copy and paste them to the action panel
(press F9 to open them)

onClipEvent (enterFrame) {
if (Key.isDown(Key.UP)) {
speed += 5;
}
if (Key.isDown(Key.DOWN)) {
speed -= 5;
}
if (Math.abs(speed)>20) {
speed *= .7;
}
if (Key.isDown(Key.LEFT)) {
_rotation -= 15;
}
if (Key.isDown(Key.RIGHT)) {
_rotation += 15;
}
speed *= .60;
x = Math.sin(_rotation*(Math.PI/180))*speed;
y = Math.cos(_rotation*(Math.PI/180))*speed*-1;
if (!_root.land.hitTest(_x+x, _y+y, true)) {
_x += x;
_y += y;
} else {
speed *= -.8;
}
}

And now you can test it out!
Press the next button for another tutorial.

Lesson Two: Obect Draggable

Ok, here you will learn how to make an object draggable when
you click and hold it.
Great for dress up games.
Below is a simple dress up game that I made. Try it out!

: )

Now, once again draw your character.
Then press F8 and select movie clip
And then make another layer above that one
Select Insert>Timeline>Layer

Then once you're done with all that junk go to the top layer
(the one you just created)
Say you're making  a shirt draggable.
If you where, you'd trace his upper torso, where the shirt would
go.
So trace the article of clothing that you want and press F8 and
select "Movie Clip"

Then select that article of clothing
(there should be a blue box around it)
and once again press F9 to open the actions panel
Click then "Next" button for the actions.

on(press){
startdrag("");
}
on(release){
stopDrag();
}

Woohoo! You did it!!! Good work!
Next Lesson: Custom Cursor

Lesson Three: Custom Cursor

Ok, making a custom cursor is always fun.
So lets get started.
First draw what you want to be your custom cursor

Now make it a movie clip.
Once again press F8 and select Movie Clip

Then select your custom cursor and hit F9 to open the
actions panel.

Press the next button for the actions

onClipEvent (load) {    startDrag ("", true);    Mouse.hide();}

Success.. You did it!!! Good work!
Next is a really cool trick that will teach you how to
make a 3D rotating cube with **ONLY** action script!
No drawing necessary!

e

b

u

C

D

3

g

n

i

t

a

o

R

:

r

F

s

L

There's not much to explaine because it's all action script... so lets
get started.
First hit the F9 button to open the actions panel.
Hit The "Next" button for the actions (prepare yourslf, it's a big one)

.

k

c

i

r

t

p

s

n

o

a

e

v

f

y

m

b

h

,

g

l

A

this.createEmptyMovieClip("center", 0);
center._x = Stage.width/2;
center._y = Stage.height/2;
focalLength = 400;
cube = {};
cube.vertexList = [];
cube.vertexList.push({x:-50, y:-50, z:50});
cube.vertexList.push({x:50, y:-50, z:50});
cube.vertexList.push({x:50, y:-50, z:-50});
cube.vertexList.push({x:-50, y:-50, z:-50});
cube.vertexList.push({x:-50, y:50, z:50});
cube.vertexList.push({x:50, y:50, z:50});
cube.vertexList.push({x:50, y:50, z:-50});
cube.vertexList.push({x:-50, y:50, z:-50});
cube.side = [];
cube.side.push([0,1,2,3]);
cube.side.push([2,1,5,6]);
cube.side.push([1,0,4,5]);
cube.side.push([5,4,7,6]);
cube.side.push([0,3,7,4]);
cube.side.push([3,2,6,7]);
render = function(model) {
if (transformMatrix) {
for (var i = 0; i < model.vertexList.length; i++) {
var vert = model.vertexList[i];
var x = transformMatrix.a*vert.x + transformMatrix.b*vert.y + transformMatrix.c*vert.z;
var y = transformMatrix.d*vert.x + transformMatrix.e*vert.y + transformMatrix.f*vert.z;
var z = transformMatrix.g*vert.x + transformMatrix.h*vert.y + transformMatrix.i*vert.z;;
vert.x = x;
vert.y = y;
vert.z = z;
}
delete transformMatrix;
}
center.clear();
center.lineStyle(2, 0, 100);
verts2D = [];
depthArray = [];
for (var i = 0; i < model.side.length; i++) {
var zDepth = 0;
for (var j = 0; j < model.side[i].length; j++) {
var whichVert = model.side[i][j];
if (verts2D[whichVert] == undefined) {
verts2D[whichVert] = {};
var scale = focalLength/(focalLength - model.vertexList[whichVert].z);
verts2D[whichVert].x = model.vertexList[whichVert].x * scale;
verts2D[whichVert].y = model.vertexList[whichVert].y * scale;
}
zDepth += model.vertexList[whichVert].z;
}
depthArray.push([model.side[i], zDepth]);
}
depthArray.sort(function(a,b) { return a[1] >
b[1] });
for (var i = 0; i < depthArray.length; i++) {
var sideVerts = depthArray[i][0];
center.moveTo(verts2D[sideVerts[0]].x, verts2D[sideVerts[0]].y);
center.beginFill(0x666666, 100);
for (var j = 1; j < sideVerts.length; j++) {
center.lineTo(verts2D[sideVerts[j]].x, verts2D[sideVerts[j]].y);
}
center.lineTo(verts2D[sideVerts[0]].x, verts2D[sideVerts[0]].y);
center.endFill();
}
}
rotateX = function(model, degree) {
var rad = degree*Math.PI/180;
var sin = Math.sin(rad);
var cos = Math.cos(rad);
var matrix = {a:1, b:0, c:0, d:0, e:cos, f:sin, g:0, h:-sin, i:cos};
transform(matrix, model);
}
rotateY = function(model, degree) {
var rad = degree*Math.PI/180;
var sin = Math.sin(rad);
var cos = Math.cos(rad);
var matrix = {a:cos, b:0, c:-sin, d:0, e:1, f:0, g:sin, h:0, i:cos};
transform(matrix, model);
}
rotateZ = function(model, degree) {
var rad = degree*Math.PI/180;
var sin = Math.sin(rad);
var cos = Math.cos(rad);
var matrix = {a:cos, b:sin, c:0, d:-sin, e:cos, f:0, g:0, h:0, i:1};
transform(matrix, model);
}
scale = function(model, percent) {
var rad = degree*Math.PI/180;
var matrix = {a:percent, b:0, c:0, d:0, e:percent, f:0, g:0, h:0, i:percent};
transform(matrix, model);
}
transform = function(matrix, model) {
if (transformMatrix) {
var a = matrix.a*transformMatrix.a + matrix.b*transformMatrix.d + matrix.c*transformMatrix.g;
var b = matrix.a*transformMatrix.b + matrix.b*transformMatrix.e + matrix.c*transformMatrix.h;
var c = matrix.a*transformMatrix.c + matrix.b*transformMatrix.f + matrix.c*transformMatrix.i;
var d = matrix.d*transformMatrix.a + matrix.e*transformMatrix.d + matrix.f*transformMatrix.g;
var e = matrix.d*transformMatrix.b + matrix.e*transformMatrix.e + matrix.f*transformMatrix.h;
var f = matrix.d*transformMatrix.c + matrix.e*transformMatrix.f + matrix.f*transformMatrix.i;
var g = matrix.g*transformMatrix.a + matrix.h*transformMatrix.d + matrix.i*transformMatrix.g;
var h = matrix.g*transformMatrix.b + matrix.h*transformMatrix.e + matrix.i*transformMatrix.h;
var i = matrix.g*transformMatrix.c + matrix.h*transformMatrix.f + matrix.i*transformMatrix.i;
transformMatrix = {a:a, b:b, c:c, d:d, e:e, f:f, g:g, h:h, i:i};
} else {
transformMatrix = matrix
}
}
center.onEnterFrame = function() {
rotateX(cube, 3);
rotateY(cube, 6);
rotateZ(cube, 10);
render(cube);
};

Just copy that
and paste it
to your action
panel.

That's the end of my tutorial!
Hope you learned a thing or two.
If you had any problems you can contact
me at VanceButler27@Yahoo.com
I'd be happy to help!

Replay?

ActionScript [AS1/AS2]

Frame 2
setProperty("/light", _visible , true); startDrag ("/light", true);
Frame 102
stop();
Instance of Symbol 41 MovieClip in Frame 104
onClipEvent (enterFrame) { if (Key.isDown(38)) { speed = speed + 5; } if (Key.isDown(40)) { speed = speed - 5; } if (Math.abs(speed) > 20) { speed = speed * 0.7; } if (Key.isDown(37)) { _rotation = (_rotation - 15); } if (Key.isDown(39)) { _rotation = (_rotation + 15); } speed = speed * 0.6; x = Math.sin(_rotation * (Math.PI/180)) * speed; y = (Math.cos(_rotation * (Math.PI/180)) * speed) * -1; if (!_root.land.hitTest(_x + x, _y + y, true)) { _x = (_x + x); _y = (_y + y); } else { speed = speed * -0.8; } }
Instance of Symbol 64 MovieClip in Frame 111
on (press) { startDrag (""); } on (release) { stopDrag(); }
Symbol 18 Button
on (release) { getURL ("http://www.newgrounds.com", "blank"); }
Symbol 22 Button
on (release) { _root.play(); }
Symbol 23 MovieClip Frame 1
_root.stop(); PercentLoaded = (_root.getBytesLoaded() / _root.getBytesTotal()) * 100; KB_out = (int(_root.getBytesLoaded() / 1000) + "/") + int(_root.getBytesTotal() / 1000); if (PercentLoaded != 100) { setProperty(barmask.bar, _xscale , PercentLoaded); } else { gotoAndStop ("loaded"); }
Symbol 23 MovieClip Frame 2
gotoAndPlay (1);
Symbol 28 Button
on (release) { nextFrame(); }
Symbol 34 Button
on (release) { prevFrame(); }
Symbol 122 Button
on (release) { prevFrame(); }
Symbol 130 Button
on (release) { nextFrame(); }

Library Items

Symbol 1 GraphicUsed by:2
Symbol 2 MovieClipUses:1Used by:Timeline
Symbol 3 GraphicUsed by:Timeline
Symbol 4 BitmapUsed by:5
Symbol 5 GraphicUses:4Used by:23
Symbol 6 FontUsed by:7
Symbol 7 EditableTextUses:6Used by:23
Symbol 8 BitmapUsed by:9 21
Symbol 9 GraphicUses:8Used by:23
Symbol 10 GraphicUsed by:14
Symbol 11 GraphicUsed by:12
Symbol 12 MovieClipUses:11Used by:14
Symbol 13 GraphicUsed by:14
Symbol 14 MovieClipUses:10 12 13Used by:23
Symbol 15 BitmapUsed by:16
Symbol 16 GraphicUses:15Used by:23
Symbol 17 GraphicUsed by:18 22
Symbol 18 ButtonUses:17Used by:19
Symbol 19 MovieClipUses:18Used by:23
Symbol 20 BitmapUsed by:21
Symbol 21 GraphicUses:8 20Used by:23
Symbol 22 ButtonUses:17Used by:23
Symbol 23 MovieClipUses:5 7 9 14 16 19 21 22Used by:Timeline
Symbol 24 SoundUsed by:Timeline
Symbol 25 GraphicUsed by:28
Symbol 26 FontUsed by:27 30 31 33 35 36 37 38 39 42 43 49 51 52 55 57 58 59 61 62 65 67 68 69 71 72 73 74 75 76 77 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 124 125 126 127 129
Symbol 27 TextUses:26Used by:28
Symbol 28 ButtonUses:25 27Used by:Timeline
Symbol 29 Font
Symbol 30 TextUses:26Used by:Timeline
Symbol 31 TextUses:26Used by:Timeline
Symbol 32 GraphicUsed by:34 122
Symbol 33 TextUses:26Used by:34 122
Symbol 34 ButtonUses:32 33Used by:Timeline
Symbol 35 TextUses:26Used by:Timeline
Symbol 36 TextUses:26Used by:Timeline
Symbol 37 TextUses:26Used by:Timeline
Symbol 38 TextUses:26Used by:Timeline
Symbol 39 TextUses:26Used by:Timeline
Symbol 40 GraphicUsed by:41  Timeline
Symbol 41 MovieClipUses:40Used by:Timeline
Symbol 42 TextUses:26Used by:Timeline
Symbol 43 TextUses:26Used by:Timeline
Symbol 44 GraphicUsed by:48 54
Symbol 45 FontUsed by:46 53
Symbol 46 TextUses:45Used by:48
Symbol 47 GraphicUsed by:48 54
Symbol 48 MovieClipUses:44 46 47Used by:Timeline
Symbol 49 TextUses:26Used by:Timeline
Symbol 50 GraphicUsed by:Timeline
Symbol 51 TextUses:26Used by:Timeline
Symbol 52 TextUses:26Used by:Timeline
Symbol 53 TextUses:45Used by:54
Symbol 54 MovieClipUses:44 53 47Used by:Timeline
Symbol 55 TextUses:26Used by:Timeline
Symbol 56 GraphicUsed by:Timeline
Symbol 57 TextUses:26Used by:Timeline
Symbol 58 EditableTextUses:26Used by:Timeline
Symbol 59 TextUses:26Used by:Timeline
Symbol 60 GraphicUsed by:Timeline
Symbol 61 TextUses:26Used by:Timeline
Symbol 62 TextUses:26Used by:Timeline
Symbol 63 GraphicUsed by:64
Symbol 64 MovieClipUses:63Used by:Timeline
Symbol 65 TextUses:26Used by:Timeline
Symbol 66 GraphicUsed by:Timeline
Symbol 67 TextUses:26Used by:Timeline
Symbol 68 TextUses:26Used by:Timeline
Symbol 69 TextUses:26Used by:Timeline
Symbol 70 GraphicUsed by:Timeline
Symbol 71 EditableTextUses:26Used by:Timeline
Symbol 72 TextUses:26Used by:Timeline
Symbol 73 TextUses:26Used by:Timeline
Symbol 74 TextUses:26Used by:Timeline
Symbol 75 TextUses:26Used by:Timeline
Symbol 76 TextUses:26Used by:Timeline
Symbol 77 TextUses:26Used by:Timeline
Symbol 78 GraphicUsed by:Timeline
Symbol 79 EditableTextUses:26Used by:Timeline
Symbol 80 TextUses:26Used by:Timeline
Symbol 81 TextUses:26Used by:Timeline
Symbol 82 TextUses:26Used by:Timeline
Symbol 83 TextUses:26Used by:Timeline
Symbol 84 TextUses:26Used by:Timeline
Symbol 85 TextUses:26Used by:Timeline
Symbol 86 TextUses:26Used by:Timeline
Symbol 87 TextUses:26Used by:Timeline
Symbol 88 TextUses:26Used by:Timeline
Symbol 89 TextUses:26Used by:Timeline
Symbol 90 TextUses:26Used by:Timeline
Symbol 91 TextUses:26Used by:Timeline
Symbol 92 TextUses:26Used by:Timeline
Symbol 93 TextUses:26Used by:Timeline
Symbol 94 TextUses:26Used by:Timeline
Symbol 95 TextUses:26Used by:Timeline
Symbol 96 TextUses:26Used by:Timeline
Symbol 97 TextUses:26Used by:Timeline
Symbol 98 TextUses:26Used by:Timeline
Symbol 99 TextUses:26Used by:Timeline
Symbol 100 TextUses:26Used by:Timeline
Symbol 101 TextUses:26Used by:Timeline
Symbol 102 TextUses:26Used by:Timeline
Symbol 103 TextUses:26Used by:Timeline
Symbol 104 TextUses:26Used by:Timeline
Symbol 105 TextUses:26Used by:Timeline
Symbol 106 TextUses:26Used by:Timeline
Symbol 107 TextUses:26Used by:Timeline
Symbol 108 TextUses:26Used by:Timeline
Symbol 109 TextUses:26Used by:Timeline
Symbol 110 TextUses:26Used by:Timeline
Symbol 111 TextUses:26Used by:Timeline
Symbol 112 TextUses:26Used by:Timeline
Symbol 113 TextUses:26Used by:Timeline
Symbol 114 TextUses:26Used by:Timeline
Symbol 115 TextUses:26Used by:Timeline
Symbol 116 TextUses:26Used by:Timeline
Symbol 117 TextUses:26Used by:Timeline
Symbol 118 TextUses:26Used by:Timeline
Symbol 119 TextUses:26Used by:Timeline
Symbol 120 TextUses:26Used by:Timeline
Symbol 121 TextUses:26Used by:Timeline
Symbol 122 ButtonUses:32 33Used by:Timeline
Symbol 123 GraphicUsed by:Timeline
Symbol 124 EditableTextUses:26Used by:Timeline
Symbol 125 EditableTextUses:26Used by:Timeline
Symbol 126 TextUses:26Used by:Timeline
Symbol 127 TextUses:26Used by:Timeline
Symbol 128 GraphicUsed by:130
Symbol 129 TextUses:26Used by:130
Symbol 130 ButtonUses:128 129Used by:Timeline

Instance Names

"light"Frame 1Symbol 2 MovieClip
"bar"Symbol 14 MovieClip Frame 1Symbol 12 MovieClip
"barmask"Symbol 23 MovieClip Frame 1Symbol 14 MovieClip

Labels

"loaded"Symbol 23 MovieClip Frame 3

Dynamic Text Variables

KB_outSymbol 7 EditableText"4000/4000"




http://swfchan.com/8/35573/info.shtml
Created: 15/5 -2019 23:33:50 Last modified: 15/5 -2019 23:33:50 Server time: 05/11 -2024 08:33:50