dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [F8] [AS2, CS3] Variables not updating constantly

  1. #1
    Member
    Join Date
    Oct 2005
    Location
    Santa Barbara, California, USA
    Posts
    61

    [F8] [AS2, CS3] Variables not updating constantly

    I have variables some of which have values derived from dynamic text boxes with instance names, some var = (calculations) and some "if" statments. Finally a final value is derived and passed to a movie. The problem is that my trace statments show that the values are calculated once, then no more. Does this need to be in a onEnterFrame function? I tried that but it didn't work, although I made have made a typo.

    Here's the code. If the solution is still obscure I can add the rest, or even a .fla.

    Thanks a lot, I'm struggling but moving forward on this project.

    PHP Code:
    var sunTime = 0;
    sunTime = (sunMinutes+(sunHours*60));
    trace ("a"+sunTime);
    if (ampmthing = true) {
    sunTime = sunTime+720;
    trace ("b"+sunTime);
    }
    sunTime = sunTime-300;
    trace ("c"+sunTime);
    if (sunTime<0) {
    sunTime = (sunTime+1440);
    trace ("d"+sunTime);
    };
    trace ("e"+sunTime);
    _parent.sun.gotoAndStop(sunTime)

  2. #2
    Member Pepember
    Join Date
    Jul 2001
    Location
    Berlin
    Posts
    886
    just like you said: put your code inside an onEnterFrame or set an interval, such as:

    function calcTime(){
    // your code here
    }
    var inter = setInterval(calcTime, 1000);
    Please sign here

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