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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

On(rollOver) as a variable 1

Status
Not open for further replies.

Kirderf

Technical User
Oct 4, 2000
183
US
Hi Friends,
I am attempting to create a button that checks to see what frame on the timeline it is on and then use an on(rollOver)variable based on the results.(can that work?)Maybe I should be using a function? hmmm


//I would think the first thing is to set my variables
var1=on(rollOver){gotoAndPlay("one");
else
gotoAndPlay("two");
}
var2=on(rollOver){gotoAndPlay("two");
else
gotoAndPlay("one");

The second thing I would think would be to find out what frame the movie is on.
(How do you do this?)
frameNum=(the frame number)

//Next I think I would tell it to do something based on the results.

if {
frameNum<=100 var1;
else
var2;
}

Can you see what I am trying to do?

Thanks for any help here.

I'd gladly pay you on Thursday
for a hamburger today!
 
You would get the main timeline's current frame, with the following...

_global.main_currentFrame = _level0._currentframe;
// _global.main_currentFrame being the variable's name...

Then you could use that variable on your button's script, to direct the playhead to the appropriate frame...

Don't quite understand why you'd use an onRollOver event, but here goes...
Code:
on(rollOver){
    if(_global.main_currentFrame >= 100){
        _level0.gotoAndPlay("one");
    }else{
        _level0.gotoAndPlay("two");
    }
}

The above assuming you want the main timeline to play from frame labeled "one" or "two"...


Regards. Affiliate Program - Web Hosting - Web Design
After 25,000 posts, banned on FK, but proud not to have bowed down to them!
 
Thanks OldNewbie!
This works perfectly!!!

I'd gladly pay you on Thursday
for a hamburger today!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top