A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: the display changes every variable no. of mins

  1. #1
    Senior Member
    Join Date
    Mar 2002
    Posts
    160

    the display changes every variable no. of mins

    hello everybody,
    i would like to let the user enter a number of minutes resempling transition speed ,

    where the display changes every bla bla minutes (entered no.)
    (i.e. if the user entered 6 the display will change every 6 minutes .. )

    what is the best way to do so ?????
    la ALLAH ela ALLAH mohamed rasol ALLAH

  2. #2
    Senior Member
    Join Date
    Sep 2000
    Location
    Pittsburgh
    Posts
    252
    hi rasha,

    you could use setInterval for this and attach a listener to the textfield so when the textfield is updated it changes a var you set for the interval time. Here is an example input textbox instance name 'theNum':


    function callback() {
    //do stuff here, change display
    trace("interval called");
    }

    function callInterval(num){
    intervalID = setInterval(callback, 60*(num*1000));
    //num in this case is the minutes, if you want seconds get rid
    //of the 60
    }

    callInterval(5);
    //start off with 5 minutes


    //listener function for the textfield
    function TListener() {
    this.onChanged = function() {
    //make sure that nothing happens if the textBox is empty
    if(theNum.text==""){
    null;
    }else{
    clearInterval(intervalID);
    num = theNum.text;
    callInterval(theNum.text);
    }
    };
    }

    myListener = new TListener();
    theNum.addListener(myListener);

    hope this helps,
    Dunc

  3. #3
    Senior Member
    Join Date
    Mar 2002
    Posts
    160
    thanks a lot
    this did help but still i have a problem here, the movie clips arent displayed sequencially right
    what means i have the first then the second then the interval is called twice at a time displaying the fourth instead of the third and then the sixth instead of the fifth
    i cant understand why is this happening , can u ??


    here is the code i did add to yours, where next is the frame name where the next movie clip is called

    Code:
    function callback() { 
    _root.previousarrow._visible = false;
    _root.nextarrow._visible = false;
    if(index<5){
    	gotoAndPlay("next");
    	}
    	else{
    		loadMovieNum (nextfile, 0);
    	}
    la ALLAH ela ALLAH mohamed rasol ALLAH

  4. #4
    Senior Member
    Join Date
    Sep 2000
    Location
    Pittsburgh
    Posts
    252
    hmmm, interesting, it sounds like your jumping from frame to frame, do you have more than one callback function by chance? I noticed this, which is why i am asking.
    if(index<5){
    gotoAndPlay("next");
    }
    else{
    loadMovieNum (nextfile, 0);
    }

    can you post a sample fla with the problems?

    Dunc

  5. #5
    Senior Member
    Join Date
    Mar 2002
    Posts
    160
    ok i emailed u , send me your email to send the file to u
    thanks
    la ALLAH ela ALLAH mohamed rasol ALLAH

  6. #6
    Senior Member
    Join Date
    Sep 2000
    Location
    Pittsburgh
    Posts
    252

  7. #7
    Senior Member
    Join Date
    Mar 2002
    Posts
    160
    u r over qouta
    la ALLAH ela ALLAH mohamed rasol ALLAH

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