?
Solved

help playing frames based on _xmouse

Posted on 2003-03-20
9
Medium Priority
?
184 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
  • 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
Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

 
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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
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.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

600 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