Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-21-2004, 05:46 PM   #1
moondust_82
Registered User
 
moondust_82's Avatar
 
Join Date: May 2004
Location: Washington, DC
Posts: 12
Default Fixing messed up "drag 'n drop" swatch color effect

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....
moondust_82 is offline   Reply With Quote
Old 05-23-2004, 10:48 AM   #2
pixelwit
village halfwit
 
pixelwit's Avatar
 
Join Date: Jul 2001
Location: USA, PA
Posts: 3,330
Default

Can you post a stripped down version of your FLA?

-PiXELWiT
http://www.pixelwit.com
__________________
There are no answers, only choices.
pixelwit is offline   Reply With Quote
Old 05-23-2004, 05:52 PM   #3
moondust_82
Registered User
 
moondust_82's Avatar
 
Join Date: May 2004
Location: Washington, DC
Posts: 12
Default

Actually....I think I fixed it...I downloaded the author's FLA file and found that the script I had (above) for each swatch movie clip actually had to be on the swatch movie clips' OWN movie clip inside of them for it to work and not on the ones on the main stage...does that make any sense? Can you help me understand why that code wouldn't work just slapped onto the main movie clip symbols themselves?

Thank you for responding too...I feel kind of like some black sheep here...I tend to be kind of verbose so that people understand what I'm talking about (since I'm so new) but is that putting people off? Am I doing something wrong? LOL
moondust_82 is offline   Reply With Quote
Old 05-23-2004, 08:51 PM   #4
pixelwit
village halfwit
 
pixelwit's Avatar
 
Join Date: Jul 2001
Location: USA, PA
Posts: 3,330
Default

Have you read this thread? It might help you out a little.

I hadn't noticed you being too verbose but a small Flash file illustrating your problem can be worth a thousand words . Just keep in mind the fact that there are about a million different ways to do the same thing in Flash so you should provide as much relevant info as possible.

So far you've only posted 2 threads and received responses on both of them so I doubt you're being shunned. Persistence pays off in Flash and in the forums. If you don't get the answer you're looking for try a different approach.

-PiXELWiT
http://www.pixelwit.com
__________________
There are no answers, only choices.
pixelwit is offline   Reply With Quote
Old 05-25-2004, 03:57 PM   #5
moondust_82
Registered User
 
moondust_82's Avatar
 
Join Date: May 2004
Location: Washington, DC
Posts: 12
Default Thanks

Yeah you're right...thanks I actually read that thread about how to post in here, but some of it didn't make sense to me, and I always wonder if I am posting my code the wrong way. Whenever I look at code that's been inserted into it's own little boxed in area in a post on my Mac, it doesn't show up...but I don't know how to put the AS into that format anyhow.

It's OK to post an SWF zipped file, right? it's so much smaller and I just did for my new post...the FLA doesn't really say anything too different from my description and it's 4 MB, too.
moondust_82 is offline   Reply With Quote
Old 05-25-2004, 04:48 PM   #6
pixelwit
village halfwit
 
pixelwit's Avatar
 
Join Date: Jul 2001
Location: USA, PA
Posts: 3,330
Default

Quote:
Originally Posted by moondust_82
...Whenever I look at code that's been inserted into it's own little boxed in area in a post on my Mac, it doesn't show up...
You might want to mention this to the forum administrators as it might be something they're not aware of. They can be contacted with the "Contact Us" link at the very top right corner of this page.

Attaching a SWF only tells us WHAT you did, but not HOW you did it which isn't nearly as helpful. If your FLA file is too big then you need to rip out the unnecessary parts or create a new FLA file which illustrates the key elements of your problem. This is something you should becone quite familiar with over time as it will eventually help you solve your own problems.

You can put your code inside a little box by placing it between "code" or "php" tags like this but without the *s.

[code*]ActionScript goes here[/code*]

[php*]ActionScript goes here[/php*]

-PiXELWiT
http://www.pixelwit.com
__________________
There are no answers, only choices.
pixelwit is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:30 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.