Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 6th, 2004, 01:07 PM
winteria winteria is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 3 winteria User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
stopping movieclip when reaches end

I'm creating a small sliding app which slides images left to right using next and previous buttons, however the clip continues to slide even if it goes off the stage. I would like it to stop when the last image of 'slider' has reached the edge of the stage. Can someone take a look at my code attached to the 'slider' in my movie? Thanks for any help!

Here's the AS attached to 'slider' (there is not instance name for it, it's just the movieclip slider):

Code:
// initialize movie to starting point
onClipEvent (load) {
	_x = 0;
	_y = 0;
	div = 5;
}
// sliding action
onClipEvent (enterFrame) {
	_x += (endX-_x)/div;
	_y += (endY-_y)/div;
	
	// previous button
	_root.previous.onRelease = function() {
		endX += 750;
		/*endY += 0;*/
	};
	// next button
	_root.next.onRelease = function() {
		endX -= 750;
		/*endY -= 0;*/
	};
}
Attached Files
File Type: zip testscroll.zip (2.7 KB, 50 views)

Reply With Quote
  #2  
Old February 6th, 2004, 02:20 PM
Tann San Tann San is offline
Gotta get to the next screen..
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2003
Location: Legion of Dynamic Discord
Posts: 4,713 Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)  Folding Points: 9974 Folding Title: Novice Folder
Time spent in forums: 3 Weeks 1 Day 10 h 8 m 6 sec
Reputation Power: 580
Facebook MySpace
Hi, I'm not at a machine with flash installed right now. It seems pretty straight forward though:
Code:
// initialize movie to starting point
onClipEvent (load) {
	_x = 0;
	_y = 0;
	div = 5;
                
                // These two are just my rough guesses
                minX = 0;
                maxX = 750*numberOfImages;
                
               // previous button
	_root.previous.onRelease = function() {
		endX += 750;
		/*endY += 0;*/
	};
	// next button
	_root.next.onRelease = function() {
		endX -= 750;
		/*endY -= 0;*/
	};
}
// sliding action
onClipEvent (enterFrame) {
               if(endX > minX || endX < maxX)
                        {
	             _x += (endX-_x)/div;
	            _y += (endY-_y)/div;	
	        }

All you have to do is work out what minX and maxX should be. Without looking at your source file I can't really say how to do this. I moved the button functions to onload as they should only really be created once.
__________________
-Tann

-Vote for your favorite ActionScript editor here.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > stopping movieclip when reaches end


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway