A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Referncing images in layers using JavaScript

  1. #1
    How do I reference an image which is sitting in a layer in JavaScript.

    I am trying to do rollovers. Have them working great when outside of a layer, but when they get in layers, they don't work. Javascript Console in NN says not an object my code is below:

    function imgOn(imgName) {
    if (document.images) {
    if (current == imgName) {
    document[imgName].src = eval(imgName + "off.src");
    } else {
    document[imgName].src = eval(imgName + "on.src");
    }

    }
    }

    function imgOff(imgName) {
    if (document.images) {
    if (current == imgName) {
    document[imgName].src = eval(imgName + "on.src");
    } else {
    document[imgName].src = eval(imgName + "off.src");
    }
    }
    }

    thanks (sorry but I didn't know where else to ask this!!)

    blur

  2. #2
    Stick In The Mud
    Join Date
    Oct 2000
    Posts
    752
    You could try referrencing the images as document.layers.image.... or something.. Maybe it's not finding your images 'cos it's looking in the main doc as opposed to the layer...

    then again i could be talking rubbish...

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