5 Replies - 1101 Views - Last Post: 09 April 2009 - 07:17 PM

#1 cadeownz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 12-July 08

Color drawing with mouse

Posted 02 September 2008 - 02:37 AM

Hey,
Im making a basic drawing app for my site, at the moment i have a bug. I made a 6 squares with diff colors in em and if u click the color when u draw its that color. Thats all good but when i draw with any color then i click that color again it deletes the one i have already drawn and i can draw again. I want it to stay there forever until i delete it with my delete all button. Heres the code for the red square (it happens to any square, red is just an example)
on (release) {
	red.enabled = false;
	blue.enabled = true;
	green.enabled = true;
	yellow.enabled = true;
	pink.enabled = true;
	black.enabled = true;
	_root.createEmptyMovieClip("myLineRed", 1);
	_root.onmousedown = function() {
   myLineRed.moveTo(_xmouse, _ymouse);
   myLineRed.lineStyle(2, 0xff0000, 100);
   _root.onmousemove = function() {
	  myLineRed.lineTo(_xmouse, _ymouse);
   }
}
	var colorful = new Color("_root.myLineRed");
	colorful.setRGB(0xff0000);
	
}

Please i need help i'm nearly 100% sure it deletes the line because of the bit that says _root.createEmptyMovieClip("myLineRed", 1);
Please someone help :D
Thanks in advance..
:D :D :^: :^: :D :) :) :D :blink: :blink: :P :P :D :D

Is This A Good Question/Topic? 0
  • +

Replies To: Color drawing with mouse

#2 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1167
  • View blog
  • Posts: 7,208
  • Joined: 07-September 06

Re: Color drawing with mouse

Posted 02 September 2008 - 05:38 AM

try this:

_root.createEmptyMovieClip("myLineRed_"+_root.getNextHighestDepth(), _root.getNextHighestDepth());


That should make it so that all the movieclips are on different layers so they don't overwrite eachother.

Hope that helps.
Was This Post Helpful? 0
  • +
  • -

#3 cadeownz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 12-July 08

Re: Color drawing with mouse

Posted 04 September 2008 - 02:54 AM

Ok thnx,
now u can draw again without it deleting but when i draw say red, then blue over the red, then red over the blue it goes underneath the blue.. ?
But yeah thanx 4 dat. :)
Was This Post Helpful? 0
  • +
  • -

#4 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1167
  • View blog
  • Posts: 7,208
  • Joined: 07-September 06

Re: Color drawing with mouse

Posted 04 September 2008 - 05:32 AM

It is probably because you are just adding to the movieclips, you should think about creating a new blank movieclip every time the color is changed and place that on the top, that way the new color will always be on top of the other colors.
Was This Post Helpful? 0
  • +
  • -

#5 DynamoAthletic  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 09-April 09

Re: Color drawing with mouse

Posted 09 April 2009 - 05:13 PM

This was interesting. I learned some things. Thank you.
Was This Post Helpful? 0
  • +
  • -

#6 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1167
  • View blog
  • Posts: 7,208
  • Joined: 07-September 06

Re: Color drawing with mouse

Posted 09 April 2009 - 07:17 PM

No problem, just glad to have been of assistance.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1