[SIZE=1]Hey there this is my first post/thread on the message board. As you can see I did read the ‘Please read before posting’ thread beforehand ;P[/SIZE]
[SIZE=1]My problem is that I can’t understand how to use:[/SIZE]
[SIZE=1]‘createEmptyMovieClip()’[/SIZE]
[SIZE=1]No matter what source I research it from and I would appreciate if anyone had a clearer description/definition for the code.[/SIZE]
[SIZE=1]I am needing help on this for creating a character that runs left and right for a game I am making.[/SIZE]
[SIZE=1]So far I have made the character run left and right using the arrow keys [Which, may I add, I am proud of achieving] but the problem lies within what happens when I press left or right. If I press left or right the character goes in that direction and shows the mc of the character running in that direction and moves along with but although I have managed to do this, the static mc of the character can still be seen behind the new mc of the character running in the direction. I dont want that happening.[/SIZE]
[SIZE=1]Any help would be appreciated greatly, if you need to see the code I have created so far to make the character move and stuff then just ask and I shall post it up.[/SIZE]
[SIZE=1]P.S. Anyone know which books are best for ActionScript reference and/or tutorials/examples [I already have the Colin Moock book for ActionScript reference][/SIZE]
[SIZE=1]Thanx[/SIZE]
var container:MovieClip = this.createEmptyMovieClip("container", 1);
this.createEmtpyMovieClip ("name_RefMC", 1);
where 1 is the depth.
[SIZE=1]I know the basic structure of that code [Plus what you’ve said Pointer is exactly what everything else says really, but thanx all the same] I’m looking to HIDE the original mc but still show the new mc on top. Again if you need the code to see what I am on about using it for then just ask.[/SIZE]
[SIZE=1][/SIZE]
[SIZE=1]In fact here is the code I have so far:[/SIZE]
[SIZE=1][/SIZE]
[SIZE=1]
[/SIZE]
[SIZE=1]onClipEvent(keyDown) {[/SIZE]
[SIZE=1] if(Key.isDown(Key.RIGHT)) {[/SIZE]
[SIZE=1] this.attachMovie("gerry_right", "gerryright", 5);[/SIZE]
[SIZE=1] this._x = this._x +10;[/SIZE]
[SIZE=1] }[/SIZE]
[SIZE=1]}[/SIZE]
[SIZE=1]onClipEvent(keyUp) {[/SIZE]
[SIZE=1] if(Key.getCode) {[/SIZE]
[SIZE=1] removeMovieClip(gerryright);[/SIZE]
[SIZE=1] }[/SIZE]
[SIZE=1]}[/SIZE]
[SIZE=1]
[/SIZE]
[SIZE=1][/SIZE]
[SIZE=1]Where ‘gerry_right’ is the mc of the character that runs right and ‘this’ is the mc already on the stage [Which is the static character].[/SIZE]
[SIZE=1][/SIZE]
[SIZE=1]Im looking to make the static character go invisible or disappear while the key RIGHT is pressed down and then reappear once it is released.[/SIZE]
[SIZE=1][/SIZE]
[SIZE=1]And would I use createEmptyMovieClip() during any of that code to make it work the way im trying to explain it?[/SIZE]
[SIZE=1][/SIZE]
[SIZE=1]Sorry if my first post was confusing.[/SIZE]
i am not into onClipEvent(-etc-)
Never put code on the mc’s
But give this a try.
in keyframe1:
onClipEvent (load) {
this.attachMovie("gerry_right", "gerryright", 5);
gerry_right._x = 10;
gerry_right._visible = false;
}
onClipEvent (keyDown) {
if (Key.getCode() == Key.RIGHT) {
_root.gerry_right._visible = true;
} else if (Key.getCode() == Key.UP) {
_root.gerry_right._visible = false;
}
}
[SIZE=1]The code looks good, but it doesn’t work unless its on a mc because its a **‘clipEvent’ **so the load thing makes both mc’s happen at once from loading. I tried putting it onto the mc too and same thing happened.[/SIZE]
[SIZE=1][/SIZE]
[SIZE=1]Or did you mean the first keyframe WITHIN the ‘gerry_right’ mc?[/SIZE]