Skip to main content
Known Participant
September 16, 2010
Answered

attachMovie problem - Need help

  • September 16, 2010
  • 1 reply
  • 733 views

I'm trying to make a statusbar thing, each time you press the button, it attaches a new Movieclip. But it will only attach 1, then that 1 just moves down each time I press it.

function StatusTextUpdate() {
    AmountVisible++;
    root.menus.attachMovie("StatusUpdate", "StatusUpdate_"+AmountVisible, 1, {_x:-330.00,_y:20 * (AmountVisible) + (-500) });
}

I want it so it adds another 1 each time its pressed. Could someone show me how I can do this?

This topic has been closed for replies.
Correct answer kglad

you need to assign a different depth to each movieclip otherwise they're replacing one another.  at most, there can be one movieclip per depth:


function StatusTextUpdate() {
    AmountVisible++;
    root.menus.attachMovie("StatusUpdate", "StatusUpdate_"+AmountVisible, AmountVisible, {_x:-330.00,_y:20 * (AmountVisible) + (-500) });
}

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
September 16, 2010

you need to assign a different depth to each movieclip otherwise they're replacing one another.  at most, there can be one movieclip per depth:


function StatusTextUpdate() {
    AmountVisible++;
    root.menus.attachMovie("StatusUpdate", "StatusUpdate_"+AmountVisible, AmountVisible, {_x:-330.00,_y:20 * (AmountVisible) + (-500) });
}

TheBrodyAuthor
Known Participant
September 16, 2010

Inside the Movieclip, I have a text field. I'm trying to set the text to it, but it will not work.

function StatusTextUpdate() {
    AmountVisible++;


    _root.menus.attachMovie("StatusUpdate", "StatusUpdate_"+AmountVisible, AmountVisible, {_x:-330.00,_y:25*(AmountVisible)+(-530.00)});


    _root.menus.StatusUpdate_[AmountVisible].StatusTxt.text = "Your motto has been updated.";
}

What is wrong with this?

Ned Murphy
Legend
September 16, 2010

Try:

_root.menus["StatusUpdate_"+AmountVisible].StatusTxt.text = "Your motto has been updated.";