Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

photoscroller smoothness 1

Status
Not open for further replies.

z35

Programmer
Dec 21, 2001
206
US
hi,

i have a standard photoscroller movie embedded in my flash site.
the photoscroller is a small movie, which has been loaded into a movie clip in my flash movie.


the photoscroller seems to be jerky.

how can i get it to glide more smoothly? i feel like the quality of my movie is being ruined because the photoscroller is not smooth.
 
That isn't honestly noticably chopy. It seems all the pictures with their boxes should be a symbol (a movie clip or grapic) and the code to move it whould only move the symbol... Other than that, keep image files as simple as possible.

Otherwise you could make two movies (this would elamate the speed control set by the mouse's position) and make play the movie for one way if right of center the other for left of center, and the motion tween would be a lot smoother at the cost of the speed adjustment (which I kind of like).
 
What version of Flash are you using? That looks pretty outdated.

If you have at least Flash 5, something like this will be a lot easier to work with (this would go on the movie clip you want to scroll):

Code:
onClipEvent (load) {
	speed = 0;
	center = 225;
	w = _width/2;
}
onClipEvent (enterFrame) {
	speed = (_root._xmouse-center)/10;
	_x -= speed;
	(_x<=center-w)?(_x=center-w):null;
	(_x>=center+w)?(_x=center+w):null;
	updateAfterEvent();
}


frozenpeas
 
i have flash 5.0.

your code is much more simpler and more efficient.

i'm not good at actionscript. did you just come up with that code? its short but very complex. how do flashers create code like this? i would really like to get your advice.

is the moviement smoother than my movie? it seems to be the same.
 
Experience, I guess. It can get much crazier than this... there is always something to learn. Some of of the hardcore ActionScripters out there have got serious chops.

I think the best way to learn is to create everything from scratch... experiment, ask questions. Participate in forums like this...

The movement should be smoother than your previous version. If it's still choppy, try upping your frame rate to 20 or so... maybe even more.

frozenpeas
 
creating from scratch is a good idea but time consuming.

i have some questions:

1.the movie scrolls too much to he right and you see empty space. how do i fix this? (scrolling to the left is ok. it stops at the last photo)

2.what is &quot;-=&quot; as in _x -= speed (ive never seen this before)

3. what is &quot;?&quot; as in (_x>=center+w) ? (_x=center+w) : null

thanks for your help.
 
1. As it is now, the scrolling stops when the edges reach the center of the stage. You can play with the
Code:
center+w
values, try replacing it with a number to adjust where you'd like it to stop.

2. -= subtracts from and resets a value at the same time. It is just a more efficient way of saying
Code:
_x = _x-speed;

3.
Code:
(_x>=center+w)?(_x=center+w):null;
is a tertiary statement. It is a different way to do an if statement. It is formed like this:

Code:
(condition)?action:elseAction;

which is like saying:

Code:
if(condition){
   action;
}else{
   elseAction;
}

Thanks for the star. :)
frozenpeas
 
Yes. If you have 1 FPS, every second the frame will advance. Yuck! But if you have 10 FPS, every 1/10 of a second the frame will advance. Much smoother. The smoothness gets better and the movie plays faster as the FPS is raised.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top