|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 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: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: |
import mx.transitions.Tween;
import mx.transitions.easing.*;
import flash.filters.ColorMatrixFilter;
/* Experiment with these settings for different circular animations */
var radiusX:Number = 250;
var radiusY:Number = 10;
var centerX:Number = Stage.width / 2;
var centerY:Number = 150;
var speedValue:Number = 0.1;
var perspective:Number = 100;
//create holder clip at depth 10 to house the rotating menu
var menu:MovieClip = this.createEmptyMovieClip("menu", 10);
//this keeps track of the currently selected menu item
var selectedID:Number;
//positive direction value means animate clockwise, negative value means anti-clockwise
var direction:Number = 1;
var distToTravel:Number;
//setup an array for Item text labels
var arrItems:Array = new Array("Planet 1", "Planet 2", "Planet 3");
var numOfItems:Number = arrItems.length;
//the distance(angle) between each item along the circumference
var sectorDistance:Number = ((Math.PI*2)/numOfItems);
//Colour Transform Arrays used for toggling coloir of selected item
//set transformed object colours to greyscale
var elementsGrey_array:Array = [0.3, 0.59, 0.11, 0, 0,
0.3, 0.59, 0.11, 0, 0,
0.3, 0.59, 0.11, 0, 0,
0, 0, 0, 1, 0];
//set transformed object colours back to normal
var elementsColor_array:Array = [1, 0, 0, 0, 0,
0, 1, 0, 0, 0,
0, 0, 1, 0, 0,
0, 0, 0, 1, 0];
var colorMatrix_filter:ColorMatrixFilter = new ColorMatrixFilter(elementsColor_array);
var colorMatrixGrey_filter:ColorMatrixFilter = new ColorMatrixFilter(elementsGrey_array);
//create menu items: attach from Library via linkageID and populate text label
for(var i=0;i<numOfItems;i++)
{
var mc = menu.attachMovie("planet" + (i+1),"item"+i, menu.getNextHighestDepth());
mc.txt_label.text=arrItems[i];
mc.angle = i * sectorDistance;
mc.id = i;
mc.filters = [colorMatrixGrey_filter];
mc.onRelease = released;
}
function released()
{
output.text = this.txt_label.text + " has been selected";
/* loop through each item and "reset" its angle
this is to ensure easier tracking and handling of values
ie. if it's previous resting angle was :
>= 2 * PI (a complete positive circle) or
< 0 (gone back beyond 0 due to anti-clockwise rotation
then recalulate an equivalent angle before proceeding */
for(var i=0;i<numOfItems;i++){
var mc:MovieClip = menu["item"+i];
if(mc.angle >= (Math.PI*2)){
mc.angle=mc.angle-Math.PI*2;
}
if(mc.angle < 0){
mc.angle=Math.PI*2 + mc.angle;
}
}
//record this selected menu item
selectedID = this.id;
//if this items current angle is between PI/2 and 1.5PI (ie is currently on the LEFT hand side of circle)
//then set to travel anti-clockwise (shortest path) and calculate how far it needs to travel to be at PI/2 (middle front)
if (this.angle <= 1.5 * Math.PI && this.angle > Math.PI/2){
direction = -1;
distToTravel = this.angle - Math.PI/2;
} else {
//else travelling clockwise
direction = 1;
if(this.angle >=0 && this.angle <= Math.PI/2){
distToTravel = Math.PI/2 - this.angle;
} else {
distToTravel = Math.PI/2 + (2 * Math.PI - this.angle);
}
}
//loop through all items
for(var i=0;i<numOfItems;i++)
{
var mc:MovieClip = menu["item"+i];
if(i==selectedID){
// set this items filters property to the colour transform matrix
mc.filters = [colorMatrix_filter];
//the selected items destination is set to PI (middle front of screen)
mc.dest = Math.PI/2;
} else {
//calculate this items destination
mc.dest = mc.angle + (direction * distToTravel);
// set this items filters property to the greyscale matrix
mc.filters = [colorMatrixGrey_filter];
}
if(direction==1 && mc.angle > mc.dest){
mc.dest = mc.dest + Math.PI*2;
}
mc.onEnterFrame = animate;
}
}
function animate()
{
//used to track whether we've reached destination
var kill:Boolean = false;
//temporarily calculate where the next onEnterframe would position this item
var newAngle:Number = this.angle + direction * speedValue;
//if we're travelling clockwise
if(direction==1){
if(newAngle >= this.dest){
//we've gone PAST our intended destination so set angle TO destination
this.angle = this.dest;
kill = true;
} else {
//set new angle
this.angle = newAngle;
}
//else we're travelling anti-clockwise
} else {
if(newAngle <= this.dest){
//we've gone PAST our intended destination so set angle TO destination
this.angle = this.dest;
kill = true;
} else {
//set new angle
this.angle = newAngle;
}
}
// set x,y position and scale
this._x = Math.cos(this.angle) * radiusX + centerX;
this._y = Math.sin(this.angle) * radiusY + centerY;
var s = (this._y - perspective) /(centerY+radiusY-perspective);
this._xscale = this._yscale = s*100;
this.swapDepths(Math.round(this._xscale) + 100);
if(kill){ // stop this item from animating
delete this.onEnterFrame;
}
}
//kick off the animation by manually triggering an onRelease of the 1st item in the array
menu.item0.onRelease();
|
Advertisement
| Hall of Fame |