[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.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

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!

9.0

set timer for carousel

Asked by mmucom in ActionScript

Hi experts,

i have 3d rotating button carousel.. go to this URL to see the flash carousel
http://mmu.in/imagebanner/.. in this carousel the movieclips are being attached from the library.. its called planet1MC, planet2MC, planet3MC..

what i need to do here is set a Timer for this carousel.

1).the animation need to do clockwise in every 15 seconds intervel

2).and also it shouldn't affect the onRelease function which is already there on the carousel

this is what all i need please take a look at the code below.. any doubts please let me know.. i hope its clear enough..

Thanks,
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();
[+][-]03/11/09 07:28 AM, ID: 23857628Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/11/09 10:26 PM, ID: 23865032Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/12/09 03:34 AM, ID: 23866600Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/12/09 03:39 AM, ID: 23866630Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/12/09 03:46 AM, ID: 23866682Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/12/09 05:30 AM, ID: 23867407Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/13/09 03:03 AM, ID: 23877384Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/13/09 03:24 AM, ID: 23877497Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: ActionScript
Sign Up Now!
Solution Provided By: john_hollings
Participating Experts: 1
Solution Grade: A
 
[+][-]03/13/09 05:33 AM, ID: 23878428Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/13/09 05:50 AM, ID: 23878589Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/13/09 05:55 AM, ID: 23878631Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/13/09 09:58 PM, ID: 23885470Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89 - Hierarchy / EE_QW_3_20080625