terencechow Posted July 5, 2015 Share Posted July 5, 2015 I'm using pixi v3.07 I have a movie clip for an initial state and a second one for a loop state. When I initiated the first movie clip I set visible = true and the second to false. I have an onComplete function for the first movie clip that `gotoAndPlay(0)` 's the second movie clip, which loops. As the user scrolls down the page, I turn off the above 2 clips with visible = false. The reason is because the sprite is offscreen and I want the movie clip to disappear and replay the first initial state when the person scrolls back up. However I notice that when I turn off the 2 clips with visible= false. It doesn't disappear. Instead it just stops playing the sprite. I've tried setting dirty = true and alpha = 0 and worldAlpha = 0 but none of this works. The second movie clip is still visible. Why is this? What am I doing wrong? Thanks! Terence Quote Link to comment Share on other sites More sharing options...
terencechow Posted July 6, 2015 Author Share Posted July 6, 2015 Answering my own question. Turns out alpha /visible works fine. I was using cancelAnimationFrame to cancel the animation after I made alpha = 0 / visible = false. The reason it didn't work is because my animate function with requestAnimationFrame had the render function. Hence although I set the alpha to 0, I cancelled the animation, and it's alpha = 0 never got rendered. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.