Javascript Performance in Internet Explorer Issue (Conflict with Flash?)

Discussion in 'Javascript' started by mudgen, Oct 2, 2007.

  1. mudgen

    mudgen Guest



    I'm having a javascript performance issue. I have a function that is
    called many times that fades an image in, and then out, then it
    switches to a different image fading it in and then out, and then
    doing it with a third image, and then starting over. This code works
    fine in Firefox but in Internet Explorer it slows down several flash
    items on the page -- slows down to a crawl, and the fading is slow
    too. The code works well by itself without flash elements on the page
    in Internet Explorer -- but not with flash elements.

    Could you please look at the below code. I'm looking for a bottleneck
    or something that might interfere with flash for some reason:

    images_and_links = [["image1.jpg", "http://www.link1,com"],
    ["image2.jpg", ""],
    ["image3.jpg", "http://"]];

    for (var i = 0; i <= images_and_links.length - 1; i++) {
    image_down_download = new Array();
    image_down_download = new Image(146,75);
    image_down_download.src = images_and_links[0];

    function setImage (image_num) {
    image_blender = document.getElementById("blend_images");

    image_string = "<a href=\"" + images_and_links[image_num][1] + "\">";
    image_string += "<img align=\"center\" border=\"0\" id=\"image_alpha
    \" class=\"blend_is_0\" src=\"" + images_and_links[image_num][0] +

    image_blender.innerHTML = image_string;


    image_opacity = 0;
    image_action = "increase";
    image_total = images_and_links.length - 1;
    image_num = 0;

    function imageFade(){

    if (image_action == "increase") {
    if(image_opacity <= 8)
    image_opacity += 0.04;
    else {
    image_action = "decrease";

    if (image_action == "decrease") {
    if(image_opacity >= .1)
    image_opacity -= 0.06;
    else {
    image_action = "increase";
    if (image_num >= image_total)
    image_num = -1;
    document.getElementById("image_alpha").style.KhtmlOpacity =
    document.getElementById("image_alpha").style.MozOpacity =
    document.getElementById("image_alpha").style.opacity = image_opacity;
    document.getElementById("image_alpha").style.filter =
    'alpha(opacity=' + 100 * image_opacity + ')';
    setTimeout("imageFade()", 10);

    The reason I'm calling imageFade every 10 milliseconds is to get the
    "fade" effect.
    mudgen, Oct 2, 2007
    1. Advertisements

  2. mudgen

    Bill H Guest

    Since you are already using Flash on the page, would it not be easier
    to put the images in a flash file and be consistant?

    Bill H
    Bill H, Oct 2, 2007
    1. Advertisements

  3. mudgen

    David Mark Guest

    Didn't we just have this discussion?
    David Mark, Oct 2, 2007
  4. mudgen

    mudgen Guest

    The original developers of the site I'm working on are no longer
    working on it, and I don't know flash.
    mudgen, Oct 2, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.