Newbie flash question...

  • leapingfrog
  • Born
  • Born
  • leapingfrog
  • Posts: 2

Post 3+ Months Ago

Hi guys,

I'm hoping that one of you can help push me in the right direction with some trouble I'm having.

Basically, I'm following this tutorial:
http://www.spoono.com/flash/tutorials/t ... use_follow

How would I make it so when the mouse pointer is outside of the flash plugin, the ball moves to a designated position (maybe moves to the center of the plugin)? Basically, I want the ball "stuck" in the center when the mouse pointer is not around. Rather than staying at the last spot the mouse pointer was at.

Thanks in advance,
Andrew
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Socno
  • Graduate
  • Graduate
  • Socno
  • Posts: 107
  • Loc: New York

Post 3+ Months Ago

leapingfrog wrote:
Hi guys,

I'm hoping that one of you can help push me in the right direction with some trouble I'm having.

Basically, I'm following this tutorial:
http://www.spoono.com/flash/tutorials/t ... use_follow

How would I make it so when the mouse pointer is outside of the flash plugin, the ball moves to a designated position (maybe moves to the center of the plugin)? Basically, I want the ball "stuck" in the center when the mouse pointer is not around. Rather than staying at the last spot the mouse pointer was at.

Thanks in advance,
Andrew


That question was a hard one... Hmmm. I have been trying to code that one for you, but with no luck.
So sorry.
  • leapingfrog
  • Born
  • Born
  • leapingfrog
  • Posts: 2

Post 3+ Months Ago

Thanks Socno... at least now I know I'm not too stupid ;)

Basically, I'm building a website navigation, where I have 6 buttons layed out horizontally. When you move your mouse over the buttons, an arrow follows under the buttons (only moving on the x-axis). When they move their mouse outside the navigation, I want the arrow to move back pointing at the current section they're in.

I don't know if that helps any..... Is it even something possible?
  • rynoe
  • Banned
  • Banned
  • User avatar
  • Posts: 17

Post 3+ Months Ago

Something like this: LINK
  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Posts: 1402
  • Loc: Philadelphia, PA

Post 3+ Months Ago

Since Flash cannot detect when the mouse is not over the movie, you cannot reset an object when the mouse leaves the viewable area of the movie.

A section of the movie... yes... via the hitTest() function. The movie as a whole.... 'fraid not.
  • rynoe
  • Banned
  • Banned
  • User avatar
  • Posts: 17

Post 3+ Months Ago

Lost in beta:

Again you are completely wrong.

Did you even bother to look at my link?

Are you still the arrogant 'know it all' I have come to know at all the other forums or are you willing to actually learn something new?
  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Posts: 1402
  • Loc: Philadelphia, PA

Post 3+ Months Ago

I saw your link, and the hitTesting is inaccurate when I exit the movie from the top, left or right. It only works for the bottom.

I knew it would only be a short time before you showed your ignorance on this forum like you have on all the others.

I don't pretend to know it all, in fact, I still consider myself a novice. So don't pretend to know me rynoe, because you don't.
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

rynoe wrote:
Lost in beta:

Again you are completely wrong.

Did you even bother to look at my link?

Are you still the arrogant 'know it all' I have come to know at all the other forums or are you willing to actually learn something new?


I checked it out and though it seems to work within the movie, nothing happens when you leave the movie (get a different context menu on right-click)

I thought of one way to pull this off using onEnterFrame checking if _root._xmouse & _root._ymouse are within an outer bounds figured with Stage.width & Stage.height but even at high FPS (tested @ 20FPS)proved it's self unreliable with fast mouse movements.

Reliability might be increased by also comparing an array with a set length of say 10 or so elements of past positions against its self and calling the "default placement function" if each element in the array added together then divided by the length of the array is equil to the last element in the array.

I've been putting alot on my plate lately so concept is all i can give for now sorry :wink:
  • b_heyer
  • Web Master
  • Web Master
  • User avatar
  • Posts: 4581
  • Loc: Maryland

Post 3+ Months Ago

Rynoe, if you continue to antagonize conversations, and cause anything less than a pleasant atmosphere with your posts we will ban you without a question. Consider this your first, last, and final warning.
  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Posts: 1402
  • Loc: Philadelphia, PA

Post 3+ Months Ago

joebert: The problem with that concept is that Flash reads the _xmouse and _ymouse position as it's last location within the movie. So if you mouse isn't over the movie, it reads the last location your mouse was and still considers your mouse to be within the movie.

I'm sure there are some hacks you can do for a bit of accuracy, but all in all there is no efficient method for Flash. I believe Director on the other hand has the ability to detect the mouse position even when it isn't over the movie... that would provide more efficient detection. Why they don't add this for Flash i'm not sure (or maybe i'm wrong and Director can't do this).
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

lostinbeta wrote:
if you mouse isn't over the movie, it reads the last location your mouse was and still considers your mouse to be within the movie.


That is where the set length array comes into play :D ok it might take two arrays :P

if on each enterFrame you over write the element above with the element below and add the new _x/ymouse to the end,
10 onEnterFrames with the mouse not on the movie would give you an array with 10 identical numbers, add the numbers together, divide by array length (giving N)and if array[array.length-1] == N then call default placement function.

Of course if the mouse has moved then array[array.length-1] == N will return false.

I realize this check would also have to be made only if the mouse was on or close to the edge of the movie which would require another bound be set with a greater margin than the first check resulting in defaultPlacement being misfired if the user rests the mouse to close to the edge, but how many times out of X do you think that would happen ?

I'm not suggesting this is "The" fix, just trying to spark some ideas :D
  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Posts: 1402
  • Loc: Philadelphia, PA

Post 3+ Months Ago

Ok, if I am understanding correctly, wouldn't this method return true even if the user just has their mouse hovering over the movie motionless? Since the array(s) will still fill up with 10 of the same position thus cancelling eachother out and returning true.

Unless i'm misunderstanding... it is 3am here after all...haha.
  • rynoe
  • Banned
  • Banned
  • User avatar
  • Posts: 17

Post 3+ Months Ago

b_heyer wrote:
Rynoe, if you continue to antagonize conversations, and cause anything less than a pleasant atmosphere with your posts we will ban you without a question. Consider this your first, last, and final warning.



Then ban me then you nazi asshole!
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

lostinbeta wrote:
Ok, if I am understanding correctly, wouldn't this method return true even if the user just has their mouse hovering over the movie motionless? Since the array(s) will still fill up with 10 of the same position thus cancelling eachother out and returning true.

Unless i'm misunderstanding... it is 3am here after all...haha.


There would be two bounderies around the movie, one about 3 pixels that if _x/ymouse was inside of it at any time would fire the defaultPlacement function immediately.

The Second boundery would be slightly larger, say 5-10 pixels and if the mouse leaves the movie chances are that the last _x/ymouse that gets tracked will be inside this boundery (think of it as a backup incase the mouse tracking skips the first boundry from fast mouse movements), So if the Array stuff only gets called if _x/y mouse are within this second boundery then I think it's safe to say 9/10 times this concept will produce desired results being I don't see many people resting the mouse close enough to the bounderies to fire it :D
  • UNFLUX
  • Genius
  • Genius
  • User avatar
  • Posts: 6376
  • Loc: twitter.com/unflux

Post 3+ Months Ago

rynoe wrote:
Then ban me then you nazi asshole!

done -- some people never learn.
  • FusionDesigner
  • Proficient
  • Proficient
  • User avatar
  • Posts: 282

Post 3+ Months Ago

I think I can do this, Ill try it soon. Quite tricky for someone who knows no Flash?
  • Sulfin
  • Graduate
  • Graduate
  • User avatar
  • Posts: 129
  • Loc: canada

Post 3+ Months Ago

I think I know how to solve the problem. I haven't tested it, but I think I know.

On a movie clip, you could put an on mouse move actionscript
Code: [ Select ]
onClipEvent(mouseMove){
_root.xmouse=_root._xmouse
_root.ymouse=_root._ymouse
}
  1. onClipEvent(mouseMove){
  2. _root.xmouse=_root._xmouse
  3. _root.ymouse=_root._ymouse
  4. }

And then you could put your cone on _root.xmouse, _root.ymouse instead of _root._xmouse, _root._ymouse.

It's worth a try!
  • Japh
  • Born
  • Born
  • Japh
  • Posts: 1

Post 3+ Months Ago

Would it be possible to make the arrow check that the cursor is within say 20 pixels from any edge of the clip or the arrow begins to go to it's default position? then all the user has to do is come back to within this margin and the arrow moves back to the cursor?

I've not tried this and I'm VERY new to Flash, but have been web programming in other languages for quite some years (PHP, MySQL, MSSQL, Javascript, Java, HTML).

(not trying to boast or anything as you guys may or may not have far more experience than i, just saying i have had some experience to give my suggestion some weight :? maybe... )
  • Russkie
  • Newbie
  • Newbie
  • Russkie
  • Posts: 9

Post 3+ Months Ago

well i just started learning actionscript like eh... 2 days ago? but im thinking, if theres no way to catch the mous when its moving to fast with a boundry around the movie, perhaps you make a script that when the mouse doesnt move for a few seconds it will auto slide back to the middle, that way if the user dumps the mouse for like 3 seconds itll jump back to the middle....
makes any sense? im not even sure how to do that but uh yea...

Post Information

  • Total Posts in this topic: 19 posts
  • Users browsing this forum: No registered users and 21 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.