Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Dec 2006
    Thanked 1 Time in 1 Post

    How to refer to a Function 1 Image() Array in Function 2?

    I have 2 functions. The first is an XMLhttpRequest that loads a series of images into an Image() array.

    The second function has up and down arrow key listeners to activate when the up and down arrow keys are pressed.

    How do I refer to the Image() array in my up/down key listener function?

    (I am trying to make the up key advance the image by 1 and the down key decrement the image by one when each are pressed).

    Help please!!!

    You can see the live code here:


  • #2
    New to the CF scene
    Join Date
    Jan 2007
    Thanked 0 Times in 0 Posts
    When code is inside a function, as I understand it, it only lives inside of that function. If you want the second funtion to have access to it, you need to either declare the array outside of the function, then load the images inside the function, or pass the array to the second function.


    Posting Permissions

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