A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: getURL"BArray[i]" in AArray[i].onRelease isn't work

  1. #1
    Junior Member
    Join Date
    Jun 2005
    Posts
    29

    getURL"BArray[i]" in AArray[i].onRelease isn't work

    Code:
    var linkArray = new Array(A_url, B_url, C_url, D_url, E_url); 
    
          var btnArray = new Array(A_btn, B_btn, C_btn, D_btn, E_btn); 
    
          for (i=0; i<5; i++) { 
    
             btnArray[i]._alpha = 0; 
    
             btnArray[i].onRollOver = function() { 
                new Tween(this, "_alpha", Strong.easeIn, 0, 100, 0.5, true); 
             }; 
    
             btnArray[i].onRollOut = function() { 
                new Tween(this, "_alpha", Strong.easeOut, 100, 0, 0.5, true); 
             }; 
    
             btnArray[i].onRelease = function() { 
                getURL(linkArray[this.i], "_self");<<< how it works?
             }; 
          }
    linkarray are the urls extract from XML
    btnArray are the movieClips instance name on stage

    how can i work this out?

  2. #2
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    The 'i' will contain the last value of the loop iteration use the following instead..the changes are hghlighted in bold

    Code:
    var linkArray = new Array(A_url, B_url, C_url, D_url, E_url); 
    
          var btnArray = new Array(A_btn, B_btn, C_btn, D_btn, E_btn); 
    
          for (i=0; i<5; i++) { 
    
            btnArray[i].id = i; 
            btnArray[i]._alpha = 0;
    
             btnArray[i].onRollOver = function() { 
                new Tween(this, "_alpha", Strong.easeIn, 0, 100, 0.5, true); 
             }; 
    
             btnArray[i].onRollOut = function() { 
                new Tween(this, "_alpha", Strong.easeOut, 100, 0, 0.5, true); 
             }; 
    
             btnArray[i].onRelease = function() { 
                getURL(linkArray[this.id], "_self");<<< how it works?
             }; 
          }
    Hope it helps!!
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  3. #3
    Junior Member
    Join Date
    Jun 2005
    Posts
    29
    thx for reply

    i've try to trace(linkArray[this.i]) // undefined
    doesn't work ...

  4. #4
    Junior Member
    Join Date
    Jun 2005
    Posts
    29
    does anyone have similar experiance on array in array ?

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