Skip to main content
Participating Frequently
December 12, 2006
Answered

if(_currentframe == x){gotoAndPlay (y);}

  • December 12, 2006
  • 9 replies
  • 620 views
I want to put all of my AS into frame 1 of the main timeline, but when I do it doesn't work. The playhead is not jumping from frame 130 to frame 50 (which is what I want it to do) and, in fact, it does not appear to be reading my "if" statement, because it's not tracing the string "No Errors," which is inside the "if" statement. My movie clip instance is properly named "busLogo."

When I try to put the AS into the first frame of the busLogo timeline it also doesn't work.

This is what I have:

This topic has been closed for replies.
Correct answer cinemaguy
stop();

//Continuously animate busLogo
_root.busLogo.onEnterFrame = function () {
if(busLogo._currentframe == 130){
trace("No Errors");
gotoAndPlay("beginAnimation");
}
}

9 replies

Inspiring
December 13, 2006
First of all, I am Spanish, so excuse me if I haven't correctly understood
your question or my English is not very good.
I have to say that I am just an amateur, so my knowledge is not very deep,
but I suggest that you put the whole if-block inside an "onEnterFrame", like
this:

onEnterFrame = function() {
//Continuously animate busLogo
if(busLogo._currentframe == 130){
trace("No Errors");
gotoAndPlay("beginAnimation");
}
}

I don't know if this works for you, but you don't lose anything for trying
;-)
Regards,
Tris.-


Inspiring
December 13, 2006
...............
Participating Frequently
December 12, 2006
Thanks cinemaguy! That did it!
Inspiring
December 12, 2006
oops... sorry cinemaguy. I didnt realise you posted already..

i didnt copy you, i promise. =)
cinemaguyCorrect answer
Inspiring
December 12, 2006
stop();

//Continuously animate busLogo
_root.busLogo.onEnterFrame = function () {
if(busLogo._currentframe == 130){
trace("No Errors");
gotoAndPlay("beginAnimation");
}
}
Inspiring
December 12, 2006
quote:

Originally posted by: cinemaguy
stop();

//Continuously animate busLogo
_root.busLogo.onEnterFrame = function () {
if(busLogo._currentframe == 130){
trace("No Errors");
gotoAndPlay("beginAnimation");
}
}


you did forgot to add
busLogo.gotoAndPlay("beginAnimation");
Participating Frequently
December 12, 2006
Yes, that works, but I specifically want to be able to control everything from the first frame in the main time line. With the given script, under my knowledge, I believe that I should be able to do this.

However, it's not working.

I want to know either
a)What's wrong with the script or
b)That this is not possible.
Inspiring
December 12, 2006
Try this :
Inspiring
December 12, 2006
just put

gotoAndPlay(50);

of frame 130 of your logo animation.
Participating Frequently
December 12, 2006
No, all of my actions currently reside in the first frame of the main timeline (and, in fact, I have posted all of the actions that are written for it so far).

As for looping by default, I want it to animate through once and when it hits the end, I want it to loop starting with frame 50...not frame 1.
Inspiring
December 12, 2006
im quite new to AS, but im just wondering, in your busLogo mc, do you have any frames with actions on them? eg..stop();

also, if busLogo mc has nothing else inside it, you don't need any code, as it will loop by default.