So I have a class called Player that extends Movieclip
why wont my code to attach a movie clip work?
import GAME_CLASSES.*;
Player1 = new Player()
Player1.setName("BobZdog")
Player1.attachMovie( "MainChar" , "Character1", 75)
Player1._x = 100
Player1._y = 100
Player1.gotoAndPlay(1)
trace(Player1.getName())
I have the Identifier for the movie clip i want to attach set to “MainChar” , the instance that appears on stage should be called “Character1”
arggg… I tried just this to see if i could get it
Player1 = new MovieClip()
//Player1.setName("BobZdog")
Player1.attachMovie( "MainChar" , "Character1", 75)
Player1._x = 100
Player1._y = 100
Player1.gotoAndPlay(1)
and it still wont work im obviously missing a key concept to atachMovie
arriba
2
Player1 is a MC that exists on the stage or you are trying to create it?
If your Player1 MC don´t exist that´s the reason why it don´t works, because you are trying to attach a clip inside it.
Try this:
this.createEmptyMovieClip("Player1", this.getNextHighestDepth());
Player1.attachMovie( "MainChar" , "Character1", 75)
Player1._x = 100
Player1._y = 100
Player1.gotoAndPlay(1)
yeah at the start of the clip the stage is totally blank
alright ill try that
would i still initalize player1
Player1 = new Player()
this.createEmptyMovieClip("Player1", this.getNextHighestDepth());
Player1.attachMovie( "MainChar" , "Character1", 75)
Player1.setName("Bob")
Player1._x = 100
Player1._y = 100
Player1.gotoAndPlay(1)