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

Navigation troubles

Status
Not open for further replies.

spastique

Programmer
Jan 16, 2003
1
NZ
Hi,

Im creating a simple site navigation which is standing in a lift looking out into a room. lift buttons on the right are used to go to different floors. i.e. push a button - doors close - then open at new floor. The problem I am having is with the timing between floors and a floor indicator at the top of the scene displaying the floor numbers as you pass them.

How can I get flash to recognise which button was pushed then go to the current floor numbers frame in an animation and move one frame at a time towards the desired floor? (which will be forwards and backwards.

Any help appreciated.

Russell
 
Would be easier if you posted your .fla. Regards,

oldman3.gif
 
Here's how I'd do it..

A floor button would have an on (press) event that would set a variable indicating the target floor.

So if I press (3), the event could set floor = 3, and that variable could be used to refer to a particular frame in the "floor indicator" movie clip. (Note: for timing purposes this would not necessarily be a floor of the same number)

The on (press) event would then call a function contained in the floor indicator movie clip, that would look something like this:

if (clipWithButtons.floor < currentFloor) {
while (clipWithButtons.floor < currentFloor){
this.nextFrame();
}
else if (clipWithButtons.floor > currentFloor) {
while (clipWithButtons.floor > currentFloor) {
this.prevFrame();
}
}
}

For timing, I suggest spacing the &quot;floors&quot; out on the timeline of your floor indicator clip. So at 12 fps, if you want 1 second between indicator changes, put keyframes 12 frames apart and in those keyframes set currentFloor equal to the appropriate number. Give your indicator clip a dynamic textbox set to equal the var currentFloor, and you're all set.

I don't claim this is the most elegant solution, but hey.. it should work.

-T

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top