Reputation: 1591
I came across this code snippet online that helps me solve a problem with a simple way to delay a piece of as3 code.
It runs fine and does the job, but I get a warning in flashbuilder / flex that says:
variable 'delayTextVisible' has no type declaration.
here is the code snippet:
var delayTextVisible = setInterval(showText,400);
function showText():void {
textgroup.visible = true; // insert delayed code here
clearInterval(delayTextVisible); // stop setInterval repeating
}
so my question is what type do I need to assign to the variable delayTextVisible for the warning to go away? I tried :String but that didnt work.
Upvotes: 1
Views: 2067
Reputation: 22604
@bitmapdata.com's answer is correct.
However, in any case and for any variable, if you don't know its specific type, or if you need to declare the variable in a way that allows you to store many different types, you can always use the *
placeholder:
var delayTextVisible:* = setInterval( showText, 400 );
Upvotes: 2
Reputation: 9600
var delayTextVisible:uint = setInterval(showText,400);
setInterval
return type is uint
. see a documentation: setInterval
Upvotes: 4