I tried posting this problem once before but got no reply so I thought I would try explaining it a little better.
I use the following code within a movieclip (made of multiple other movieclips and named "mcMap") to drop circles (instances of a circle movieclip with the linkage name of "CircleSymbol") each time the player clicks in a designated area defined by a named movieclip "mcMap":
The following code, placed on the first frame of the main timeline, allows the user to scale the size of the dropped circles if the user drags the mouse while holding down the mouse key:Code:stop(); var i:Number = 0; mcMap.onPress = function() { i++; _root.attachMovie("CircleSymbol", "mcCircle"+i, i, {_x:_root._xmouse, _y:_root._ymouse}); _root.clipName = "mcCircle"+i; _root.xPos = _root._xmouse; _root.yPos = _root._ymouse; _root.scaleClip = true; _root.allowClip = true; _root["mcCircle" + i].setMask(mcMap); }; mcMap.onRelease = function() { _root.scaleClip = false; }; mcMap.onReleaseOutside = function() { _root.scaleClip = false; };
The problem I am having is that although the circles are masked correctly when they are first dropped (i.e. they do not display outside of the "mcMap" area) once a subsequent circle is dropped the previous circle is no longer masked. I am using the following script in the first bit of code to define the mask for the dropped circles:Code:stop(); _root.onEnterFrame = function() { if (_root.scaleClip == true) { xDist = _root._xmouse-_root.xPos; yDist = _root._ymouse-_root.yPos; if (_root[_root.clipName]._width + (_root.xDist + _root.yDist) > 10 && _root[_root.clipName]._height + (_root.xDist + _root.yDist) > 10) { _root[_root.clipName]._width += _root.xDist + _root.yDist; _root[_root.clipName]._height += _root.xDist + _root.yDist; _root.xPos = _root._xmouse; _root.yPos = _root._ymouse; } } }; mcGotoMap.onRelease = function(){ _root.mcMapAppear.gotoAndPlay("start"); };
Attached is an example fla. Press the "Press to Start" button to see what is happening.Code:_root["mcCircle" + i].setMask(mcMap);




Reply With Quote