Strike Force Heroes 2
The explosive sequel to the hit game Strike Force Heroes!
3.93 / 5.00 7,921 ViewsObsolescence
Defeat the enormous mechanical beasts--and become one of them.
4.01 / 5.00 40,755 Viewsa lot of advanced ASers don't know how to use the mouse wheel, it's a shame because it is really useful to use, this will explain the onMouseWheel handler
the first thing you need to do is create a new MouseListener ... this is done the following way
my_listener=new Object;
Mouse.addListener(my_listener);
now the next phase is actually add the onMouseWheel function, it is the part actually determining what happens
my_listener.onMouseWheel=function(delta){
//actions here
}
you're probebly wondering what "delta" is, delta is the amount of lines gone down, I'll just quote flash:
delta is an optional number indicating how many lines should be scrolled for each notch the user rolls the mouse wheel. A positive delta value indicates an upward scroll; a negative value indicates a downward scroll. Typical values are from 1 to 3; faster scrolling can produce larger values.
delta is very importent since it lets you know which direction has been scrolled... so right now you have
my_listener=new Object;
Mouse.addListener(my_listener);
my_listener.onMouseWheel=function(delta){
//actions here
}
actions here can depend on delta, for example you can increase or decrease the alpha of a movieclip depending on it allowing the user to see throught stuff, or better, zoom with a scripted camera (or without it) with it allowing users to "snipe" targets... this it very easially done
my_listener=new Object;
Mouse.addListener(my_listener);
my_listener.onMouseWheel=function(delta){
if((_root._xscale+delta<200) && (delta>0)){
_root._xscale+=delta;
_root._yscale+=delta;
}else if(_root._xscale-delta>50) && (delta<0)){
_root._xscale+=delta;
_root._yscale+=delta;
}
}
this can be scripted better , I know, so what :P
ask any questions ;)
heh heh http://www.newground../topic.php?id=310977
cheers
- Matt, Rustyarcade.com
That's really awesome, good job. I had no idea you could use the mouse wheel in Flash, and I actually understand Delta (straight away! wow!).
Oh and I see it works better with a very high framerate. Very. High.
Sup, bitches :)
At 7/23/05 07:57 AM, -liam- wrote: That's really awesome, good job. I had no idea you could use the mouse wheel in Flash, and I actually understand Delta (straight away! wow!).
Example.
Oh and I see it works better with a very high framerate. Very. High.
Lol, like the flash Liam. Add pictures! Jokes, i'm not that perverted.
How do you set a number for delta? Like, delta=3?
At 8/20/05 04:31 PM, mr_johnson22 wrote: How do you set a number for delta? Like, delta=3?
You don't set it. Delta is either 1 or -1, corresponding to the scroll movement.
At 8/20/05 05:01 PM, stickmoose wrote:At 8/20/05 04:31 PM, mr_johnson22 wrote: How do you set a number for delta? Like, delta=3?You don't set it. Delta is either 1 or -1, corresponding to the scroll movement.
Or more.. it can be -2 and 2
wtfbbqhax
At 8/20/05 05:51 PM, fwe wrote:At 8/20/05 05:01 PM, stickmoose wrote:Or more.. it can be -2 and 2At 8/20/05 04:31 PM, mr_johnson22 wrote: How do you set a number for delta? Like, delta=3?You don't set it. Delta is either 1 or -1, corresponding to the scroll movement.
Really? I never knew that.
my_listener=new Object;
Mouse.addListener(my_listener);
my_listener.onMouseWheel=function(delta){
if((_root._xscale+(delta*2)<200) && (delta*2>0)){
_root._xscale+=delta*2;
_root._yscale+=delta*2;
}else if(_root._xscale-delta>50) && (delta*2 <0)){
_root._xscale+=delta*2;
_root._yscale+=delta*2;
}
}
it can be any number
At 8/20/05 09:02 PM, ImpotentBoy2 wrote: my_listener=new Object;
Mouse.addListener(my_listener);
my_listener.onMouseWheel=function(delta){
if((_root._xscale+(delta*2)<200) && (delta*2>0)){
_root._xscale+=delta*2;
_root._yscale+=delta*2;
}else if(_root._xscale-delta>50) && (delta*2 <0)){
_root._xscale+=delta*2;
_root._yscale+=delta*2;
}
}
it can be any number
Yes, but delta in its original state is 1 or -1...how could it be over 1? Is it possible to scroll that fast? I thought onMouseWheel is invoked every scroll.
just found out (after a hour of messing with this thing) it doesnt work for mac.
so mac user.........BEWARE!
From your tutorial, I dont understand the last part, after you said using for sniping. U have stuff like if(_root._xscale < 200 = delta) BLAH BLAH, what does that stuff mean
INGLOR. WE MISSED YOU. Haha its actually really cool to see your name on the forums.
At 9/24/08 09:48 PM, Blackfang wrote: INGLOR. WE MISSED YOU. Haha its actually really cool to see your name on the forums.
Read the date of the post.
I have no country to fight for; my country is the earth; I am a citizen of the world
-- Eugene Debs