flash getURL delay

  • Started
  • Last post
  • 3 Responses
  • kinetic

    i have a script in flash that gets elements from a db that contain things for flash to popup by calling a js function

    i loop through those elements like this:

    for (i=0; i<cityPopup_amount; i++) {
    if (cityPopupPositionArray[i] == "center") {
    popupNum = "";
    } else if (cityPopupPositionArray[i] == "top_left") {
    popupNum = 2;
    }
    getURL("JavaScript:openBrWindow" + popupNum + "('sections/popups/popup.php?id... + cityPopupIDArray[i] + "', 'globalCity_" + i + "', '" + cityPopupWidthArray[i] + "', '" + cityPopupHeightArray[i] + "')");
    }

    it can't call the js that quick though..it will only ever popup the last element.

    i know this is retarded and i hate popups..but the client needs it that way because they love their popups.

    anyone know how i could create a delay between those loop iterations so the js would have time to call each iteration?

    thanks!! :D

  • jkosoy0

    hmmm...if its not calling the JS speedy enough, then try to write the code that determines which popup to open on one frame and then the getURL commands on consecutive frames after.

    i've never had to do anything like this so i'm not too certain what the results look like.

    another guess i have is that it actually is calling the right things, just opening them all in the same popup instead of individual popups. in that case, you'd only see the last thing obviously.

    a third thought would be to just build whatever content they want into flash and call movieclips instead. i don't know how updateable or dynamic they need this though.

    could you post what you've got up somewhere or something so i could better troubleshoot?

  • CoW0

    instead of doing a for...loop, try iterating through each element using a looping movieclip.

    setup a movieclip with say 4 frames in it. on the first frame you call the next element and do all your work on it (in your case, a getURL thing). Then tell the movieclip to play and it will delay for 4 frames (or however many frames you give it) before it hits the next element.

    Also on the first frame of this movieclip, make sure you do a check for when you are on the last element in your array. When it is the last element, tell this looping movieclip to stop.

    That could prolly work. If 4 frames isnt enough delay to open your windows in an appropriate manner, try adding more frames.

    \r

    if that doesnt work well, you could always do a delay using setInterval and getTimer functions.

    hope this helps

  • kinetic0

    thats what i can do.

    ill have a movie clip with like 10 frames...on frame 10 it will increment a number and call the next JS thing it needs to call until there are no more

    good stuff :)