Hello
Sorry for my english.
I want change the fontColor of a field more than one time.
I have in event click of a field this:
app.setTimeOut( 'field.fontColor = "128,128,128"' , 2000);
but without luck...
anybody knows?
Thanks,
Luis.
app.setTimeOut( 'field.fontColor = "0,0,0"' , 4000);
app.setTimeOut( 'field.fontColor = "128,128,128"' , 6000);
app.setTimeOut( 'field.fontColor = "0,0,0"' , 8000);
app.setTimeOut( 'field.fontColor = "128,128,128"' , 8000);
Solved! Go to Solution.
Views
Replies
Total Likes
Ya you have to use app.setInterval. app.setTimeOut just occurs once.
Here's your code:
global.myTimer =
app.setInterval("myXFAObject = xfa.resolveNode('"+TextField1.somExpression+"');"+ //Change TextField1 to yours
"if (myXFAObject.fontColor=='0,0,0') myXFAObject.fontColor='128,128,128';"+
"else myXFAObject.fontColor='0,0,0';",500);//500 milisecond intervals
As a rule of thumb, anything you put in quotes for your JavaScript for app.setInterval or app.setTimeOut is in the context of the Acrobat API and not the XFA processor. A good way to determine if your code will work is to bring up the console and type it in there. If it works in the console, it should work in your timer.
And to stop the flashing:
app.clearInterval(global.myTimer);
Kyle
Views
Replies
Total Likes
Do you mean you want the font colour to flash??
I'm just wondering why you would want to use app.setTimeOut?
Kyle
Views
Replies
Total Likes
Hi Kyle,
Yes that is.
I don't know other way, do you know change the color as flash with other way?
ZAMPAZAMPA
Views
Replies
Total Likes
Ya you have to use app.setInterval. app.setTimeOut just occurs once.
Here's your code:
global.myTimer =
app.setInterval("myXFAObject = xfa.resolveNode('"+TextField1.somExpression+"');"+ //Change TextField1 to yours
"if (myXFAObject.fontColor=='0,0,0') myXFAObject.fontColor='128,128,128';"+
"else myXFAObject.fontColor='0,0,0';",500);//500 milisecond intervals
As a rule of thumb, anything you put in quotes for your JavaScript for app.setInterval or app.setTimeOut is in the context of the Acrobat API and not the XFA processor. A good way to determine if your code will work is to bring up the console and type it in there. If it works in the console, it should work in your timer.
And to stop the flashing:
app.clearInterval(global.myTimer);
Kyle
Views
Replies
Total Likes
Thanks Kyle. Worked perfectly!
ZAMPAZAMPA
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies