PDA

View Full Version : Masking Help


jor133d
03-04-2005, 06:03 AM
I am on a strict deadline and I really need someones help. I will even pay them for there help :)

I am working on a project where I need to have a "zipper" effect. When you startdrag and pull the zipper with your mouse it will look like the zipper is open. Then you can drag the zipper back and it would close the zipper.

I just can't figure out how you would go about making it look open and closed and working with the dragging.

Please help me!

Thanks,
Jordan

flyingchalupa
03-04-2005, 07:24 AM
okay...
i knew i had done one of these a while back... five years ago as a matter of fact... i managed to find it, and my god was it horrible... i fixed the code up a bit, so it's not too terrible...

i'll post it here, if its what you are looking for let me know and i'll walk you through how i did it... though i am sure you could find a better way than what i came up with 5 years ago...

anyway don't laugh (http://www.urbanspies.com/zipper/)

cheers...

jor133d
03-04-2005, 11:32 AM
can I get the .fla? I will send you $10 :)

jor133d
03-04-2005, 03:47 PM
Just checking in to see if you could send that to me? or at least walk me through it

flyingchalupa
03-04-2005, 05:51 PM
hey...
off to work right now, when i get a minute i'll explain it... no worries...

and um, yeah... you can keep your ten dollars..

cheers...

jor133d
03-04-2005, 07:33 PM
Could you help me something in the next 2 hours?

flyingchalupa
03-04-2005, 09:04 PM
alright.. kind of busy..
hope this will get you started:

not sure what you are starting with... i take it you have a dragable "zipper" and just need to interact with the "teeth" right?

assuming that, this is what i would do:

create a function that loops through the number of teeth
and checks each tooths _y in relation to the dragable zipper's _y...
as the zipper gets further past the tooth, increase (for the right teeth) and decrease (for the left teeth) the teeth's _x position...

how to do this:
where ever you start your drag function i would also go something like:
_root.onMouseMove = MyToothPosChecker;
(MyToothPosChecker being your checker function)

and where ever you stop your drag function:
_root.onMouseMove = null;

Like I said.. crazy busy right now... Let me know how you make out with this... Maybe post your code if you get stuck..

Cheers...

jor133d
03-05-2005, 12:57 AM
Ok, I am lost. I don't know that much. You have to use specific code for me to figure it out. I am only 18 and am trying to learn actionscript by myself. So coul dyou b more specific.

THANKS!!!!!!!!!!!

flyingchalupa
03-05-2005, 02:24 AM
alright.. here you go...
i am sure there are a million ways to do this.. and this is taken from 5 year old code, but whatever...

and 18? please don't be using that as an excuse... i am sure there are 12 year olds on this site that could run circles around most of us with their code...

anyway...
enjoy:

stop();
var totalTeeth = 37;
var mc = this;
scrollbar.scrubber.btn.onPress = function()
{
startDrag(this, false, 0, 0, 0, 380);
_root.onMouseMove = checkTeeth;
};
scrollbar.scrubber.btn.onRelease = function()
{
stopDrag();
_root.onMouseMove = null;
};
function checkTeeth()
{
// get location of the scrubber
var scrubY = mc.scrollbar.scrubber.btn._y;
// i used a traingle mask, and set its y to the scrubbers...
mc.mask._y = scrubY;
// toggle.. switch it back and forth, to get the direction the teeth should go
toggle = 1;
for (i = 0; i < totalTeeth; i++)
{
if (toggle = !toggle)
{
dir = 1;
}
else
{
dir = -1
}
// the tooths y pos
var toothY = mc.scrollbar["t" + i]._y;
// if it is above the scrubber... move it...
if (scrubY > toothY)
{
mc.scrollbar["t" + i]._x = (scrubY - toothY) * dir;
}
else
{
mc.scrollbar["t" + i]._x = 1;
}

}
}


hope you can make sense of it...

cheers...

jor133d
03-05-2005, 05:17 AM
thanks... I am not using my age as an excuse I am simply saying I am new at actionscript and just can put together code with simple directions yet.

jor133d
03-05-2005, 04:52 PM
Ok, see I am a newbie! i cannot figure this out for the life of me.

What buttons/mc's should I have and what should be there instance names?

Does all that code go in frame one?

Does any code go on the buttons/mc's?

flyingchalupa
03-05-2005, 10:27 PM
i msg'd you with a link to the fla...

what do you have right now? maybe post your code or your file, that would make it easier to walk you through it...