Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simulating MouseOvers

Status
Not open for further replies.

tfhwargt3

Programmer
Sep 19, 2006
61
US
I have a .onRollOver function written, and I have all the functionality i want for it inside. But when the user is not mousing over anything for a certain period of time, say 3 seconds, I want a simple scripted animation of a ball to start. I want my flash file to act the same when the ball happens to go over the objects with the obRollOver function attached to them. So basically the ball is like a second user that takes over when the real user is lazy. Is there a way to simulate this?
 
no, i know how to use setInterval. I was more wondering how to get a ball that is tracking across the screen to trigger the onRollOver function, or one like it.

Sorry.
 
Thanks ! That's awesome help. I got it working. But I want to do it in a loop. This is the structure of my prog is that i have a lot of videos in a grid. Each one is identified like
_root.vid0, _root.vid1, etc. etc. So below is my ball function /class where I check if the ball is true during hitTest(). Right now I am doing this:

Code:
....
Ball.prototype.onEnterFrame = function (){
/*various ball code*/
.
.
        if (_root.b0.hitTest(_root.vid0)) {
		trace("ball intersects 0");
	}
	if (_root.b0.hitTest(_root.vid1)) {
		trace("ball intersects 1");
	}
	if (_root.b0.hitTest(_root.vid2)) {
		trace("ball intersects 2");
	}
	if (_root.b0.hitTest(_root.vid3)) {
		trace("ball intersects 3");
	}
	if (_root.b0.hitTest(_root.vid4)) {
		trace("ball intersects 4");

        .
        . etc. etc. for each vid

You can see how this can get monotonous pasting for every single video. I tried this approach with a loop but it didn't work. Maybe someone can help me out.

Code:
       for (i=0; i<theFlvs.length-2; i++) {
		vidName = "vid"+i;
		if (_root.b0.hitTest(_root.vidName)) {
			trace("ball intersects " + vidName);
		} 
 	}

This doesn't do anything but the other method works fine.
Basically all i want to do is to be able to put in _root.vidName for vid0...

Thanks
 
what is the difference between _root. and _root[]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top