PDA

View Full Version : StartDrag on Mouseover


kieserr
01-11-2006, 06:29 PM
Hi Guys,

What i wanted to do is, once i hover or mouseover on my banner(728x200), the dragabble MC(93x71) appears on the scene, meaning, it will only start to be visible on mouseover. But the problem is, where should i place the draggable MC? The MC should appear exactly where the mouse is or hovers. I appreciate your help. Thanks.

Headshotz
01-11-2006, 09:59 PM
Try:


//Make movieclip invisible to start with
my_mc._visible = false;
//Start drag
my_mc.startDrag(true);
//On rollOver make it visible
banner.onRollOver = function() {
my_mc._visible = true;
};
//*~HeadshotZ*~\\

tobyw_1969
01-11-2006, 10:12 PM
bear in mind that if you place any action like an onPress on the dragger, you won't be able to detect the onRollOut

Flash Gordon
01-11-2006, 10:39 PM
The MC should appear exactly where the mouse is or hovers.
mc._x = _root.mouse.x;
mc._y = _root.moust.y;

Headshotz
01-11-2006, 11:25 PM
My code works, stop teasing me ;)

kieserr
01-12-2006, 05:19 AM
Wow, that was quick. Ok ill try this one out. Thanks a lot guys :)

Headshotz
01-12-2006, 05:26 AM
No problem :)

Flash Gordon
01-12-2006, 06:30 AM
No problem :)
He was talking to me :rolleyes:


:p

kieserr
01-12-2006, 06:38 AM
It seems like its working just fine and perfect. Thanks a lot Headshotz for most of the script, Flash Gordon for the mouse xy thingy, tobyw_1969 for the onPress notes ;) You guys are the best. Heres the source file and swf you have all done, in case somebody needs something like this.

http://www.freewebs.com/kieserr/test.swf
http://www.freewebs.com/kieserr/test.fla

Actionscript forum rules!!!

Headshotz
01-12-2006, 06:40 AM
//Make movieclip invisible to start with
my_mc._visible = false;
//Start drag
my_mc.startDrag(true);
//On rollOver make it visible
banner.onRollOver = function() {
my_mc._visible = true;
};
//*~HeadshotZ*~\\



//Make movieclip invisible to start with
my_mc._visible = false;
//Start drag
_root.onEnterFrame = function() {
my_mc._x = _xmouse;
my_mc._y = _ymouse;
};
//On rollOver make it visible
banner.onRollOver = function() {
my_mc._visible = true;
};
//*~HeadshotZ*~\\


Same thing, he was thanking me :p

Headshotz
01-12-2006, 06:41 AM
O, we posted at the same time.

Good to see ;)

Flash Gordon
01-12-2006, 06:42 AM
I was just messing with you :p

Headshotz
01-12-2006, 06:45 AM
And I was messing back :p

kieserr
01-19-2006, 12:24 PM
Hi

Is there a way where the draggable mc will resize to a specific area on the banner? My draggable mc is a house. I have the 3 different sizes of the house ready. Once the user drops the house from say, a far area of the banner(my bg is a golf course) the house will be small, or if its close, once they drop the draggable house, it will be a bigger image, or something like that. Thanks guys.

Headshotz
01-22-2006, 05:39 AM
while(myhouse._width>newWidth) {
myhouse._width++;
}
while(myhouse._height>newHeight) {
myhouse._height++;
}

kieserr
01-22-2006, 11:38 AM
Hi,

I already have the houses on png format.I dont want it to resize. I just want it to change image once it hovers different areas on the banner.

I tried duplicating the one you guys made before, but somehow, it conflicts with the script. The other object is not moving anymore.

Please check this out.

http://www.freewebs.com/kieserr/test2.swf

http://www.freewebs.com/kieserr/banner_for_post.gif

Thanks

Headshotz
01-23-2006, 04:28 AM
You could have 3 frames within the house movieclip, each frame has a different house on it, and have a code like:


house_mc.stop();
_root.onEnterFrame = function() {
if (house_mc.hitTest(banner1)) {
house_mc.gotoAndStop(1);
}
if (house_mc.hitTest(banner2)) {
house_mc.gotoAndStop(2);
}
if (house_mc.hitTest(banner3)) {
house_mc.gotoAndStop(3);
}
};

kieserr
01-24-2006, 01:27 AM
Hi again. I made it to change according to their respective sizes. My question is, how can i map the sky and the tree so nobody can place the houses there. The house can hover the sky and the tree at some point but they should not be able to place them there. Once they drop the house(stopDRAG), this is the only time "My Logo here"(bottom right corner) will show. I tried doing this but, I wasnt able to let it jump on the second frame. And, once the house is dropped, then the house is the only one thats clickable to go to the specified URL. And its done! Quick help is very much appreciated guys. This is very urgent, so im gonna be giving some small reward. US$10 whoever make this within an hour, on this time of posting. It will be given to you by the end of the month, ill give you my word on this. Thank you so much.

Here is the swf and source file if somebody out there is kind enough to twitch it for me :)

http://www.freewebs.com/kieserr/for_post.fla

http://www.freewebs.com/kieserr/for_post.swf

if links doesnt open properly , open new browser, then copy paste the links.

Flash Gordon
01-24-2006, 01:40 AM
that is actually a pretty tough map b/c is curves and has so many edges. mc's come out square so the hitTest is going to be very difficult.