?
Solved

help playing frames based on _xmouse

Posted on 2003-03-20
9
Medium Priority
?
182 Views
Last Modified: 2010-08-05

Just started learning flash and actionscript two weeks ago.
sorry if this question is too easy.
I'm trying to play frames when the mouse moves left or right.
when the mouse moves right I play the next frame,
subsequently when the mouse moves left I play the previous frame.
Only problem is... I only want to play frames when the mouse is moved inside the movie.
I tried to use an if that specifies the x bounds of the movie...
but don't know what I'm doing...
Can you help with this code?
or suggest an easier way of accomplishing this?

CODE BELOW--

stop();
//WORKS only over entire page
//need it to only work between x values
var point = 0;
var newpoint = 0;
// x values of the movie
if (_xmouse <= 435 && _xmouse >= 114){
     point = _xmouse;
     _root.onMouseMove = function (){
          newpoint = _xmouse;
          // set max frames
          if(point > newpoint && _root.nextFrame() != 15){
               gotoAndPlay(_root.nextFrame());
               point = newpoint;
          }
          else
          // Set min frames
               if (_root.prevFrame != 0){
                    gotoAndPlay(_root.prevFrame());
                    point = newpoint;
               }
       }
}


I only have 75 points available...Sorry.
0
Comment
Question by:deominate
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
9 Comments
 
LVL 22

Expert Comment

by:rascalpants
ID: 8176864
the error looks like it is in this line:

if(point > newpoint && _root.nextFrame() != 15){


because you are setting point and newpoint to the _xmouse, then will always have the same value...


I don't think you want that right?


rp
0
 
LVL 6

Expert Comment

by:henryww
ID: 8176960
don't be sorry ... for what? 75pts is enough, cos u have given 100% of what u have... how nice :)

i am not sure how u will like it exactly and not quite understand ur code.

anyway, u will have to have something to monitor the _xmouse continously somewho, but to "play" the prevFrame() ... u can't, u can only stop there ..


if u are using MX it will quite easy
myClip.onMouseMove = scrollFrame;
myClip.onRollOver = scrollFrame;

function scrollFrame() {
     if (myClip._xmouse > WHERE_ON_UR_MOVIE_U_WANT_IT_TO_MOVE) {
          myClip.prevFrame();
     } else {
          myClip.nextFrame();
     }
}

change the if statement a little u can have it stop while in the middle of the movieclip ...
0
 

Author Comment

by:deominate
ID: 8176989
Its not that because "point" is set outside of the mouseMove function...right?
My nextframe and prevframe work well,
its just that
I don't want anything to execute when the mouse is located outside of x value 114 or 435
when I test the movie, no matter where I am on the screen the movie executes, I only need it to execute when the mouse is moved over the movie.

The desired effect can be seen on
www.alexhoerner.com when moving over the girl on the left.
I'm probably going about this all wrong.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Expert Comment

by:henryww
ID: 8177063
i know what u are talking about ...
i have seen this lastnight ... man it took a long time to load so heavy ...

it is not hard at all and it is not going continously ...
if u have a series of photo which will move & look like that site, send it to me, and i can make a sample for u ... it is not hard, but not easy for beginners ...

i like that site, very clever in the making ... but ... too much too heavy and nothing much to see except that effect.
0
 
LVL 6

Expert Comment

by:henryww
ID: 8177087
btw ... where did u guys found these sites ...?
i have a friend sent that exactly link to me last night and asked me if i could do it ...
0
 

Author Comment

by:deominate
ID: 8177123
I found it through...
http://www.favouritewebsiteawards.com/home.html

I'm still trying to make that code work that you suggested, but I am at a loss.

Like I posted I am brand new to this.
0
 
LVL 6

Expert Comment

by:henryww
ID: 8177164
0
 

Author Comment

by:deominate
ID: 8177200
Is there any way I can get in touch with you in the future without going through ex-ex?
0
 
LVL 6

Accepted Solution

by:
henryww earned 300 total points
ID: 8177228
ha ha ha ... yes ....
u can write me letters... LOL ...

come back anytime at EE, no matter how little pts u have ... we work on the problem not just the pts.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question