Hello,
I am new in the creation of 3D PDF and JavaScript, and I have a problem with the function SetTimeout.
I want to make a change texture on an object and after 3 seconds make another change texture on another object.
To do this, the function SetTimeout seemed the most effective but I can't get the expected result.
For information:
I declare two functions in my JavaScript file
function bouton_on(){
mat0 = scene.materials.getByName("bouton_on_inactive");
copyMaterialTexture(mat0.name,"bouton_on_active");
setTimeout("voyant_on()",1000);
}
function voyant_on(){
mat0 = scene.materials.getByName("voyant_inactive");
copyMaterialTexture(mat0.name,"voyant_active");
}
Dans le boutton de mon pdf , je fais bien appel à la fonction bouton_on()
getAnnots3D(0)[0].context3D.bouton_on();
And in button in my pdf, I do well bouton_on () function call
getAnnots3D(0)[0].context3D.bouton_on();
thank you for telling me what's wrong or help me to findanother solution.
Thanks
Bonjour,
Je suis novice dans la création de PDF 3D et Javascript, et je rencontre un problème avec la fonction SetTimeout.
Je souhaite effectuer un changement de texture sur un objet puis 3 secondes aprés effectuer un autre changement de texture sur un autre objet.
Pour ce faire , la fonction SetTimeout me semblait la plus efficace mais je n'arrive pas à obtenir le résultat attendu.
Pour information :
je déclare bien mes deux fonctions dans mon fichier Javascript
function bouton_on(){
mat0 = scene.materials.getByName("bouton_on_inactive");
copyMaterialTexture(mat0.name,"bouton_on_active");
setTimeout("voyant_on()",1000);
}
function voyant_on(){
mat0 = scene.materials.getByName("voyant_inactive");
copyMaterialTexture(mat0.name,"voyant_active");
}
Dans le boutton de mon pdf , je fais bien appel à la fonction bouton_on()
getAnnots3D(0)[0].context3D.bouton_on();
merci de me dire ce qui ne va pas ou de m'aiguiller vers une autre solution.
Cordialement.
This is actually very complicated to do.
"setTimeout" is not a global function in AcroJS - instead you have the app.setTimeOut() function. From within the 3D JS engine, you do not have direct access to the 'app' object, instead you must call it via
host.app.setTimeOut("myFunction(variable)");
The problem arises that myFunction() is called in the context of the host API (where "this" = "doc") - so you cannot directly use it to call a function within your 3D scene. It will instead involve two round-trips:
function my3Dfunction(variable) { console.println(variable); }
host.app.setTimeOut("getAnnots3D(pageNum)[0].context3D.my3Dfunction('h ello')",1000);
North America
Europe, Middle East and Africa
Asia Pacific