Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

<< Prev 5 | Next 5

3D Balls

movieclip.prototype.revolve = function() {
	if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
		this._x = Math.cos(this.t)+((10)*5)*Math.cos((1.999/1.998)*this.t)+300+(random(100)-50);
		this._y = Math.sin(this.t)+((20)*5)*Math.sin((1.999/1.998)*this.t)+200+(random(100)-50);
	} else {
		this.t += .05;
		this._x = Math.cos(this.t)+((10)*5)*Math.cos((1.999/1.998)*this.t)+300;
		this._y = Math.sin(this.t)+((20)*5)*Math.sin((1.999/1.998)*this.t)+200;
		if (this._x<300) {
			this._xscale = 100+(300-this._x);
			this._yscale = 100+(300-this._x);
		} else {
			this._xscale = 100-(this._x-300);
			this._yscale = 100-(this._x-300);
		}
	}
	this._rotation = Math.atan2(_root.light._y-this._y, _root.light._x-this._x)*180/(Math.PI)-90;
};
Usage:
onClipEvent (load) {
	this.t = 0;//Change this number to change the ball's place in orbit.
}
onClipEvent (enterFrame) {
	revolve();
}
//I suppose this could've been made more elegantly, but it suits my needs.
Posted by: Dave Brushinski | website http://www.yahoo.com
3d balls
movieclip.prototype.revolve = function() {
        if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
                this._x = Math.cos(this.t)+((10)*5)*Math.cos((1.999/1.998)*this.t)+300+(random(100)-50);
                this._y = Math.sin(this.t)+((20)*5)*Math.sin((1.999/1.998)*this.t)+200+(random(100)-50);
        } else {
                this.t += .05;
                this._x = Math.cos(this.t)+((10)*5)*Math.cos((1.999/1.998)*this.t)+300;
                this._y = Math.sin(this.t)+((20)*5)*Math.sin((1.999/1.998)*this.t)+200;
                if (this._x<300) {
                        this._xscale = 100+(300-this._x);
                        this._yscale = 100+(300-this._x);
                } else {
                        this._xscale = 100-(this._x-300);
                        this._yscale = 100-(this._x-300);
                }
        }
        this._rotation = Math.atan2(_root.light._y-this._y, _root.light._x-this._x)*180/(Math.PI)-90;
};
Usage:
onClipEvent (load) {
        this.t = 0;//Change this number to change the ball's place in orbit.
}
onClipEvent (enterFrame) {
        revolve();
}

Posted by: Osama | website http://www.geocities.com/osama_nadeem2002/picmain.html
A Drag and Drop Script for Tangram Structures
on (press) {
	var xcor = _root.AAA._x;
	var ycor = _root.AAA._y;
	startDrag ("_root.AAA");
}
on (release) {
	stopDrag ();
	if (_root.AAA._droptarget == "/BBB") {
		_root.AAA._x = _root.BBB._x;
		_root.AAA._y = _root.BBB._y;

	} else {
		_root.AAA._x = xcor;
		_root.AAA._y = ycor;
	}
}

AAA = Instance name for the movie clip that is to be dragged

BBB = Instance name for the movie clip that is to be dropped on it

Brief Explanation:

AAA consists of a "button". And, the action of this button has to be like above. Also, pay attention that the center of AAA and the center of the button has to be matched.

You can use this script, if you want to create a tangram play with Flash. (Thanks Ali :o))
Posted by: Mustafa Basgun | website http://www.basgun.com
A Table Script
/*
This script was made for a flash shop system. its rather usefull in work with
a mysql db and swiftsql (an easy to handle php script to readout mysql contents).
but also without mysql in the back it may be usefull to have a table in his mc :)
*/

tableFormat = new Object ();
// space to the left movie border
tableFormat.left = 50;
// space to the top movie border
tableFormat.top = 50;
// space between each textfield (x & y)
tableFormat.xGrid = 5;
tableFormat.yGrid = 25;
// color settings
tableFormat.color1 = 0x9999CC;
tableFormat.color2 = 0x999999;
//
tableFormat.width;
tableFormat.height;
// start depth for the table
var count = 1;
// enter max lines here
var lines = 8;
var xStep = tableFormat.left;
var yStep = tableFormat.top;
//
// enter row names here
tableRows = new Array ("id", "name", "preis");
// enter width for each row given in the last array (same order)
tableCellLength = new Array (25, 160, 100);
createTable = function () {
        for (var i = 0; i < lines; i++) {
                for (var j = 0; j < tableRows.length; j++) {
                        this.createTextField (tableRows[j] + i, count, xStep, yStep, tableCellLength[j], 18);
                        this[tableRows[j] + i].text = this[tableRows[j] + "_" + i];
                        this[tableRows[j] + i].border = true;
                        this[tableRows[j] + i].borderColor = tableFormat.color1;
                        this[tableRows[j] + i].setTextFormat (standard);
                        xStep += this[tableRows[j] + i]._width + tableFormat.xGrid;
                        count++;
                }
                tableFormat.width = xStep;
                xStep = tableFormat.left;
                yStep += this[tableRows[j] + i]._height + tableFormat.yGrid;
        }
        tableFormat.height = yStep;
        yStep = tableFormat.top;
};
createTable ();
// Shows the final size of the table
trace ("Width: " + tableFormat.width);
trace ("Height: " + tableFormat.height);

Posted by: coldi | website http://www.here2stay.com
A variable set the the frame number of the common target frame
You could have a looping MC on a higher layer...
All your buttons make reference to one frame right? So if you log every frame you can detect when the frame number is equal to that frame, and grab the logged frame number before it, and set that to your back variable... hehe an example is in order.. something like this should work:
A variable set the the frame number of the common target frame:
_root.standardTarget = 45;

//An MC with this code on it:

onClipEvent (enterFrame) {
        if (_root._currentFrame == _root.standardTarget) {
                _root.backTarget = _root.lastFrame;
        } else {
                _root.lastFrame = _root._currentFrame;
        }
}
So every frame, this MC logs the current frame. If the current frame is equal to the common target, it sets the back target to being the last frame it logged.
This MC would have to be on it's own layer, and last the duration of the movie for it to work.
Should work fine.
Posted by: No name | website http://

<< Prev 5 | Next 5

Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.