writing from a as function to a flash form field

Discussion in 'Programming' started by vidachristy, Feb 27, 2006.

  1. #1
    I have a customer requirement to write a timer into an application so that they can time how long an action takes place. So...

    I am trying to get this getTimer() setInterval() thing to write to a textfield in a flash form.(MX7)
    Please review the code below and see if you can see a stupid mistake i am making....I am so close and yet, so far away...

    if a write an alert in the updateTimer function, the alert will show, but it still will not display the variable "elapsedTime" even in the alert....

    Could this be a scope issue?

    Attach Code

    //the actionscript is in a <cfformitem type=script>
    function startTimer() {
    alert ("in Start Timer");

    myInterval = setInterval(updateTimer, 1000);
    timerStatus = "TICKING";
    };

    function updateTimer() {
    elapsedTime = getTimer();
    stwa.text= elapsedTime;

    };

    <cfinput type="text" label="Timed Duration" name="stwa" width="100" >
    <cfinput type="button" label="Start" name="theButton" onClick="startTimer()" value="Start" >
    form fields:
     
    vidachristy, Feb 27, 2006 IP
  2. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #2
    it might be a communication-to-flash issue. JS communicates nicely to flash.

    is your flash object named?
    is swLiveConnect = true in flash embed?
    //JS CODE:
    window.document.flashObj.SetVariable("variableName", "value");
     
    ccoonen, Aug 12, 2006 IP