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

real quick please.. 2

Status
Not open for further replies.

coldfused

Technical User
Jan 27, 2001
2,442
US
I have five buttons..portfolio, services, blah blah blah..

when pressed these buttons call a clip that houses a button that returns the user home..So they goto portfolio and the home button shows up..

action that calls the homelink clip which houses the return home button:

on (press) {
_root.homelink.direction = "forwards";
}

root.homelink plays reverse and fowards accordingly to play or hide the clip:

onClipEvent (load) {
this.stop();
}
onClipEvent (enterFrame) {
if (_root.homelink.direction == "forwards") {
this.gotoAndStop(this._currentframe+1);
}
if (_root.homelink.direction == "backwards") {
this.gotoAndStop(this._currentframe-1);
}
}
///////davebings script :)

button inside homeclip which closes the mc is:

on (press) {
_root.homelink.direction = "backwards";
}

Now what i need is for the other 4 buttons to test and see if the homelink clip has played already..if it has do nothing..(that way everytime they click a nav button the homelink mc doesn't keep playing to it's fowards position)..If it has not, play..So i'm guessing it is something like:

on (press) {
if (_root.homelink == "alreadyplayed") {
do nothing;
}
else if it has not, play..

some help please?

logo.gif


carlsatterwhite@orlandomediasolutions.com
 
You have pretty much got it right.

onClipEvent (load)
{
this.stop();
this.playedalready=false;
}

onClipEvent (enterFrame)
{
if (_root.homelink.direction == "forwards"&&this.playedalready==false)
{
this.gotoAndStop(this._currentframe+1);
this.playedalready=true;
}

if (_root.homelink.direction == "backwards")
{
this.gotoAndStop(this._currentframe-1);
}
}

This means it will only play once though. If you want it to play again once it has gone back then set playedalready=false;
after
this.gotoAndStop(this._currentframe-1);

Doing it this way means the clip checks itself and not the buttons that call it.

 
Change your main code on the homelink MC ... take out all stop() commands in its timeline and use this code instead:
Code:
onClipEvent (load) {
    var direction = "none"
    this.stop();
}
onClipEvent (enterFrame) {
    if (this.direction == &quot;forwards&quot; && this._currentframe < this._totalframes) {
        nextFrame();
    } else if (this.direction == &quot;backwards&quot; && this._currentframe > 1) {
        prevFrame();
    }
}
What SHOULD happen with this code is that when a nav button is clicked the &quot;forward&quot; direction is set in the homelink MC. This will then be used by the homelink MC to guage whether it needs to play any more or not. If it has reached its last frame, it doesn't play any more, even if the direction is re-set to &quot;forwards&quot;. The only thing that will make the homelink MC do anything is if the button inside it is clicked, reversing the direction.

The only possible failure opportunity for this is if you are using multiple instances of the homelink MC ... each new instance will be introduced at frame 1. Solution ? ... just use 1 instance over all the sections. _____________________________________________________
Knowledge is attained only by seeking out that which is unknown
 
Oh no! Which one to choose?! :) _____________________________________________________
Knowledge is attained only by seeking out that which is unknown
 
thanks alot..both worked well..
logo.gif


carlsatterwhite@orlandomediasolutions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top