moondust_82
05-21-2004, 05:46 PM
Hello! I was hoping maybe someone could help me with this question I have about dragging "swatches" of color onto other changeable areas that will turn into this color after the swatch snaps back to its original position. If anyone cares, this is a lesson from chapter 2 of Brendan Dawes' "DragSlideFade" Flash ActionScript for Designers book (riddled with errors that are hard for people like me to figure out).
This is the script I have for each different colored swatch (same mc all with different instances on stage...."swatch," "swatch2," etc):
onClipEvent(load) {
colorObj = new Color (this);
thisColor = colorObj.getRGB();
startx = this._x;
starty = this._y;
}
onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse, false)) {
this.startDrag(true, 0, 0, 400, 300);
}
}
onClipEvent (mouseUp) {
this.stopDrag();
theDrop = eval(this._droptarget)
_root.debug = theDrop;
if (theDrop) {
theDrop.colorObj.setRGB(thisColor);
}
this._x = startx;
this._y = starty;
}
The mc areas I drop the swatches onto that change are programmed with this AS:
onClipEvent(load) {
colorObj = new Color (this);
}
The problem occurs when I try and change the colors on the different areas that accept the swatches (sometimes I just have one area on screen I want to recieve the swatch, sometimes multiple areas...like a coloring book with different areas for different color in the drawing)....the copied and pasted swatches with higher instance names ("swatch4," "swatch3," etc.) to the right of the original will NOT overpower the color of the lowest swatch once I drop that onto the color receiving area. I have NO idea what I need to change and why the other swatches won't override the originals before them.....any ideas? Thanks....
This is the script I have for each different colored swatch (same mc all with different instances on stage...."swatch," "swatch2," etc):
onClipEvent(load) {
colorObj = new Color (this);
thisColor = colorObj.getRGB();
startx = this._x;
starty = this._y;
}
onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse, false)) {
this.startDrag(true, 0, 0, 400, 300);
}
}
onClipEvent (mouseUp) {
this.stopDrag();
theDrop = eval(this._droptarget)
_root.debug = theDrop;
if (theDrop) {
theDrop.colorObj.setRGB(thisColor);
}
this._x = startx;
this._y = starty;
}
The mc areas I drop the swatches onto that change are programmed with this AS:
onClipEvent(load) {
colorObj = new Color (this);
}
The problem occurs when I try and change the colors on the different areas that accept the swatches (sometimes I just have one area on screen I want to recieve the swatch, sometimes multiple areas...like a coloring book with different areas for different color in the drawing)....the copied and pasted swatches with higher instance names ("swatch4," "swatch3," etc.) to the right of the original will NOT overpower the color of the lowest swatch once I drop that onto the color receiving area. I have NO idea what I need to change and why the other swatches won't override the originals before them.....any ideas? Thanks....