PDA

View Full Version : flash 5 drag/getproperty/random



OhSuzie
June 24th, 2003, 12:50 PM
Ok. I am making a website: left hand side= color samples.
RHS= 40 polka dots to make your own design.

click on the color samples and they setRGB the dots. I got that part.

The dots however have to be individually draggable. The dots currently are instances of one movie clip. They don't drag individually. They drag as a group!
Furthermore, I want to make a scramble function using Math.random, so when you press a button the polka dots arrange in a random pattern AND change colors from a ten color-sample spectrum.

I have individual bits of code but nothing works in conjunction with each other.

Should I just make a basket of lots of dots for each color sample so the user can individually drag them out and create his design, instead of having a set number of dots? What the hell should I do. Anyone with help would be saving my arse.

Another problem--lets say the user creates a design with the dots and wants exactly those colors he's chosen? How do I retrieve the properties and load them for my viewing?
:link:

radicaljugnu
June 24th, 2003, 02:21 PM
Try duplicating the polka dot mc and giving it a new mc and setting _x and _y respectivley.Then i think it should work

OhSuzie
June 24th, 2003, 03:47 PM
Thanks for your reply.

What I want to know is---do the dots have to be named individually?

If I duplicate mc how do I get them to drag AND change color?

Sorry-----!
Suzie

radicaljugnu
June 25th, 2003, 01:56 AM
first make just ONE polka dot mc. Inside it put an invisible mc which covers the entire polkadot with object actions-

onClipEvent(MouseDown){
_parent.startDrag()

}

i think that should work, or something like that. I haven't tested it.

[m]
June 25th, 2003, 07:27 AM
Juse a button, much easier.
on(press){
startDrag(this);
}
on(release){
stopDrag();
}

Or you could hang this on the polka mc straightaway (don't know if it will work though in Flash 5):

on(press){
startDrag(this);
}
on(release){
stopDrag();
}

OhSuzie
June 25th, 2003, 10:51 AM
Ok---I already got the dragging part, figured out I couldn't do it with onClipEvent, had to put buttons in the mc's. But question--where do I hang the Duplicate mc code, AND how do I get the dots to change color according to a 10 color spectrum? Let's say I have 24 dots and they could randomly be any set of 10 colors. I looked at the random color tutorial but this has a completely random spectrum--I just need it to be limited to 10 colors.

THANK YOU anyone who takes the time to figure this bs out.
Suzie

Dravos
June 25th, 2003, 11:02 AM
Put ur 10 predefined colors in an array say colArr[] the do random(10) to randomly select the element so


colArr=new Array();
colArr[0]=color1.....
....

setRGB(colArr[random(10)]);


would this do the trick?

OhSuzie
June 25th, 2003, 11:50 AM
Ok, does the new array go onto the main timeline or onto the polka dots or onto the button that duplicates the polka dots? I am confused. Sorry.

plus, the duplicate mc code is just not working for me. I am putting it on the dot, enterFrame it should duplicate. AND it should become draggable, but that's not happening either. I have no idea what I'm doing wrong. I tried putting hte code on the main timeline, changing the mc's to buttons, etc, but nothing seems to work. ARGH.