Advertisement

04.08.2008 at 10:17PM PDT, ID: 23307199
[x]
Attachment Details

slideshow / image gallery in AS3, how do I stop the slideshow?

Asked by kungricht in Macromedia Flash, Extensible Markup Language (XML), Scripting Languages

Tags: ActionScript 3.0, Firefox, http://www.kelliegraphicdesign.com/gallery/com_daybreakgarbett2.html

I just posted a question earlier, now I need more help. I have a slideshow/photogallery with thumbnails and right now the slideshow keeps going when you click a thumbnail, but now my client wants the slideshow stop when the thumbnails are clicked, how would I do this? thanks.
see what I have here: http://www.kelliegraphicdesign.com/gallery/com_daybreakgarbett2.html

here is my code:Start Free Trial
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:
//timer/////////////////////////////////////////////
 
var autoRotate = 0;
var imageTimer:Timer = new Timer(5000);
imageTimer.addEventListener(TimerEvent.TIMER, readImages);
 
function readImages(event:TimerEvent):void{
if(autoRotate == 0){
	imageTimer.start();
	trace("fired");
		top.alpha = 100;
	img_holder.removeChildAt(0);
if(increment < total-1){
	increment += 1;
} else {
	increment = 0;
}
ImageLoad(LINKS[increment],img_holder,0,0); 
imageNUMB.text = increment+1 + " of " + total;
}
}
 
//////////////////////////////////////////////////
 
//loader//////////////////////////////////////////
import flash.display.*;
import flash.events.*;
import flash.net.URLRequest;
import flash.net.URLVariables;
import fl.transitions.Tween;
import fl.transitions.easing.*;
 
var numOfImages = 90;
var imgNum = 0;
 
 
function ImageLoad(u:String,target,Ypos,Xpos){
	var targetClip = target;
	var positionY = Ypos;
	var positionX = Xpos;
    var _loader:Loader = new Loader();
    var request:URLRequest = new URLRequest(u);
    _loader.load(request);
	 targetClip.addChild(_loader);
	 //targetClip.y = positionY;
	 //targetClip.x = positionX;
	 _loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);
	 _loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
}
 
function loadProgress(event:ProgressEvent):void {
    var percentLoaded:Number = event.bytesLoaded/event.bytesTotal;
    percentLoaded = Math.round(percentLoaded * 100);
	if(percentLoaded > 20){
		trace("firing");
	preLoader.alpha = 100;
	} else{
	preLoader.alpha = 0;
	}
}
 
function completeHandler(event):void {
    trace("DONE");
	preLoader.alpha = 0;
	var myTween:Tween = new Tween(top, "alpha", Strong.easeOut, 1, 0, 1, true);
	imageTimer.start();
}
////////////////////////////////////////////////////
 
//xml load//////////////////////////////////////////
var loader:URLLoader;
loader = new URLLoader();
var increment = 0;
var total = 0;
var i = 0;
var TITLES = [];
var COPYS = [];
var LINKS = [];
 
//ADD EVENT LISTENER, THIS LISTENS FOR WHEN XML IS LOADED
loader.addEventListener(Event.COMPLETE, xmlLoaded);
 
//DEFINES XML FILE THAT IS LOADED
var request:URLRequest = new URLRequest("com_daybreakgarbett.xml");
loader.load(request);
 
//FUNCTON CALLED ONE XML IS LOADED
function xmlLoaded(event:Event):void {
   //DEFINE MY XML VARIABLE
   var myXML:XML = new XML(loader.data);
   total = myXML.children().length();
   trace(total);
   imageNUMB.text = "1 of " + total;
   ImageLoad(myXML.children().LINK[0],img_holder,0,0); 
   for (i=0; i<total; i++) {
		LINKS[i] = myXML.children().LINK.children()[i];
	}
}
////////////////////////////////////////////////////
 
//gallery//////////////////////////////////////////
btn1.addEventListener(MouseEvent.MOUSE_DOWN, showimg1); 
function showimg1(event:MouseEvent):void {
	top.alpha = 100;
	img_holder.removeChildAt(0);
ImageLoad(LINKS[0],img_holder,0,0);
increment = 0; //number makes the slideshow start at this image
imageNUMB.text = 1 + " of " + total;
}
 
btn2.addEventListener(MouseEvent.MOUSE_DOWN, showimg2); 
function showimg2(event:MouseEvent):void {
	top.alpha = 100;
	img_holder.removeChildAt(0);
ImageLoad(LINKS[1],img_holder,0,0);
increment = 1;
imageNUMB.text = 2 + " of " + total;
}
 
btn3.addEventListener(MouseEvent.MOUSE_DOWN, showimg3); 
function showimg3(event:MouseEvent):void {
	top.alpha = 100;
	img_holder.removeChildAt(0);
ImageLoad(LINKS[2],img_holder,0,0);
increment = 2;
imageNUMB.text = 3 + " of " + total;
}
 
btn4.addEventListener(MouseEvent.MOUSE_DOWN, showimg4); 
function showimg4(event:MouseEvent):void {
	top.alpha = 100;
	img_holder.removeChildAt(0);
ImageLoad(LINKS[3],img_holder,0,0);
increment = 3;
imageNUMB.text = 4 + " of " + total;
}
[+][-]04.09.2008 at 12:04AM PDT, ID: 21312416

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.09.2008 at 12:53AM PDT, ID: 21312667

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 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.09.2008 at 01:01AM PDT, ID: 21312701

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.09.2008 at 03:33PM PDT, ID: 21319766

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 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.09.2008 at 08:39PM PDT, ID: 21321510

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.09.2008 at 10:30PM PDT, ID: 21321918

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 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.09.2008 at 10:36PM PDT, ID: 21321936

View this solution now by starting your 7-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

Zones: Macromedia Flash, Extensible Markup Language (XML), Scripting Languages
Sign Up Now!
Solution Provided By: BongoMoose
Participating Experts: 2
Solution Grade: A
 
 
[+][-]04.10.2008 at 12:32AM PDT, ID: 21322458

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 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_Related_20080208