A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Can't stop scroller!!!! Please help!!!!

  1. #1
    Senior Member
    Join Date
    Sep 2003
    Posts
    107

    Can't stop scroller!!!! Please help!!!!

    Ok, so I have a scroller, with buttons on eachside, when the buttons clicked it slides either way on the x direction to show another images (holder). Right now it just jumps from image to image, and I'll put easing on it once I get this figured out. BUT, I can't get it to stop at the constraints of my dynamic movie. Right now I have 10 images in and I can trace all the maxWidth etc, but my first one always comes up NaN, so I can't find the beggining. Below is my code as well as some of the traces I have done to try to get this to work.

    Traces:
    totalClips I get 1,2,3,4,5,6,7,8,9,10 (I just want the last one tho, how do I get that?
    w_clips I get Nan, 161.5 (9times sorry, not gonna type 161.5 and confuse ya)
    totalWidth I get NaN, 323, 484.5, 646, 807.5, 969, 1130.5, 1292, 1453.5, 1615
    maxleft I get 10 undefieneds.
    and maxright, I get NaN then the distances. How do I set this up so I don't get the NaNs and undefineds, and how do I stop my movie from moving on my left and right btns when it reaches these max widths??



    PHP Code:
    function loadXML(loaded) {
     if (
    loaded) {
      
    xmlNode this.firstChild;
      
    image = [];
      
    description = [];
      
    title = [];
      
    link = [];
      
    btn = [];
      
    total xmlNode.childNodes.length;
      var 
    xPos 90;
      for (
    i=0i<totali++) {
       
    image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
       
    description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
       
    title[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
       
    link[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
       
    btn[i] = xmlNode.childNodes[i].firstChild.nodeValue;

       var 
    scrollerMovie attachMovie("scrollerMovie""new"+ii, {_x:xPos_y:42});
       
    xPos  += scrollerMovie._width+20;
       
    scrollerMovie.picture.loadMovie (image[i], 1);
       
    scrollerMovie.desc_txt.text description[i];
       
    scrollerMovie.title_txt.text title[i];
            var 
    totalClips scrollerMovie=i+1;
            var 
    clipBaseName     'new'
            var 
    w_clips         _root[clipBaseName '1']._width+2;
            var 
    totalWidth         = (totalClips w_clips);
            var 
    maxleft         = ["new"+i]._x;
            var 
    maxright         = (totalWidth/2);
            
    trace(maxleft);
       }
      
     } else {
      
    content "file not loaded!";
     }
    }
    xmlData = new XML();
    xmlData.ignoreWhite true;
    xmlData.onLoad loadXML;
    xmlData.load("images.xml");

    _root.leftBtn.swapDepths(99);
    _root.rightBtn.swapDepths(109);
    _root.lines.swapDepths(89);


            
     
    leftBtn.onRelease = function(){
         for (var 
    i=0i<totali++) { 
        
    _root["new"+i]._x += 161.5

        if(
    _root["new"+i]._x <= maxleft){_root["new"+i]._x += totalWidth;}
        
         } 
        }
     
      
    rightBtn.onRelease = function(){
          for (var 
    i=0i<totali++){
          
    _root["new"+i]._x -= 161.5;
        
          if(
    _root["new"+i]._x >= maxright){_root["new"+i]._x -= totalWidth;}
         
          }
         } 

  2. #2
    Senior Member
    Join Date
    Sep 2003
    Posts
    107
    And here's another example of how I'm trying my buttons, with an easeTween, but all my image holders just snap all the way to left and stack on top of eachother, then I can't move them. PLEASE help! I'm desperate here. and it shouldn't be this hard. Just soo confused, where are all the gurus?

    PHP Code:
     leftBtn.onRelease = function(){
      for (var 
    i=0i<totali++) { 
     
    //_root["new"+i]._x += 40; 
     
    new Tween(_root["new"+i], "_x"Regular.easeIn_xxPos1true);
     if(
    _root["new"+i]._x <= maxleft){_root["new"+i]._x += totalWidth;}
     
      } 
     }
     
      
    rightBtn.onRelease = function(){
       for (var 
    i=0i<totali++){
      new 
    Tween(_root["new"+i], "_x"Regular.easeIn_xmaxright._x1true);
     
    trace(maxleft);
     if(
    _root["new"+i]._x >= maxright){_root["new"+i]._x -= totalWidth;}
      
       }
      } 

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