A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: [RESOLVED] AS2 pathing...

  1. #1
    Member
    Join Date
    Aug 2007
    Posts
    33

    resolved [RESOLVED] AS2 pathing...

    I have found some code that uses _root.

    //_root.createTextField("timer", _root.getNextHighestDepth(), 5, 0, 100, 25);
    _root.myMinutes = 10; //set to number of starting minutes
    _root.mySeconds = 0; //set to number of starting seconds
    _root.myMilliseconds = 0 //set to number of starting milliseconds
    _root.timer.text = "000:00:" + twoDigitString(myMinutes) + ":" + twoDigitString(mySeconds) + ":" + myMilliseconds;

    function updateTimer() {
    if(_root.myMilliseconds == 0) {
    if(_root.mySeconds == 0) {
    if(_root.myMinutes == 0) {
    _root.timer.text = "Please continue!";
    clearInterval(myInterval);
    delete myInterval;
    }
    else {
    _root.myMinutes = _root.myMinutes - 1;
    _root.mySeconds = 59;
    _root.timer.text = "000:00:" + twoDigitString(myMinutes) + ":" + twoDigitString(mySeconds) + ":" + myMilliseconds;

    }
    }
    else {
    _root.mySeconds = _root.mySeconds - 1;
    _root.myMilliseconds = 400;
    _root.timer.text = "000:00:" + twoDigitString(myMinutes) + ":" + twoDigitString(mySeconds) + ":" + myMilliseconds;

    }
    }
    else {
    _root.myMilliseconds = _root.myMilliseconds - 1;
    _root.timer.text = "000:00:" + twoDigitString(myMinutes) + ":" + twoDigitString(mySeconds) + ":" + myMilliseconds;

    }
    }

    // This function will make sure we have two number places in our number if it's less then 9(0#)

    function twoDigitString(myNumber) {
    myTemp = String(myNumber);
    if(myTemp.length == 1) {
    myTemp = "0" + myTemp;
    }
    return myTemp;
    }

    myInterval = setInterval(updateTimer, 1);
    stop();



    but I am using the swf in a container so the _root. breaks this Im sure...
    I have tried changing all the _root. to this. with no luck it doesnt work at all?!?!?!

    Please help

    Red

  2. #2
    :
    Join Date
    Dec 2002
    Posts
    3,518
    If you are publishing for the Flash 7 or later player, try adding the following as the first line in your above code.
    Code:
    this._lockroot = true;
    Or on the first frame of the main timeline.
    Last edited by dawsonk; 08-31-2010 at 04:01 PM. Reason: Added more...

  3. #3

  4. #4
    Member
    Join Date
    Aug 2007
    Posts
    33
    Great that worked! but now the dynamic text field bumps around as its counting down. It is fine when I view the swf by itself.

  5. #5

  6. #6
    Member
    Join Date
    Aug 2007
    Posts
    33
    It moves about 5-10 pixels left then right and then sometimes up and down?!?!?! about 1-2 time a second.

  7. #7
    :
    Join Date
    Dec 2002
    Posts
    3,518
    Can you post stripped down versions of your flas here?

  8. #8
    Member
    Join Date
    Aug 2007
    Posts
    33
    I should explain a bit more - It only bounces around in the Articulate wrapper.

  9. #9
    Member
    Join Date
    Aug 2007
    Posts
    33
    I embedded the numbers and it seemed to work - thanks everyone for the help!

  10. #10

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