PDA

View Full Version : How do I make this not lag?


Frogman_Pep
07-24-2006, 07:44 PM
Posted this on the Actionscript 2.0 forum and have recieved no response. Any takers?

So I made a horizontal scrollbar for my portfolio section, which I dig, yet it's killing everyone's processor and slowing the browser to a snail's pace. Now part of the issue was I loaded 71 movies, and just turned the _visible property to false on the index page, letting them run in the background. Yeah I know I felt like an idiot, still do. And the other part was the portfolio movie was 250 frames so I could make it run slow enough to view + the code had to deal with each of the 71 movies, which I know you should write a function for, but I'm not that confident, or didn't want to take the time right now.

So I tried to go to sleep b/c I wanted a break, but once I layed down a bunch of thoughts poped into my head, that I had to try. So I took the frames down to 100, and took out the 71 lines of code, b/c I know I have to change that. Basically what it boils down to is this. How can I make the scrollbar run slow enough to view and not hog the user's processor. If you don't mind spending the time I uploaded the two fla's and you can check out the site at: http://66.201.127.187
http://66.201.127.187/Index4.fla
http://66.201.127.187/Portfolio3.fla

Assertnfailure
07-24-2006, 07:53 PM
function shiftThumbnails(){
//insert your code here
};

var shiftInterval = setInterval(this, "shiftThumbnails", 100); //set 100 to whatever rate you want (lower number = faster)

Now please set your framerate to 30

Frogman_Pep
07-24-2006, 08:52 PM
I'm going to mention everything b/c I'm not sure if I understand this correctly

First and foremost did you look at the .fla for the horizontal scroller (Portfolio3.fla).

I assume this code is supposed to be entered for that. Problem is, is when I enter it in before the code Flash responds with Statement must appear within on/onClipEvent handler, but if I place it within the onClipEvent (mouseMove) it doesn't seem to work. So I figured I'd place it with an onClipEvent (load) but when that's tested Flash responds with can't have onClipEvent's nested inside another. Then I thought about another movieclip on the timeline, but then your // about place your code here would not make sense.

I appreciate the code and see how it would work but can't figure out how to use it for this scenario. Any explanations?

ICD2k3
07-24-2006, 09:47 PM
for the scroller, u can make it go a lot faster and a lot less choppy if you just use actionscript instead of frames... IE

scrollclip.onEnterFrame = function() {
xMath = ((Stage.width/2) - _xmouse) / 10;
this._x += xMath;
}



there are TONS of variations on this script, but all are fast.

Frogman_Pep
07-24-2006, 10:46 PM
I've begun to play around with this script and am going to edit the original file so it will work. Plus I will look around the site as I'm sure there are some threads that deal with scrollers, but figured I'd ask if you, or anyone knows any?