i want the playhead to shift a frame each time i move my mouse over a certain area, but the following code is making this happen when i move my mouse anywhere on the stage
i tried using rollOver instead, but of course, this only moves the playhead once and i have to roll out of teh object in order to create a new rollOver event
onClipEvent (mouseMove) {
if (_root._xmouse>200) {
_root.myClip.nextFrame();
}else if (_root._xmouse<100){
_root.myClip.previousFrame();
}
}
or something to that effect.
I don’t think this is an optimal way of doing this effect though… I guess I would need to know how this is being used before I could come up with something that might work well. mouseMoves can be nice because they free up processor power from doing enterFrame effects, but they are cumbersome in how they operate.
I guess my questions would be:
do you want it to only go one frame per time it’s placed on the spot?
and
is the spot an area on the stage, or just a matter of left of center/right of center kind of thing?
flex’s code did the trick:
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true) {
_root.myClip.nextFrame();
}
and david took it a stage further with the addition of prevFrame(), which i hadn’t thought about!!
what i want to do is this: i have a ‘viewing’ area on the stage, where i’m going to insert a clip containing a sequence of images that, when run one after the other, give the impression of video-like movement
i’m going to place an invisible button over that viewing area and insert the code in question, so that when the cursor moves over the button… you get the video-motion
i saw this in a great site (i can’t find the url or i would post it) and i fell in love with the effect
thanks for all that
PS sbeener’s code is very compact!! i’ll have to meddle with it
yeah… if that’s what you’re trying to do, I’d definitely ignore my post and go with the enterFrame method discribed by Flex. I was just trying to save you some processor power. The enterFrame method though will provide smooth frame by frame, even if the person stops moving their mouse. (onMouseMove only works when the mouse is actually in motion)
glad you got it working… sounds like a neat effect. Please try to remember to give us a link to check it out once you’ve got all the bugs out.
It’s the same as the code David posted, just in onClipEvent(enterFrame). It moves the animation forward while the mouse is held in a certain place, and moves the animation back, if held in another. If you wanted to the animation to play when the mouse was dragged - use David’s code (the on mouse move).
i woke up this morning, stared at the ceiling and thought: info panel, cente/left grid…
i don’t know why this eluded me last night - ok, so the coordinates are no prob
cheers flex for the zip: it’s interesting to see how somebody else does things - i.e. i thought of using a video file and placing a stop action on each keyframe (as opposed to using a sequence of images) but i wondered whether that was a good way to do things
i suppose the video file will be much bigger but it would be interesting to see how it responds - you might get some blurring between stops in framesm but that ight look good (i’ll give it a try later)
32 3/5 cards with notes.
1 steno of various tested and partial code.
1 steno containing names of movie clips, variables, arrays, xml docs, text docs, etc
42 sheets of white scrap paper with sketches of sections or clips.
3 sheets of white paper containing a flow chart.
And that site is small compared to a real commercial site. I can only imagine how complex that must get.
I was thinking of somehow (I was trying to figure it out last night) using getTimer() to check the current _xmouse to the _xmouse 0.5 or 0.25 seconds ago and if it was > x nextFrame(); and if it was < x prevFrame();.