(I just made a MouseEvent.MOUSE_WHEEL evenlistener on the stage here, then changing the text fields scrollV property)
I know of two methods to solve this problem, I will introduce both of them and show how they are working, then I will tell a little about the difference and lastly show that actually only one of them works! (Thanks to the wonderful FGL forum)
Method one:
You need to download the source here, then put it in your library. When you need to use it, import:
import ru.etcs.ui.MouseWheel;
Then in the constructor for your document class call:
MouseWheel.capture ();
If you want to, you can also release it again, by calling:
MouseWheel.release ();
and it has a property showing if the mouseWheel is locked or not:
MouseWheel.captured
Here is a test of it (try scrolling now, it still works, but the page won’t scroll anymore):
The first one uses the byteArray and localConnection functions in AS3, to create an AS2 SWF that will prevent most browsers from getting the scroll event. (All credits goes to Steven from Yama Games for explaining this.)
The second one is using JavaScript to force the browser to keep the scroll location the same place when someone uses the scroll wheel over the SWF. This is just embedded in the class, not in the page as usually seen. (Again Steven has a expert comment saying it might not work on Facebook – as I still don’t have an account, I can’t go test it out myself).
Bonus info:
When compiling the memory difference is only 708 bytes, so no big difference there (Method 2 is smaller than Method 1).
Only one of them works!
So I just tested them all out on Kongregate, and it shows that only method 1 works!
So I will just stick with method one!
[...] auch von browser zu browser unterschiedlich sein das da z.b. ist ok: QuickTip: Scrolling Only in SWF, not on Page. | Rasmus Wriedt Larsen – Flash Game Development __________________ die ultimative antwort auf alle programmierfragen: der debugger! – vor eine [...]
[...] da nach, und probiere die logig umzustellen. also via javascript das browser-scrollen anschalten. QuickTip: Scrolling Only in SWF, not on Page. | Rasmus Wriedt Larsen – Flash Game Development __________________ die ultimative antwort auf alle programmierfragen: der debugger! – vor eine [...]
MichaelJW January 19th, 2010 at 04:21