hitTest problem...
hope im making sense...
var b = Stage.getBounds(this);
this.onEnterFrame = function(){
if (_xmouse
trace("in stage");
}else{
trace("out of stage");
}
I know this dont work. Stage can't provide but the Stage.height and Stage.width not getbounds. but I figure unless the swf always thinks there's a cursor on stage that since it's a onEnterFrame call that it will continue to be called. So if I can wrap the var b with the Stage's bounds this should work in theory.
For jjcorreia-
I thought to make something more dynamic and work flow friendly.
For jjcorreia-
I thought to make something more dynamic and work flow friendly.
The solution provided is dynamic and workflow friendly enough. It is also the most cpu friendly solution. Trying to find bizarre combinations of items that wont consistently work is not work friendly. Sometimes a simple solution is all you need.
:puzzled:
The solution I provided earlier or a variant of it should be sufficient and easy enough.
thats why I say to have it pad in words one pixel. that way it fires before you leave the swf.
Pablo.
That may not be very reliable. If the mouse cursor misses that one pixel for any rason then it wont fire. Theres no reason to use something that risky over a simple method like I showed.
And why would you use getBounds when you should just use Stage.width and Stage.height?
but yes i am basically creating something where by you enter the flash animation area and it stops scrolling and then when you leave it continues scrolling... the area is the whole flash animation... and as FizixMan said it is only firing from the top...
so what would be the best way to do this?
onMouseMove = function(){
if(_xmouse > Stage.width
_xmouse < 0
_ymouse > Stage.height
_ymouse < 0){
trace("mouse out of bounds")
}
}
That doesnt work. MouseMove events stop firing when your cursor leaves the flash stage. (Fortunately AS 3.0 has a special event made specifically for alerting your movie when the mouse has left, so we wont have to have cheap solutions anymore :) ).
The solution I provided earlier or a variant of it should be sufficient and easy enough.
onMouseMove = function(){
if(_xmouse > Stage.width
_xmouse < 0
_ymouse > Stage.height
_ymouse < 0){
trace("mouse out of bounds")
}
}
anyone?
Your post has been the least constructive so far, whereas I was making a valid inquiry into his issue.
We have to first understand better what he is trying to accomplish before we can give him the best solution. I can throw any solution at him, but it would be more effective and educate him better if its the proper solution, not some random alternative that may cause other issues.
The solution provided is dynamic and workflow friendly enough. It is also the most cpu friendly solution. Trying to find bizarre combinations of items that wont consistently work is not work friendly. Sometimes a simple solution is all you need.
:puzzled:
Your right you did provide a fulfilling solution to the problem. I hope it help the person who needed the help. I my self never once until I had read this thought that I would ever need such a solution to this problem. But being a novice I thought I could expand upon my knowledge of Action scripting by having a engaging conversation on possibly providing a better solution. In a sense I'm just practicing to be a better programmer.
I under stand the hole "if it's broke to fix it". I also under stand how to keep it simple. It's very simple to see your logic here, and I'm doing nothing to discredit it. I just don't see how out side the job why it would be trivial to try to learn something new. Why would some one such as your self who has the ability to show their credentials, obviously has skills in this field and has put forth the effort here in this topic wish to stop any one else from proceeding in this topic. I guest I'm just disappointed that you would rather be negative here then be a participant. And don't take this as a insult I just wish to learn more myself.
See the link http://www.jacobcorreia.com/kirupa/bdd/mouseout/ as well as the attached fla.
var bounds_obj:Object = Stage.getBounds(this);
for (var i in bounds_obj) {
trace(i+" --> "+bounds_obj[i]);
}but I get
There is no method with the name 'getBounds'how can you get bounds of the stage and place them in a object.
I figure once you can do this there is a better way to see if you go out of bounds that don't require a _mc.
edit:
var bounds_obj:Object = _root.getBounds(this);
for (var i in bounds_obj) {
trace(i+" --> "+bounds_obj[i]);
}but I get output
yMax --> 6710886.35
yMin --> 6710886.35
xMax --> 6710886.35
xMin --> 6710886.35which I think is the max allowed of a stage which is kinda cool to know though I would never think that any one could use so much but hay what ever.
anyone?
Maybe you could try having an even for onMouseMove and do the hittest then?
#If you have any other info about this subject , Please add it free.# |

