Current location: Hot Scripts Forums » General Web Coding » Flash & ActionScript » Mouseover dragover ?


Mouseover dragover ?

Reply
  #1 (permalink)  
Old 05-08-07, 09:05 AM
demon_510 demon_510 is offline
Newbie Coder
 
Join Date: Nov 2005
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Mouseover dragover ?

I am trying to make a very easy movie, multiple 10px X 10px boxes with only two frames for each movie clip, frame one is blue and frame two is orange.

I want to be able to hold down the left mouse button and goto frame two but I want to be able to drag to change the other boxes as well. I want to make them stay on frame two till you hit a reset button. Any help would be appreciated, I am not used to Flash 8 and the actionscript is quite cumbersome.
Reply With Quote
  #2 (permalink)  
Old 05-08-07, 10:45 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
you'll be needing movieclips. There's a method named startDrag, which allows the user to drag the movieclip to a certain position (don't know how it works though). If you search the web for "dragable movieclip", you'll find some tutorials

to swap the frame when you click the movieclip, you will have to use gotoAndStop(2);

hope this helps you a little more, i'm not very familiar with graphical applications, so i don't know that much about movieclips and stuff
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Reply With Quote
  #3 (permalink)  
Old 05-08-07, 09:45 PM
demon_510 demon_510 is offline
Newbie Coder
 
Join Date: Nov 2005
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by UnrealEd View Post
you'll be needing movieclips. There's a method named startDrag, which allows the user to drag the movieclip to a certain position (don't know how it works though). If you search the web for "dragable movieclip", you'll find some tutorials

to swap the frame when you click the movieclip, you will have to use gotoAndStop(2);

hope this helps you a little more, i'm not very familiar with graphical applications, so i don't know that much about movieclips and stuff
Thanks for the help Ed, I kind of have it on the right direction, I figured out how to make the 4,000+ boxes change color by clicking on them but I am still trying to figure out how to use a mouse drag to change them as well. Then I have to work on the ctrl key function but I thought I would first try and tackle one thing at a time. Oh, I am not trying to drag/move movie clips, I am trying to drag the mouse over movie clips to change a large quantity of boxes instead of one-at-a-time.

Thanks!
Reply With Quote
  #4 (permalink)  
Old 05-09-07, 02:19 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
I'm not quite following. Could you give an example of what should happen?
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Reply With Quote
  #5 (permalink)  
Old 05-09-07, 09:30 AM
demon_510 demon_510 is offline
Newbie Coder
 
Join Date: Nov 2005
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by UnrealEd View Post
I'm not quite following. Could you give an example of what should happen?
I have 4684 boxes that are 8 x 8 px. I want to click on one box then drag the mouse to change the color of the boxes while the left mouse button is depressed. Once the button is released the selections will stay changed until another box is selected without the ctrl button it then resets.
Reply With Quote
  #6 (permalink)  
Old 05-09-07, 10:59 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
i'd create a layer on your application, and add a mouseclick event to it. while the mouse is pressed down, you'll have to check the current mouse-position, and then loop over the movieclips to see on what movieclip your mouse currently is located. Then update the movieclip (gotoAndStop(frame_2))

I have no idea though on how to add the mouseclick event. You will have to track the mouse-position-change event as well, otherwise nothing will happen.
I think it's best if you create a small class to handle all this. Here's a small example (most functions don't exist):
ActionScript Code:
  1. public class ChangeMovieClips{
  2.   private mouseClicked:Boolean = false;
  3.   private movieclipse:Array = new Array();
  4.  
  5.   public function whileMouseIsMoving():Void{
  6.     if(mouseClicked){
  7.       // check the mouse position, and loop over the movieclips
  8.       // to check which movieclip you're currently hovering
  9.       // when you found the movieclip, update the movieclip
  10.       // by going to frame 2 or another frame
  11.     }
  12.   }
  13.  
  14.   public function mouseWasClicked():Void{
  15.     mouseClicked = true;
  16.   }
  17.  
  18.   public function mouseWasReleased():Void{
  19.     mouseClicked = false;
  20.   }
  21.  
  22.   public function ctrlKeyPressed():Void{
  23.     // loop over the movieclips and set them to show the first frame again
  24.   }
all this should be running in a inifinite loop, so i think it's best to use threading (don't know if flash has threading support though)

I hope this helps you a little further
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mouseover php code needhelp? PHP 3 02-03-07 01:50 PM
Mouseover with Single PHP page rjwebgraphix PHP 7 09-16-04 05:15 PM
(paypal button) mouseOver image? tom HTML/XHTML/XML 3 06-16-04 11:12 AM
Mouseover color change a different cell pobrien9 Script Requests 1 01-21-04 07:09 PM
Need ONE mouseover event to change TWO graphics on the page AccessGuy JavaScript 1 06-19-03 02:45 AM


All times are GMT -5. The time now is 06:31 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.