views:

32

answers:

1

Hello.

I am creating a site with lots of big scrollable text-boxes in it. Each text-box object contained some text, and two buttons to scroll up/down with. The scroll buttons each had an event listener so the text moved when you clicked them.

These text-boxes were stacked on-top of each other with all except one having an alpha of 0. If I wanted to change which text-box is active I move it to the front and call a small TweenLite animation.

To the left (outside of the text-box objects) I have an object similar to a menu. It also has about 12 or so event-listeners (one for every button).

This turns out cause A LOT of lag an it's very troublesome for my laptop to run it. What I need help with doing is to reduce the number of event-listeners on the stage and also the amount of text-boxes.

What I was thinking was to add the text-boxes using AS so I only have 1 on the stage at a time but I couldn't figure out how to do it. I also thought it might be better to just use 1 big event-listeners and from mouseX and mouseY decide which button the user is trying to push.

Are there any better alternatives to this? And if so, please elaborate on how to do it.

+1  A: 

I never run into this situation for file that have more listeners than that, but by the way you can look at the library from Robert Penner as3signals

Patrick
Can't seem to get it to work. I've linked it in my publishing settings, added the "import org.osflash.signals;" but it says "1172: Definition org.osflash:signals could not be found."
DevEight
Check if you have add the swc into your library path, or you can use the source and drop them into your project folder
Patrick