Help creating a colouring game

Hi,
Can anyone point me in the direction of some colouring in tutorials for flash 5?
ie. like the ones seen on kids site like bob the builder and shrek where you click a colour and then apply it to an image.

Thanks in advance,
eve.

Here is the quick explanation:
1)I drew two little squares and colored them red and green respectively. I converted them to graphics (“F8”) .

  1. I drew a circle with a white fill and coverted it to a movie clip (“F8”) .

  2. VERY IMPORTANT!! You must name the instance of the movie clip! I named it “head” (without the quotes).

  3. I drew a rectangle with a white fill and converted it to a movie clip. I named the instance “body”(without the quotes). You can name these anything you want, but you must change the code accordingly.

Easy enough… now for the good stuff…

I wanted to be able to drag the little squares onto the head or body to color them. But, when I drag the color square, I want the color to always be visible. So…this is what I did…

  1. I created another layer. named it MC squares.

  2. I opened the library(F11) and dragged the two square graphics onto my layer (just put them anywhere).

  3. I converted the two square graphics to movie clips(F8) .

  4. INSTANCE NAMES! :slight_smile: I named the red movie clip “red”. I named the green movie clip “green” (no quotes!).

  5. Now, place your color movie clips exactly on top of your two color graphics (yes, they are identical). Use your info panel for correct placement. While you’re there, write down the x and y values of your color movie clips. We’re gonna need them.

  6. right click on the red movie clip and attach the following code.

//this makes the red square movie clip “draggable”

on(press){
_ _ _ _ this.startdrag();
}

//this provides actions when you let go of the mouse button

on(release){

//if you drop the red mclip on the head mc…
_ _ _ _ if(_root.red.hittest(_root.head)==true){

//set color attributes for the head mc
_ _ _ _ _ _ _ _ mycolor=new color(_root.head);

//change the color of the head mc to red
_ _ _ _ _ _ _ _ mycolor.setrgb(0xFF0000);

//or, if you drop the red mc on the body mc, change it to red.

_ _ _ _ } else if(_root.red.hittest(_root.body)==true){//if you drop it on the body, change color of body
_ _ _ _ _ _ _ _ mycolor=new color(_root.body);
_ _ _ _ _ _ _ _ mycolor.setrgb(0xFF0000);
_ _ _ _ }

//this is what you want it to do when you stop dragging.

_ _ _ _ this.stopdrag();

//return the red mc to it’s starting position.
//what you see below is where I had mine.
_ _ _ _ _root.red._x=29.3;
_ _ _ _ _root.red._y=127.3;
}

Now… do the same thing for the greem MC… wherever you see red above, change to green. Also, change the color value.
the color change should like like this…

mycolor.setrgb(0x00FF00);

Whew… hope you got all that. I can send you the fla if you wish, but I need your email address. Kirupa, I have the fla… maybe this is good enough for a short tutorial.

Hope this helps!

“My name is Inigo Montoya. You killed my father. Prepare to die!”

Or this : www.kirupa.com/developer/…agdrop.asp

pom 0]

as I shed a tear…

oh well… silly me. I should have looked in there first.

Thanks, pom.

That’s OK, I forgive you for this time. :rollin:

pom 0]

I was going to write and say something to the effect of this should be is the best of Kirupa-Then Pom slammed you silly. But the phrench are like that ya know. Pay no attention to that man behind the curtain-

pj
:slight_smile:

“You would not happen to have 6 fingers on your left hand would you?”

“Do you always start conversations this way?” “No, but out of curiousity, why do you ask?”

thanks, Phil (and POM). I think it still merits attention, if only to show different techniques. These two examples do exactly the same thing. I would say that the example above may provide more flexibility. As with all other things, Im sure someone else will provide an even easier way, or at least a different way.

Thanks Iammontoya, ilyaslamasse & Phil,
This is just what I needed!
eve