to make something follow your mouse, make something(duh) and convert to movie clip the add this:
onClipEvent(mouseMove){
if(hitTest(_root._xmouse,_root._ymouse,true)){
goforit = "yes";
}
}
onClipEvent(enterFrame){
if(goforit == "yes"){
_x -= (_x - _root._xmouse) / 6;
_y -= (_y - _root._ymouse) / 6;
}
}
o make a custom cursor, make object, then convert to movie clip, give instance name cursor, and add:
onClipEvent (load) {
startDrag("", true);
Mouse.hide(); }
to make a drag drop game, draw object, convert to button, and add:
on (press) {
startDrag("box1");
}
on (release) {
stopDrag();
}
to make a link to a URL, make button and add:
getURL("whatever.com", "_blank");
to make button, make object, convert to symbol, ad:
on (release) {
_root.play();
}
then on the first frame of movie, add:
stop();
to make something move with arrow keys, make object, convert to movie clip, and add:
onClipEvent(load){
moveSpeed=10;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
this._x+=moveSpeed;
} else if (Key.isDown(Key.LEFT)) {
this._x-=moveSpeed;
}
if (Key.isDown(Key.DOWN)) {
this._y+=moveSpeed;
} else if (Key.isDown(Key.UP)) {
this._y-=moveSpeed;
}
}
to change speed, Substitute the 10 in “movespeed=10:” with a higher or lower number.
To make a mouse trail, create object, give instaqnce name “orig”, and add:
onClipEvent(load){i=0;}
onClipEvent (mouseMove){
i++;
this.duplicateMovieClip("MC"+i, i+10);
_root["MC"+i]._x = _root._xmouse;
_root["MC"+i]._y = _root._ymouse;
}
onClipEvent (enterFrame) {
if (_name=="orig") {
this._visible=0;
}else{
_alpha-=2;
_xscale-=2;
_yscale-=2;
if(_alpha<=2) {removeMovieClip(this);}
}
}
to make fireworks, add:
ravity=30;
numsparks=100;
sparksize=2;
SW=Stage.width; SH=Stage.height; f=100;
C1=new Array("0xFF0000", "0xFFFFFF", "0xFFFF00", "0xFF9900", "0xFFCC33", "0xFFFFFF")
function makespark(rd){
_root.createEmptyMovieClip("spark", -7000);
with(spark){
lineStyle(0, 0xFFFFFF, 0);
beginFill(0xFFFFFF);
moveTo(0, -rd);
curveTo(rd*1.5, 0, 0, rd);
curveTo(-rd*1.5, 0, 0, -rd);
endFill();
_visible=0;
}
}
function makeback(){
_root.createEmptyMovieClip("back", 1);
with(back){
beginFill(0x000000, 100);
moveTo(0, 0);
lineTo(SW, 0);
lineTo(SW, SH);
lineTo(0, SH);
lineTo(0, 0);
endFill();
}
back.onPress=function(){
f+= numsparks+10;
for(z=f; z<(f+numsparks); z++){
duplicateMovieClip("spark", "spark"+z, z)
with(_root["spark"+z]){
_x=_root._xmouse;
_y=_root._ymouse;
}
_root["spark"+z].vx= ((random(400)-200)/35);
_root["spark"+z].vy= ((random(200)-150)/35);
_root["spark"+z].onEnterFrame=function(){
new Color(this).setRGB(C1[random(C1.length)]);
this._x+=this.vx*0.6;
this._y+=this.vy*1;
this._alpha-=1;
down=random(gravity)/100;
this.vy+=down;
if(this._y>SH || this._alpha<0){
this.removeMovieClip();
}
}
}
}
}
makeback()
makespark(sparksize)
To make a 3D cube, add this:
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;
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.length; j++) {
var whichVert = model.side[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);
};
hope this helps. reppage, please if it helps