Halp

Started by: The Dude | Replies: 1 | Views: 530

The Dude
2

Posts: 1,526
Joined: Dec 2007
Rep: 10

View Profile
Nov 7, 2009 8:37 PM #511128
Okay, so I'm making a drawing application because I assume this will enlarge some of my actionscript vocabulary before a try a difficult game, this is the code I have so far:


var drawing = false;
var color = 0x000000;

this.onMouseDown = function() {
drawing = true;
if (drawing == true) {
this.createEmptyMovieClip("line", this.getNextHighestDepth())
line.moveTo(_root._xmouse,_root._ymouse)
}
}

this.onMouseMove = function() {
if (drawing == true) {
line.lineTo(_root._xmouse,_root._ymouse)
}
}
updateAfterEvent();

this.onMouseUp = function() {
drawing = false;
}

this.onEnterFrame = function() {
line.lineStyle(4, 0x000000);
}


rb.onRelease = function() {
var color = 0xFF0000;
}

bb.onRelease = function() {
var color = 0x000000;
}

gb.onRelease = function() {
var color = 0x00FF00;
}

bbb.onRelease = function() {
var color = 0x0000FF;
}

yb.onRelease = function() {
var color = 0xFFFF0;
}

cb.onRelease = function() {
var color = 0x00FFFF;
}

pb.onRelease = function() {
var color = 0xFF00FF;
}
//colors
//black = 0x000000;
//red = 0xFF0000;
//green = 0x00FF00;
//blue = 0x0000FF;
//yellow = 0xFFFF00;
//cyan = 0x00FFFF;
//pink = 0xFF00FF;








Then near the bottom, when I click the red button to make it draw red, I don't know how, near the bottom of the code that's what I did.

Please help me learn how to make it change colors by pushing a button :D
Aycaramba
2

Posts: 766
Joined: Apr 2007
Rep: 10

View Profile
Nov 9, 2009 6:34 PM #511790
What exactly is the problem?
Send me the .fla instead and I'll try to fix it for you.
The only thing I can think of right now, is that you have to put an instance name on the button/mc.