Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to trace the data type?

Status
Not open for further replies.

fedtrain

Instructor
Jun 23, 2004
142
US
Hello,
I had a function that was working fine...then I tried the next step of adding an interval...now I am getting undefined from my target.

Is there a way to trace for the data type so I can see if it is passing a number or a string?

Here is the code...
Code:
function revealNotes (min, max){
var number:Number = max;
     if (number == 8){
     var target = this.onStage.allNotesOnStage.easyArray
     var randomNum:Number = Math.floor(Math.random() * (max - min + 1)) + min;
     var showNote = target[randomNum];
         trace (target)
         if (showNote._visible == false){
              showNote._visible = true;
         }
     }
}
Code:
btnEasy.onRelease = function(){
    this._parent.myInterval = setInterval(revealNotes,1000,0,8);
}

Not sure why my target is now showing up as undefined.

"Credit belongs to the man who is actually in the arena - T.Roosevelt
 
Nevermind...here is the code that works...

Code:
btnEasy.onRelease = function(){
    this._parent.myInterval = setInterval (this._parent."revealNotes",1000,0,8);
}

Somehow this makes the target show up...wish I knew what it was doing to break.

Anyway...anyone now why this does throw out an undefined once in a while? My array has seven items in it, but had to use 8 to get them all to show...someting about the 0 position(??)

"Credit belongs to the man who is actually in the arena - T.Roosevelt
 
DOH!!!

Using the zero means subtracting one...not adding one...after I ran the correct trace...but 7 and 8 were undefined.
Have to pass a 6 and not an 8.

Ok..back to the brick wall..maybe I'll learn something yet.

"Credit belongs to the man who is actually in the arena - T.Roosevelt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top