Skip to main content
Participant
July 13, 2006
Question

scaling a movieclip...scaling whole stage instead...

  • July 13, 2006
  • 2 replies
  • 236 views
Hello,

I have a button that adds instances of a movie clip to the stage. I want to be able to scale the movie clip after it has been loaded to the stage. The following code works, but it scales eveything on the stage, not just the movie clip instance. Any help would be appreciated.

Thanks,

Muhl


on (release) {
mc3 = attachMovie ("square", "square" + counter, counter + 4);
counter++;
mc3._x = 200;
mc3._y = 200;
mc3.onPress = function() {
this.startDrag();
}
mc3.onRelease = function() {
this.stopDrag();
}
mc3.onKeyDown = function(){
if(Key.isDown(Key.RIGHT)){
scale = _xscale + 10;
_xscale = scale
//trace("the bos should be scales larger");
}
if(Key.isDown(Key.UP)){
scale = _yscale + 10;
_yscale = scale
}
if(Key.isDown(Key.DOWN)){
scale = _yscale - 10;
_yscale = scale
}
if(Key.isDown(Key.LEFT)){
scale = _xscale - 10;
_xscale = scale
}
}
Key.addListener(mc3);
}
This topic has been closed for replies.

2 replies

muhlAuthor
Participant
July 13, 2006
Thanks fikshin,

Works like a champ...Is there anyway that I can isolate each of the squares that the user places on the stage so they can be scaled separately???

Thanks again,

Mike
Known Participant
July 13, 2006
you have to use "instance._property"

i.e.:
if(Key.isDown(Key.RIGHT)){
_root.movieClip._xscale += 5;
}

instead of

if(Key.isDown(Key.RIGHT)){
_xscale += 5;
}


the reason being, when flash sees "_xscale" by itself it has no idea which object's xscale
you are referring to and assumes "_root"