Skip to main content
Participant
September 2, 2009
Answered

How do you stop/disable createEmptyMovieClip function

  • September 2, 2009
  • 1 reply
  • 584 views

I am designing a graph to allow line drawing. After the user draws the line, they will drag words (movieclips) from a menu onto to the graph. I am not able to turn of the line drawing function, so when the words are dragged another line is created. I tried to turn off the line drawing onRollOver of the word with no luck. Here is what I'm doing.

Draw line function:

var isDown:Boolean = false;
var xPos1:Number;
var yPos1:Number;
var xPos2:Number;
var yPos2:Number;

_root.onMouseDown = function() {

createLine("line")
createLine("line2")
intervalID = setInterval(startTimer, 1);


if (isDown == false) {
xPos1 = _xmouse;
yPos1 = _ymouse;
} else {

xPos2 = _xmouse;
yPos2 = _ymouse;
}

};
_root.onMouseUp = function() {
isDown = false;
drawLine(xPos1,yPos1,_xmouse,_ymouse);
clearInterval(intervalID);
//createLine("line2")
};

function startTimer() {
//line.clear();
isDown = true;
moveLine(xPos1,yPos1,_xmouse,_ymouse);
}

function drawLine(xValue1, yValue1, xValue2, yValue2) {

line.lineStyle(7, 0xFF0000, 100);
line.moveTo(xPos1,yPos1);
line.lineTo(_xmouse,_ymouse);
}

function moveLine(xValue1, yValue1, xValue2, yValue2) {
line2.clear();
line2.lineStyle(7, 0xFF0000, 100);
line2.moveTo(xPos1,yPos1);
line2.lineTo(_xmouse,_ymouse);
}

function createLine(movieClip){
_root.createEmptyMovieClip(movieClip,_root.getNextHighestDepth());

}


The movieclip equil should disable the drawing tool on rollover:

equil.onRollOver = function():Void {
     delete(this._parent.createLine.onRelease);
}

Thanks for any help.

This topic has been closed for replies.
Correct answer kglad

in your rollover use:

delete _root.onMouseDown;

delete _root.onMouseUp;

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
September 2, 2009

in your rollover use:

delete _root.onMouseDown;

delete _root.onMouseUp;

Participant
September 2, 2009

Thanks again kglad. It works great!

kglad
Community Expert
Community Expert
September 2, 2009

you're welcome.