To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Reply
 
Thread Tools Search this Thread Display Modes
Old 03-28-2006, 11:08 PM   #1
drumatic
Special Agent
 
drumatic's Avatar
 
Join Date: Aug 2000
Location: nyc
Posts: 120
Scripting for Slide Viewer - A Problem

I am hacking up one of the movies posted here on Flashkit, some of you may have come across it, A handy little slide viewer from ValueAmerica.

Content Slider - Slides to Matrix Coordinates

I don't really script, so I'm guessing this is something REALLY simple and obvious, and hoping one of you may be able to point it out.

The movie comes with 100 slides built into a "Contents" MC - ungroup the Contents, edit, regroup, et voila!

Cool, except I don't have or or need 100 slides. I cut the ones I didn't need, leaving 30. PageTotal sets the number of slides in the script - I changed this to 30.

If you cycle forward through all the slides, 1, 2, 3...etc...up to 100, then press forward again, you go back to slide 1.

This still works - if you cycle through all 30 slides, you return to the 1st slide.

However, if you are on slide 1 and press back, it used to take you down to slide 100. Now, it still tries to take you to where slide 100 would have been (but of course it is deleted). So some condition has not been built into the back button it seems to dynamically update when PageTotal is changed - but I can't spot anything hard-coded to 100 slides. So I'm lost.

Here's the code (it's MX - it doesn't work if I publish it as Flash 8):

Code:
//
// SlideMenu funtion controls the speed of the movement to the next window
// Change the last number if you want to change the speed
function SlideMenu() {
	this._x += (newX-this._x)/6;
	this._y += (newY-this._y)/6;
}

// This next line calls the funtion named SlideMenu
WindowIN.Contents.onEnterFrame = SlideMenu;
newX = 0;
newY = 0;

//The next line is where you indicate the total number of display area(s)
PageTotal = 30;

//This is where we set our counter to 1
//The counter later limits the count to a maximum of the number set in PageTotal
CounterDisplay = 1;

//The following function is assigned to the Forward button
Forward.Forward.onPress = function() {
	CounterNumber++;
	XNumber++;

	// limit input field to a maximum as indicated above in PageTotal
	if (CounterNumber>PageTotal-1) {
		CounterNumber = 0;
		XNumber = 0;
		YNumber = 0;
	}
	CounterDisplay = CounterNumber+1;
	if (XNumber>9) {
		XNumber = 0;
		YNumber++;
	}
	newX = -XNumber*60;
	newY = -YNumber*50;
};

//This is a similar function for the Back button except in reverse
Back.Back.onPress = function() {
	CounterNumber--;
	XNumber--;
	if (CounterNumber<0) {
		CounterNumber = PageTotal-1;
		XNumber = 9;
		YNumber = 9;
	}
	CounterDisplay = CounterNumber+1;
	if (XNumber<0) {
		XNumber = 9;
		YNumber--;
	}
	newX = -XNumber*60;
	newY = -YNumber*50;
};
Has to be something in the Back.Back segment, I just can't figure out what. Any and all help appreciated.

In related news, I am also trying to figure out a way to incite Forward.Forward.onPress = function() on a timed schedule. So kinda like a function - SetInterval - function setup, but that doesn't quite work here.

It needs to say every X seconds then Forward.Forward AND ALSO onPress, Forward.Forward.

Any help on this topic also much appreciated...

~d
__________________
| KeMeK | drumatic | Threshold Theater | KeMeK Technology |

::If you don't know, learn; If you know, teach::
drumatic is offline   Reply With Quote
Old 03-30-2006, 09:43 PM   #2
drumatic
Special Agent
 
drumatic's Avatar
 
Join Date: Aug 2000
Location: nyc
Posts: 120
Anyone? Please?
__________________
| KeMeK | drumatic | Threshold Theater | KeMeK Technology |

::If you don't know, learn; If you know, teach::
drumatic is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:18 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.