View Full Version : Move many objects toward the mouse?
sicklif3
June 19th, 2007, 12:25 PM
I'm wondering if someone can help me understand the best way to tackle this ... I want to have 10-15 objects placed on and off the stage, but when the mouse comes close to the edge more objects move into place and the whole set moves.
I had started using "onEnterFrame" and mouse follows but it should only move when the mouse is within a certain proximity.
I hope that makes sense.
Thanks
bigarth
June 19th, 2007, 01:40 PM
although i'm not entirely sure i understand what you're describing, i think what you are attempting to do could be solved in this manner:
addEventListener (MouseEvent.MOUSE_MOVE, mouseMovement);
public function mouseMovement (param_event:MouseEvent) {
if (param_event.stageX > #) {
// move the stuff into the stage
}
}
that should work for the right edge of the stage as long as you plug in an appropriate number in the if statement. the other edges could be programmed accordingly inside that function, however your description is very vague so i really don't know what you want to occur. hope this helps.
sicklif3
June 19th, 2007, 02:59 PM
sorry i'm more of a designer than a coder and i'm having trouble explaining it. maybe these attached pictures will help.
basically it start off centered but if you get close enough to one of the elements they all kind of recenter under the mouse. the thing is, each of these would be an individual button.
john
http://img514.imageshack.us/img514/4119/picture1gl2.th.jpg (http://img514.imageshack.us/my.php?image=picture1gl2.jpg)
http://img514.imageshack.us/img514/1558/picture2ij5.th.jpg (http://img514.imageshack.us/my.php?image=picture2ij5.jpg)
http://img514.imageshack.us/img514/196/picture3sh8.th.jpg (http://img514.imageshack.us/my.php?image=picture3sh8.jpg)
bigarth
June 19th, 2007, 03:03 PM
so once you get close enough to any of the the buttons, all the buttons on the stage would form in a circle underneath the mouse? or, in your drawings are there two groups of circles. the left group and the right group, and when you get close to the right group the right group of circles becomes fully visible by moving onto the screen?
sicklif3
June 19th, 2007, 03:08 PM
yeah they would be more like different groups. and when you get close enough they'll move toward the mouse. my picture was exagerated a bit.
its almost like panning across, where if you hold the mouse to the right edge there might be new objects coming into view. then you move the mouse toward those and they come underneath the mouse and more come in. etc, etc.
sorry if i make absolutely no sense.
bigarth
June 19th, 2007, 03:12 PM
alright well this sounds like a pretty extensive project that will require more time than i have available at the moment. however, if you look at the original reply i made to your question, i believe that the code i provided should get you going in the right direction. you probably have two options, either move the objects on the screen, or set up a movieclip that is larger than the stage and move the entire movieclip. your choice. whichever will work best for your end goals.
hope i could help in some way. sorry i don't have more time to lead you through this.
sicklif3
June 19th, 2007, 03:19 PM
no problem. i think i might look into moving the whole clip around the stage. thanks though.
bigarth
June 19th, 2007, 03:24 PM
maybe this will help you
http://www.kirupa.com/developer/flash8/interactive_image_pan.htm
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.