Why won't it work

before i ask my question i just want to say sorry for posting this question in the actionscript foum and this forum but it had been a little while and nobody had posted in there let alone replied to my thread so i went in and found that it was empty so i decided to post the question here. sorry again.

why won’t it work
i had this code in a movie clip food1

PHP:--------------------------------------------------------------------------------

onClipEvent (enterFrame) {
    if (_root["food"+y], hitTest(_root.part1)) {
        snakelength++;
        x++;
        y++;
        duplicateMovieClip("food"+x, "food"+y, y);
        _root["food"+y]._x = (random(55))*10
        _root["food"+y]._y = (random(40))*10
    }
}


but of course when i duplicated the movieclip it didn’t keep the code because i changed the instace name but i wanted to be able to remove food1, so i put the code in a blank movie clip. I thought i had written the code so that it didn’t matter what movieclip it was in, but it worked in food1 but not in the blank movieclip. someone please help me. thanks.

try this:

Put this on food1 and move it outside of the stage. You are only using this MC to hold the code. Nothing else.


onClipEvent(enterFrame){
     if(this._name != "food1"){
          nFlag = this.hitTest(_root.part1);
          snakelength++;
          ii++;
          _root.food1.duplicateMovieClip("food"+ii, ii);
          _root["food"+ii]._x = (random(55))*10
          _root["food"+ii]._y = (random(40))*10
     }
}

Try that… it might work. I can’t test it because I don’t haev FLash on me…

I will delete the post in the other forum…

thanks for the reply jubba, but I’m using a different appoach now.