all groups > flash actionscript > november 2005 >
You're in the

flash actionscript

group:

changing mouse icons



changing mouse icons JF213
11/8/2005 10:21:19 PM
flash actionscript: ok this is hard for me to explain, so bare with me. I have a drawing board,
and I want my icon to change depending on the icon that the user clicks. ie.
brush_on change to brush, brush_off restore mouse. here is the code that I
have:


//enable scribble
function scribble() {
onMouseDown = function (){
_root.paint.moveTo(_xmouse, _ymouse);
onMouseMove = function (){
_root.paint.lineTo(_xmouse, _ymouse);
}
}
onMouseUp=function(){
onMouseMove=null;
}
};
//brush on
brush_on.onRelease = function() {
_root.paint.lineStyle(3,0x000000,100);
onMouseMove = scribble;
onEnterFrame = function() {
brush._x = _root._xmouse;
brush._y = _root._ymouse;
updateAfterEvent();
pen._x = -10000;
}
}

//brush off
brush_off.onRelease = function() {
delete onMouseDown;
onMouseMove = function() {
pen._x = _root._xmouse;
pen._y = _root._ymouse;
updateAfterEvent();
brush._x = -10000;
}
}

everything works, but I have another onEnterFrame called in my script so when
I leave onEnterFrame = function() { in the brush on it messes up my code.
I need it to read onMouseMove = function() { but that messes up my scribble.
Is there a better way of doing what I am trying to pice together.

Thanks for your help
Re: changing mouse icons kglad
11/9/2005 12:00:00 AM
Re: changing mouse icons JF213
11/9/2005 12:00:00 AM
maybe I miss understood....I tried this, but I am not sure if this is what you
meant.

//enable scribble
function scribble() {
myInterval = setInterval(start_scribble, 0);
function start_scribble(){
trace("help")
clearInterval(myInterval);
if (brush._x = -10000){
onMouseDown = function (){
_root.paint.moveTo(_xmouse, _ymouse);
onMouseMove = function (){
_root.paint.lineTo(_xmouse, _ymouse);
}
}
onMouseUp=function(){
onMouseMove=null;
}
onMouseMove = function(){
brush._x = _root._xmouse;
brush._y = _root._ymouse;
updateAfterEvent();
pen._x = -10000;
}
}else{
onMouseMove = function(){
pen._x = _root._xmouse;
pen._y = _root._ymouse;
updateAfterEvent();
brush._x = -10000;
}
}
}
}
//brush on
brush_on.onRelease = function() {
_root.paint.lineStyle(3,0x000000,100);
scribble();
}

//brush off
brush_off.onRelease = function() {
clearInterval(myInterval);
onMouseMove = function(){
pen._x = _root._xmouse;
pen._y = _root._ymouse;
updateAfterEvent();
brush._x = -10000;
}
}
Re: changing mouse icons JF213
11/9/2005 12:00:00 AM
sorry for the double post, but I got this working and I found out where my
problem is. Can someone help me with
onMouseUp=function(){onMouseMove=null;} It stops my icon from following my
mouse.


//enable scribble
function scribble() {
myInterval = setInterval(start_scribble, 0);
function start_scribble(){
clearInterval(myInterval);
if (brush._x = -10000){
onMouseDown = function (){
_root.paint.moveTo(_xmouse, _ymouse);
onMouseMove = function (){
_root.paint.lineTo(_xmouse, _ymouse);
//change mouse
brush._x = _root._xmouse;
brush._y = _root._ymouse;
updateAfterEvent();
pen._x = -10000;
}
}
onMouseUp=function(){
onMouseMove=null;
}
onMouseMove = function(){
//change mouse
brush._x = _root._xmouse;
brush._y = _root._ymouse;
updateAfterEvent();
pen._x = -10000;
}
}else{
onMouseMove = function(){
pen._x = _root._xmouse;
pen._y = _root._ymouse;
updateAfterEvent();
brush._x = -10000;
}
}
}
}
//brush on
brush_on.onRelease = function() {
_root.paint.lineStyle(3,0x000000,100);
scribble();
}

//brush off
brush_off.onRelease = function() {
clearInterval(myInterval);
onMouseMove = function(){
//change mouse
pen._x = _root._xmouse;
pen._y = _root._ymouse;
updateAfterEvent();
brush._x = -10000;
}
}

AddThis Social Bookmark Button