PDA

View Full Version : Drag, drop and then........


numpty
05-13-2003, 01:44 PM
OK guys be kind to me! It's only taken me nearly 48 hours to get as far as I have, and I feel like c**p, think it's 'flu coming on, so maybe this is why the brain cells are flagging!!

I've created a movie clip with a button in it so that it will drag and drop onto a background (to make a jigsaw puzzle), but I want the piece to 'grow' from the smaller size it is now to the correct size to fit the gap. I've put a stop command on the first frame so that it doesn't play as soon as the movie loads, but I can't seem to get the movie clip to run once it's been dragged and dropped.

Please help whilst I'm out of the room rummaging for Lemsip, on and I'm using Flash 5 'cos I'm too poor to buy MX! (Ain't self pity a terrible thing!!

JGizmo
05-13-2003, 02:06 PM
Hi there, excise me if I don't understand fully.

Remember 1 thing is if you got a mc called "piece0", inside has a button, and if you got mouse event(e.g on(press)...etc) inside this button, when you put mouse event in "piece0" mc, it will override the inner mouse event and it wont work.

Think to approve this problem, I will

1) create your JSaw pieces in different mc and name it, has 3 stages
i)stop in frame 1 - when it is rest beside the board
ii)play between frame 2 to whatever - animation of grow when start dragging
iii)stop at last frame - the finished position size

2)put each above mc inside a different mc_holder
3)put a button inside the holder as well and use it to control all the press and release states - also the 3 different states of the mc in the same holder.

Other easiler way I guess is:

1) dont use button
2)just create the Jsaw pieces as different mc
3)use onClipevent to control it like a button + animation effect

hope this help.

John

numpty
05-13-2003, 02:21 PM
Thanks for that John. All the pieces (four) are different mcs already. If I use the cliponevent, I can't drag and drop can I? (don't know hence my username!!)


COLOR=red]ii)play between frame 2 to whatever - animation of grow when start dragging[/COLOR]

That's the bit I'm having problems with!!!!

Currently the code for the button in the first frame (action 'Stop') is

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


Works beautifully I can pick up and drag the piece to where I want. What I can't do know is make it grow as in Frames 2 to 10?

numpty
05-13-2003, 03:36 PM
Could I achieve some measure of success with a drop target command. I have a symbol called bkgrndpc (a graphic). If I place that on the main scene can I use an if command to get this working do you think?

I currently have code that looks like this attached to the button

on (press) {
startDrag ("");
}
on (release) {
stopDrag ();
if (this._droptarget =="/bkgrndpc") {
_root.bkgrndpc.gotoAndPlay("/pcmc 2");
}
}

The debugger finds no faults - but the d**mn thing just drags and doesn't grow! The path along the top says Scene 1 > PCMC (movie clip symbol showing) > Tween 1 are my paths wrong?

JGizmo
05-13-2003, 05:21 PM
hi guy, hard to explain in full detail :D but hope you find the following attachment help, let me know!

numpty
05-13-2003, 05:27 PM
Thanks for that John, but it came up 'unexpected file format' when I tried to open it. It does this when I try MX files, is that what you used to create it?

JGizmo
05-13-2003, 05:37 PM
yeah, i am using MX...damnit eh!

Anyway, this is the code I use in the stage of a mc(1 piece)
onClipEvent (load) {
_xscale = 50;
_yscale = 50;
}
on (press) {
startDrag(this);
play();
//trace(_x);
//trace(_y);
}
on (release) {
stopDrag();
gotoAndStop(1);
if ((_x>=0 && _x<=100) && (_y>=0 && _y<=100)) {
_xscale = 100;
_yscale = 100;
} else {
_xscale = 50;
_yscale = 50;
}
}


and the mc timeline has a stop on frame 1 and a gotoAndPlay(2) at last frame.

Attachment again, this time inclue a .swf file. Off work now wooohoooo :D :D

numpty
05-13-2003, 06:48 PM
John, you're a genius!

It was the _Xscale = code that worked. It wouldn't let me do clipeventload in Flash 5 on a MC, but it recognised that command after the stop command.


Whohoooo!!! Today hasn't been a write off, my sincerest thanks!

That's the first scene done!!!!!

JGizmo
05-13-2003, 09:25 PM
:D I haven't use version 5 before, so I wouldn't know. But glad it works out for you.

John