A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Panorama Scroll

Hybrid View

  1. #1
    Member
    Join Date
    Mar 2005
    Posts
    40

    Panorama Scroll

    Hi. I have just finished my new Flash site and I've got this one final problem.
    It would be great if you could help me somehow. Please, visit this link: www.trusthead.com/main.html

    As you might guess, I don't like the way background scrolls left or right. On my site, it starts to move even when the cursor is nearly in the middle of the page which can cause some problems when a viewer wants to click on any button. The best solution would be to tell the panorama to scroll only when the cursor reaches the left or right end of the movie. I have a good script but dunno what to add to make the background less sensitive.

    The first frame contains this script:

    Code:
     // Xphoto = startposition of the scoll image 
    xphoto = 399.9; 
    // 
    // Widthmovie = This variable hase to be set to the 
    // same amount of the moviewidth / 
    widthmovie = 800; 
    // 
    // Scrollspeed = The scollspeed of the image (high numbers result in slow scrolls 10=average) 
    scrollspeed = 15; 
    // 
    // widthphoto = the width of your scrollable image in pixels/ 
    widthphoto = 2400; 
    _root.info.gotoAndPlay(2);
    The second:

    Code:
    // Setting the xmouse to 0 in the centre of the movie: 
    ypozycja = _ymouse; 
    if (ypozycja>0 and ypozycja<490) { 
       xmouse = _xmouse-(widthmovie/2); 
       // Setting the speed: 
       speed = (xmouse)/scrollspeed; 
       // If the speed is negative, the speed will be made positive here: 
       if (speed<0) { 
          speed = -(speed); 
       } 
       // If the mouse moves to left, the photo will scroll to the right:
       // (That makes sense.... Doesn't it!! ;-) 
       if (xmouse<0) { 
          xphoto = xphoto+speed; 
       } 
       // If the mouse moves to the right, the photo will scroll to the left: 
       if (xmouse>0) { 
          xphoto = xphoto-speed; 
       } 
       // Checking for the left end of the image: 
       if (xphoto>1200) { 
          xphoto = 1200; 
       } 
       // Checking for the right end of the image: 
       if (xphoto<-400) { 
          xphoto = -400; 
       } 
       // Placing the moviclip (photo) on it's new postition: 
       setProperty("photo", _x, xphoto); 
       //trace(_ymouse); 
    }

    It would be great if you could help me with this thing. I tried to figure it out but now Im lost.

  2. #2
    Member
    Join Date
    Jan 2006
    Posts
    62
    if (ypozycja>0 and ypozycja<490) {

    speed = 10;

    if (_xmouse<30) {
    xphoto = xphoto+speed;
    }

    if (xmouse>Stage.width-30{
    xphoto = xphoto-speed;
    }
    if (xphoto>1200) {
    xphoto = 1200;
    }
    // Checking for the right end of the image:
    if (xphoto<-400) {
    xphoto = -400;
    }
    // Placing the moviclip (photo) on it's new postition:
    setProperty("photo", _x, xphoto);
    //trace(_ymouse);
    }

    i think the preceding codes can work?
    i don't know it is you want?
    Come from PeKing of China

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center