Copy link to clipboard
Copied
Hi guys, trying a new solution to a problem. Is it possible to have different movies play on the main timeline depending on which frame the main timeline is currently on when a button is clicked? This is the code I have tried but not working. Any help would be greatly apreciated!
this.fire2.addEventListener("click", fire.bind(this));
function fire()
{
if (this.currentFrame > 1 && this.currentFrame < 14)
{
this.shit2.visible=true;
this.shit2.play();
}
else if (this.currentFrame > 13 && this.currentFrame < 18)
{
this.pepe.visible=false;
this.shit16.visible=true;
this.shit16.play();
}
else (this.currentFrame > 17 && this.currentFrame <25)
{
this.shit19.visible=true;
this.shit19.play();
}
}
1 Correct answer
Thanks for the reply! I don't know what was wrong but it's working now.
BUT when using the if, if else and else statements, the movieClips were playing over each other in certain parts.
SO I went with 3 if statments instead and now they run smooth and separated? Don't know why.
So ->
this.fire2.addEventListener("click", fire.bind(this));
function fire()
{
//early shot
if (this.currentFrame > 1 && this.currentFrame < 14)
{
this.shit2.visible=true;
this.shit2.play();
}
//sweet shot
if (this.currentFrame > 13 &&
Copy link to clipboard
Copied
is this.fire2 on the main timeline?
this.shit16, this.shit2, this.shit19 are the in this.fire2 movieclip?
Copy link to clipboard
Copied
thanks for the reply! No fire2 is actually button that controls 3 movie clips depending on the position of the current frame.
Copy link to clipboard
Copied
check your developer console for errors. otherwise, that should work if fire2 is clicked when the timeline containing the code is between the 3rd and 25th frames.
Copy link to clipboard
Copied
Thanks for the reply! I don't know what was wrong but it's working now.
BUT when using the if, if else and else statements, the movieClips were playing over each other in certain parts.
SO I went with 3 if statments instead and now they run smooth and separated? Don't know why.
So ->
this.fire2.addEventListener("click", fire.bind(this));
function fire()
{
//early shot
if (this.currentFrame > 1 && this.currentFrame < 14)
{
this.shit2.visible=true;
this.shit2.play();
}
//sweet shot
if (this.currentFrame > 13 && this.currentFrame < 18)
{
this.pepe.visible=false;
this.shit16.visible=true;
this.shit16.play();
}
//late shot
if (this.currentFrame > 17 && this.currentFrame < 29)
{
this.shit19.visible=true;
this.shit19.play();
}
}
Copy link to clipboard
Copied
you're welcome.

