Copy link to clipboard
Copied
I can't believe how difficult it's been to find an answer for such a simple question. I found a thread in this forum titled "How to Resize a MovieClip at Runtime?", but the code that was posted as an answer has been removed from the post. WHY?!?! Is it a highly guarded secret?!?!
Anyway...I just want to know how to scale a movieclip at runtime with a drag function...and also while the parent movieclip already has a drag function active.
Any help would be much appreciated.
BTW...I've found a cure for death that also instantly makes you the richest person in the world with all the knowlege of the universe...
It can be found here:
onMouseUp and onRelease is usually (but not always) the same.
you can use a scaling factor:
var scaleFactor:Number = .3;
mc.onPress=function(){
resize_mc = this;
startX =_xmouse;
startY = _ymouse;
this.onEnterFrame=resizeF;
}
mc.onRelease=function(){
delete this.onEnterFrame;
}
function resizeF():Void{
resize_mc._width+=(_xmouse-startX)*scaleFactor;
resize_mc._height+=(_ymouse-startY)*scaleFactor;
}
Copy link to clipboard
Copied
if a parent movieclip has mouse handlers assign, mouse events for the child will be intercepted. you'll need to use a loop and hittest to detect when the child undergoes a mouse event.
the messages on the adobe forums that seem to have disappeared were caused by a forum conversion a few years ago. that's why many threads for a few years ago (or earlier) seem to have missing responses.
Copy link to clipboard
Copied
Much Thanks for the quick reply, Kglad, but I'm a complete noob of AS and need a code example...if it's not too much to ask.
Copy link to clipboard
Copied
what's the code you're using now for the parent?
what's the instance name of the child?
on press of what movieclip/button do you want to start resizing the child?
Copy link to clipboard
Copied
i_MCMButton.onPress = function()
{
_root.playerinfo.onPress = function()
{
_root.playerinfo.startDrag();
}
_root.playerinfo.onMouseUp = function()
{
_root.playerinfo.stopDrag();
}
}
I want to be able to scale the _root.playerinfo with a drag function...
Copy link to clipboard
Copied
My main question is just how to resize/scale a movieclip at runtime with a drag function...
If I could get a code example of just that, I'd greatly appreciate it...
Copy link to clipboard
Copied
mc.onPress=function(){
resize_mc = this;
startX =_xmouse;
startY = _ymouse;
this.onEnterFrame=resizeF;
}
mc.onRelease=function(){
delete this.onEnterFrame;
}
function resizeF():Void{
resize_mc._width+=(_xmouse-startX);
resize_mc._height+=(_ymouse-startY);
}
Copy link to clipboard
Copied
Thank You Very Much!!!
One question...is onRelease the same as onMouseUp?
Copy link to clipboard
Copied
Ok...I got it to resize, but WOW it resizes quick!
Is there a way to slow it down and keep it proportionate?
Copy link to clipboard
Copied
onMouseUp and onRelease is usually (but not always) the same.
you can use a scaling factor:
var scaleFactor:Number = .3;
mc.onPress=function(){
resize_mc = this;
startX =_xmouse;
startY = _ymouse;
this.onEnterFrame=resizeF;
}
mc.onRelease=function(){
delete this.onEnterFrame;
}
function resizeF():Void{
resize_mc._width+=(_xmouse-startX)*scaleFactor;
resize_mc._height+=(_ymouse-startY)*scaleFactor;
}
Copy link to clipboard
Copied
SPLENDID!! YOU ROCK!!
Thank You Very Much for your Time, Attention and Quick Responses!!
We need more helpful people like you in the world!!
Copy link to clipboard
Copied
you're very welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now