Skip to main content
January 31, 2015
Answered

Problem using a button inside a movieclip, and making a button change what it does on diffferent frames.

  • January 31, 2015
  • 1 reply
  • 309 views

First issue is that I cannot get any coding inside my movieclip to affect the main timeline.

Going as simple as possible, I reduced it down to

"

parent.nextFrame();

"

I thought less coding meant less room for mistakes, but it still does nothing at all.

Next issue is my button ignoring my IF statement.

"

if (this._currentframe != 4 || 10 || 16 || 22 || 28 || 34 || 40 || 46 || 52 || 58 || 64 || 70) {

    prevFrame();

    } else {

    gotoAndStop(3);

    }

"

This button is doing prevFrame no matter what frame it is on.

I read tutorials and kept using code people offered as solutions, but nothing has helped. Quick replies appreciated, I've got a deadline for this. Thankyou

This topic has been closed for replies.
Correct answer kglad

you should NOT use any coding in that movieclip other than stop(), play(), and the goto's.

but, if you CAN use coding in that movieclip to control the parent movieclip. eg,

_parent.nextFrame();

and that button code should be:

if (this._currentframe != 4 ||this._currentframe != 10 ||this._currentframe != 16 || this._currentframe !=22 || this._currentframe !=28 || this._currentframe !=34 || this._currentframe !=40 || this._currentframe !=46 || this._currentframe !=52 || this._currentframe !=58 || this._currentframe !=64 || this._currentframe !=70) {

    prevFrame();

    } else {

    gotoAndStop(3);

    }

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
January 31, 2015

you should NOT use any coding in that movieclip other than stop(), play(), and the goto's.

but, if you CAN use coding in that movieclip to control the parent movieclip. eg,

_parent.nextFrame();

and that button code should be:

if (this._currentframe != 4 ||this._currentframe != 10 ||this._currentframe != 16 || this._currentframe !=22 || this._currentframe !=28 || this._currentframe !=34 || this._currentframe !=40 || this._currentframe !=46 || this._currentframe !=52 || this._currentframe !=58 || this._currentframe !=64 || this._currentframe !=70) {

    prevFrame();

    } else {

    gotoAndStop(3);

    }

February 1, 2015

Of course. How I love coding! Where a single missing underscore can break it all! Adding it in fixed the issue thankyou!! However, the second part still doesn't work. It's totally ignoring what frame it is on. I'll find another way of doing it, but thankyou for trying! The first part was the most important bit anyway, really saved me there!

kglad
Community Expert
Community Expert
February 1, 2015

you're welcome.