Groups | Blog | Home
all groups > flash actionscript > september 2005 >

flash actionscript : making movieclip stop growing


Rothrock
9/4/2005 12:00:00 AM
Well I don't see your if condition to try and make it stop. That is what you
will need to use. You are probably trying to do something like:

if(bol._width==10){
//stop code
}

In that case it is possible that the width is not hitting 10 exactly so it
never stops. Instead use greater than or equal. Or of course you could be doing
something else entirely.
NSurveyor
9/4/2005 12:00:00 AM
A few things... <> is deprecated in favor of != Also, to be safe, you may want
to use: if(bol._width>=10), or use if(bol._width<10) for the incrementing the
_x and _y. Lastly, you need to add the if statement inside your onEnterFrame,
or it will only be called once. Try this:

vlakx = probeervlak_mc._x -20
vlaky = probeervlak_mc._y + 15

this.boormachine_mc.startDrag(true,vlakx,vlaky,vlakx+probeervlak_mc._width-10,vl
aky+probeervlak_mc._height-10)
var i:Number = 20
Mouse.hide()
probeervlak_mc.onMouseDown = function(){
bol = this.attachMovie("bol","bol"+i+"_mc",i)
bol._x = probeervlak_mc._xmouse + 20
bol._y = probeervlak_mc._ymouse - 20
bol._width = 0.1
bol._height = 0.1
this.onEnterFrame = function(){
if(bol._width<10){
bol._width += 0.1
bol._height += 0.1
}else{
delete this.onEnterFrame;
}
}
trace(bol._width);
i = i+1;
}
trace("uit");
probeervlak_mc.onMouseUp = function(){
delete this.onEnterFrame;
}
DrEv1l
9/4/2005 12:02:53 PM
vlakx = probeervlak_mc._x -20
vlaky = probeervlak_mc._y + 15

this.boormachine_mc.startDrag(true,vlakx,vlaky,vlakx+probeervlak_mc._width-10,vl
aky+probeervlak_mc._height-10)
var i:Number = 20
Mouse.hide()
probeervlak_mc.onMouseDown = function(){
bol = this.attachMovie("bol","bol"+i+"_mc",i)
bol._x = probeervlak_mc._xmouse + 20
bol._y = probeervlak_mc._ymouse - 20
bol._width = 0.1
bol._height = 0.1
if(bol._width <> 10){
this.onEnterFrame = function(){
bol._width += 0.1
bol._height += 0.1

delete this.onEnterFrame
}
trace(bol._width)
i = i+1
}
trace("uit")
}
probeervlak_mc.onMouseUp = function(){
delete this.onEnterFrame
}

In this code a movieclip wich is an oval starts growing on the event
mouseDown. But I want it to stop growing when the
width of the oval gets to a certain width and height. It doesn't stop with an
If condition so I don't really know how to make it stop.
As you also can see in my startDrag i've set a boundry in wich you can drag. I
would like my mouse to get shown again
when my mouse goes out of that boundry. that is another problem i've got

anyone got the answers?
AddThis Social Bookmark Button