Detect MOUSE_OVER On A Line
Aug 9, 2010
I have some trails data that I am adding to an interactive map. The trails were imported from Illustrator and are lines that have been converted to movieclips upon import. I'd like to add effects and some interactivity to the lines upon click and mouse_over. The difficult piece is that Flash treats movie clip like a box making it dificult to click on just the trail you'd like info for. For example, if there are two trails next to one another, clicking on the one you want can be difficult.
Is there a way that I can make it so that only the line part of the MC is the piece that responds to mouse action (rather than the whole box which encompasses its extent)?
View 2 Replies
Similar Posts:
Aug 11, 2010
I have some lines that I am assigning actions to upon MOUSE_OVER
The problem is that they are relatively small and kind of finicky to get the mouse directly over. When the mouse_over event occurs, I am changing their color to indicate they've been selected.
Is there a way I can change how sensitive they are to the mouse over event (i.e. detect MOUSE_OVER within 10 pixels of each MC or something)?
Here's the code I am using to asign the listeners and then to create a MOUSE_OVER event.
[Code]...
View 4 Replies
Jun 26, 2011
I'm drawing a simple line with API and I would like to know how to detect what angle the line has and where a ball hits it.Scenario: the player draws a random line in a random angle, a ball comes in from random points and hits the line, the ball then bounces off the line depending on where it hit the line (and of course depends on the line's angle).I draw the red line with this: (on a 400x400 stage)Actionscript Code:graphics.lineStyle(2, 0xFF0000, 100);graphics.moveTo(150, 150);graphics.lineTo(250, 250);The grey, green and purple lines are just demonstation of the ball movement, comming in from outside the screen, hitting the line and bouncing off in different directions. I just made a guess on the angle they will bounce off in.
I just can't figure out how to detect the line's angle and where the ball hits it. So all I have is a ball flying in from random positions and hitTests the line (not coded yet, but no problem to do ball movement and hitTesting with line), I don't know where to go from there until I know how to detect where it hits the line.I know this is a double post (from the Games section), but I realized this place seems to have more activity and not many seem to visit the Games place anymore.
View 11 Replies
Nov 27, 2010
There is some information but I couldn't figure it out:How can I detect if a line intersects with a triangle ? And how can I detect the point of intersection in AS3 ?
View 1 Replies
Oct 5, 2010
I want to be able to write a paragraph in a textfield, and then click and hold, or do some similar gesture, and have the entire paragraph selected. I'm then going to drag it (using bitmapdata or whatever) to another textfield.
In order to do this, I need to be able to detect where a given paragraph ends. So I'm trying to do that with the following code, which searches for " " in the text.
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
[Code].....
View 1 Replies
Apr 27, 2011
I have converted line to movieclip. Now I want to detect click and drag on line not on whole movieclip how to add listener just to the line ?
View 1 Replies
Nov 26, 2004
How do I detect collisions between movie clips and a line created through actionscript (with the lineStyle, lineTo, etc. commands). I tried making the line inside a movie clip and doing a hitTest with that movie clip, but it did nto work.
View 1 Replies
Apr 6, 2010
Currently, I am using the code below. But it is telling me that the circle is starting to hit the line when it's y position is 40. But since the circle actually isn't crossing the line itself (virtually) until it's y position is at about 205, I don't want the trace-action called so early.
Code:
var circle: Sprite = new Sprite();
circle.graphics.beginFill(0xFF0000);
circle.graphics.drawCircle(0, 0, 10);
circle.x = 170;
[code]....
View 1 Replies
Nov 26, 2004
How do I detect collisions between movie clips and a line created through actionscript (with the lineStyle, lineTo, etc. commands). I tried making the line inside a movie clip and doing a hitTest with that movie clip, but it did nto work.
View 1 Replies
Dec 17, 2009
i have an xml file and i want my code in flash to read it line by line but its only showing the first line out of 5 lines.Below is the code:
var NigeriaNumber:Number;
var stateName:String;
var year:String;
[code].....
View 0 Replies
Jun 20, 2009
I've created a menu that scrolls down when my mouse is over the click zone but somehow when I move my mouse out of the click zone it stays up and will not go back to my first frame. Here's my code
stop()
medczone.addEventListener(MouseEvent.MOUSE_OVER,med2);medczone.addEventListener(MouseEvent.MOUSE_OUT,med4);
function med2(e:MouseEvent):void { play();}
function med4(e:MouseEvent):void { gotoAndStop(1);}
View 6 Replies
Aug 25, 2009
I have two sprites A and B, both are irreuglar drawn shapes (both with a transparent fill) that overlap certain points. The current result is B on top (though which is on top is not really relevant, as the same problem will exist if A is on top). They are both children of the same UIComponent.
Both are listening for the MouseEvent.MOUSE_MOVE event. It is to occur when a corner on either shape is passed over by the mouse. Though, when the mouse moves over the corner of A and this corner is behind B the MouseEvent is never raised.From my investigation I've found when i turn the fill off on the sprites and just draw the outline of the shape the mouse event will raise, but this is not what is wanted. how can I get *both* the objects listening and responding even when the corners of one is overlapping the other?
View 3 Replies
Jun 7, 2009
I got this accordion from http:[url]....and I would like to have a MOUSE_OVER event on the buttons.The problem is that I don't know how to target the movieclips that are in the library of the accordion.fla file.
View 3 Replies
Dec 3, 2010
So I am making a basic Mouse_over/ mouse_out event, but if I pull the mouse off before the object reaches frame "box_big" then the mouse_out event will not activate. What is a way around this?
Code: Select allstop();
//box wip
MainBox.addEventListener(MouseEvent.MOUSE_OVER, Box_Expand);
MainBox.addEventListener(MouseEvent.MOUSE_OUT, Box_Contract);[code].......
View 2 Replies
Mar 6, 2009
It can be quite confusing title, but my question is simple. I have a mouse_over eventlistener associated with the eventcomplete from a tween. The problem is that if I have allready the mouse over the mc it will not react, only when it is out of bonds and enter.Is there a way to make it work when the mouse is over and not entering the mc?
View 5 Replies
Mar 16, 2009
I am trying to create a Japanese map where on mouse over prefectures (states) would zoom in by some 1.2.If I make every prefecture_mc as a separate layer, then they scale on under another which, my friends is not good looking behaviour . when I create all 47 prefectures within one layer, then prefecture_mc:scaleY=1.2; is ignored. It was simple in AS2 besides it was scaling from the center
View 3 Replies
Jan 20, 2010
I have several buttons inside of a movie clip, as well as functions for the MOUSE_OVER and MOUSE_OUT events. There is no gap between the buttons, however, if I move from one button to the next, first the MOUSE_OUT and immediately the MOUSE_OVER function is called again (even though all of this is inside of the movie clip). If I have the buttons inside another button, moving from one (sub-)button to the next is not problem, but then I can't have any animations/movie clips inside (or can I?). Is there any way to "fix" this, meaning that I can move from one button to the next without triggering the functions?
View 2 Replies
Jun 22, 2010
I have a basic rollover function for my button, which seems to work, but whenever the mouse is moved to the right (but remaining inside the movieclip) the MOUSE_OUT function starts happening, and then when the mouse is stopped moving, the MOUSE_OVER code re-activates. I have no other movieclips in front of it, but it is masked using actionscript. I don't understand why it's doing this, because the mouse never goes outside the area of the movieclip, so the MOUSE_OUT function shouldn't activate. The movieclip doesn't change side or shape at all, it just changes colour.
[Code]...
View 6 Replies
Sep 2, 2009
I have an MC(named "mouseTip") that gets added to the stage and follows my mouse on MOUSE_OVER. On MOUSE_OUT it gets removed. I just created a dynamic text field inside mouseTip so I can display type when mouseTip is present. For some reason, when that happens the mouse gets blocked by the textfield inside mouseTip and the MOUSE_OUT gets triggered.Once mouseTip is removed, the MOUSE_OVER gets triggered since the mouse is still over the button and my mouseTip MC just flickers rapidly.
View 5 Replies
Jul 19, 2010
I have a map of US counties that I've setup to display census info on mouse over. I am pulling this from a XML table that is populating a dynamic text field in an info box. I've also been working to cause a color change on mouse over. Right now I am doing that by changing the color on MOUSE_OVER and changing it again on MOUSE_OUT[code]...
View 1 Replies
Aug 5, 2010
I am tweening the alpha of some MCs to make them vis/invisible on MOUSE_OVER and MOUSE_OUT.Its easy for me to do this as a static event but the effect is a little too abrubt. I've accomplished this with
function NEOVER(e:MouseEvent):void{
NEZOOM.alpha=.5;
NETXT.alpha=1;
[code].....
View 4 Replies
Jun 15, 2011
I am attempting to have a text sentence slide out from behind and to the right of a company name. The company name is a movie clip and the sentence is a movieclip within a movieclip.On a mouse_over the sentence scrolls out from the right of the company name and then on a mouse_out the sentence scrolls back to the left behind the compnay name. This is working perfectly.Here's the trouble: after the sentence has scrolled back behind the company name and when the mouse is placed over the company name again, the sentence will not scroll out from behind the company name. The movieclip performs perfectly only one time and it won't repeat itself. I would like it to work everytime the mouse is placed over or removed from the company name. Perhaps you know why this is happening. Here is the code I am using on the main timeline. The inner movieclip has its own timeline for the sentence. It has a 60 frame tween on it with a stop() command on the first and sixtieth frame.
import flash.events.Event;import flash.events.MouseEvent;
rizzoCorp_mc.addEventListener(MouseEvent.MOUSE_OVER, moverRizzoF);function[code]......
View 3 Replies
Dec 8, 2009
first of all sorry for my english. I'll try to be precise. I have few movieclips, lets call their instance names mc1, mc2, mc3.they are not buttons, just movieclips. I also have dynamic text field with instance name "description".
and all I want is to have description text on that dynamic text field when I mouse_over them, like "this is mc1", or when mouse_over other: "this is mc2" etc.. I have this code, and it's not working.
ActionScript Code:
mc1.relatedText = "This is mc1";
mc1.addEventListener(MouseEvent.MOUSE_OVER, displayText);
[Code]...
View 9 Replies
Feb 11, 2011
how is it possible to still have MOUSE_OVER event dispatched while dragging an object?
I explain my self: I want the user to drag an object over an other, but while he's doing it I want to change the state of the objects he passes over.
View 2 Replies
Nov 11, 2011
What I created was just a test but I can't seem to get it working. What I did was create a very small rectangle at frame 1. Created a tween and then at frame 100 made it a very large rectangle.
Then in my code I wanted the user to MOUSE_OVER something and the rectangle to ease to the length it was at frame 30. However I keep getting this error message:
ArgumentError: Error #2109: Frame label frame 30 not found in scene Scene 1.
at flash.display::MovieClip/gotoAndStop()
at Untitled_fla::MainTimeline/test()
Here is my code:
[CODE]
stop();
circle_mc.addEventListener(MouseEvent.MOUSE_OVER, test, false, 0, true);
circle_mc.addEventListener(MouseEvent.MOUSE_OUT, test2, false, 0, true);
[Code].....
View 5 Replies
Jun 28, 2009
When I MOUSE_OUT before the MOUSE_OVER mc is still playing, it doesn't see the MOUSE_OUT. I tried adding a stop(); line to the beginning of the Button1Out function, but that didn't do squat.
Code: Select all//Button 1 Listeners and Functions
Btn1_hit.addEventListener(MouseEvent.MOUSE_OVER,Button1Over);
Btn1_hit.addEventListener(MouseEvent.MOUSE_OUT,Button1Out);
Btn1_hit.addEventListener(MouseEvent.MOUSE_DOWN, Button1Click);
[Code].....
View 1 Replies
Aug 2, 2010
I need to add in a mouse over event listener for an object, when I'm already over it. If my mouse leaves the object and comes back, then the listener works, but for some reason, when if I just move my mouse around over the object, it doesn't work. Hopefully that is enough to go on without posting code...
View 1 Replies
Aug 12, 2009
I have a square movieClip that expands into other movieClip options with a MOUSE_OVER. This works no problem. I drew an invisible rectangle underneath all of these options so that they would stay open when I moved the mouse towards them.
But when I try to code the first option to also work with MOUSE_OVERs and CLICKs it causes problems. At first when I tested the movie it looked fine until I tried to MOUSE_OVER the first new option - the new option produced no results. I think this was because the original invisible rectangle was on top of it.
So I changed the order of layers so the invisible rectangle was on bottom. Then as soon as I tried the new option, the entire original movieClip collapsed back to its original state. I assume that the area beneath the new option was being covered up, and thus my MOUSE_OVER (on the original movieClip) no longer registered.I then tried adding code to tell the original movieClip to also listen for a MOUSE_OVER on the new option. This worked - I could move the mouse over the new option and the original movieClip remained open, but the old problem of the new option not registerring occurred. I think my new code overrided what I wanted the new option to do.
I am confident that I could probably get this all to work if I simply opened the original movieClip with a CLICK instead of a MOUSE_OVER, but I'd rather keep using a MOUSE_OVER if there's a way to do it.
I realize that this is all a bit hard to follow, so to summarize - I want a single movieClip to animate, revealing new movieClips. I want to be able to animate these new movieClips (with MOUSE_OVERs and CLICKs), all while the original movieClip remains "open" in its MOUSE_OVER state/frame.
View 8 Replies
Feb 26, 2009
I want to repeat the function when you MOUSE_OVER it..
Code:
p_rechts.addEventListener(MouseEvent.MOUSE_OVER, rechts);
function rechts(e:MouseEvent) {
stoel.collada.rotationY -= 5;
}
now the "stoel" rotates 1 time -5, but i want it to repeat itself, till your mouse is of the button..
View 1 Replies
Jun 4, 2009
I have a item1 that needs to have a MOUSE_OVER effect when item2 is dragged over it. How can I do that?
PHP Code:
item1.addEventListener(MouseEvent.MOUSE_OVER, backover);function backover (e:MouseEvent):void this.item1 .gotoAndStop(2);}
[code].....
View 1 Replies