En espérant que quelqu'un aura une idée car c'est hyper URGENT....
Je détaille un peu pour que tout soit clair...
Je suis en train de créer un CD-Rom Flash (donc OFFLINE) et j'utilise les fonctions suivantes pour ouvrir des fichiers pdf:
Dans flash, sur le bouton :
----------------------------------------------
on (release) {
fscommand ("exec", "nomdufichier.bat");
}
----------------------------------------------
Puis dans le fichier en question :
----------------------------------------------
@ echo off
@ start nomdevotrefichier.extension
@ exit
----------------------------------------------
Tout fonctionne bien jusque là pour des boutons pour lesquels l'ActionScript est directement dessus.
MAIS, j'utilise par ailleurs des boutons pour lesquels le code est chargé à partir d'un fichier XML. Pour que tout soit clair : j'ai un diaporama de photo et de texte qui fonctionne parfaitement et je souhaite qu'en cliquant sur l'image un fichier PDF s'ouvre (pas en utilisant la fonction getURL car ça déconne tout le temps en OFFLINE - c'est ce qui est déjà dans le code ci-dessous) en utilisant la fonction fscommand ("exec", "nomdufichier.bat"); tout en sachant que le nom du fichier doit changer.
J'ai testé des trucs du type fscommand (exec, id[p].bat); pour lancer le fichier correspondant mais ça ne fonctionne pas. Merci d'avance à celui ou celle qui aurait une idée...
Ci-dessous le code pour que tout le monde comprenne.
----------------------------------------------
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
id = [];
titre = [];
auteurs = [];
local = [];
email = [];
resume = [];
motscles = [];
urlimage = [];
urlpdf = [];
urlmail = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
id[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
titre[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
auteurs[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
local[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
email[i] = xmlNode.childNodes[i].childNodes[4].firstChild.nodeValue;
resume[i] = xmlNode.childNodes[i].childNodes[5].firstChild.nodeValue;
motscles[i] = xmlNode.childNodes[i].childNodes[6].firstChild.nodeValue;
urlimage[i] = xmlNode.childNodes[i].childNodes[7].firstChild.nodeValue;
urlpdf[i] = xmlNode.childNodes[i].childNodes[8].firstChild.nodeValue;
urlmail[i] = xmlNode.childNodes[i].childNodes[9].firstChild.nodeValue;
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("data/data.xml");
/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
nextImage();
}
};
Key.addListener(listen);
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
nextImage();
};
/////////////////////////////////////
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
}
}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(urlimage[p],1);
titre_txt.text = titre[p];
auth_txt.text = auteurs[p];
resume_txt.htmlText = resume[p];
univ_txt.text = local[p];
mail_txt.htmlText = email[p];
cles_txt.text = motscles[p];
pdf_btn.onRelease = function() {
getURL(urlpdf[p],_blank);}
mail_btn.onRelease = function () {
getURL(urlmail[p], _blank);}
picture_num();
}
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie(urlimage[p], 1);
titre_txt.text = titre[p];
auth_txt.text = auteurs[p];
resume_txt.htmlText = resume[p];
univ_txt.text = local[p];
mail_txt.htmlText = email[p];
cles_txt.text = motscles[p];
pdf_btn.onRelease = function() {
getURL(urlpdf[p],_blank);}
mail_btn.onRelease = function () {
getURL(urlmail[p], _blank);}
picture_num();
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(urlimage[0], 1);
titre_txt.text = titre[0];
auth_txt.text = auteurs[0];
resume_txt.htmlText = resume[0];
univ_txt.text = local[0];
mail_txt.htmlText = email[0];
cles_txt.text = motscles[0];
pdf_btn.onRelease = function() {
getURL(urlpdf[0],_blank);}
mail_btn.onRelease = function () {
getURL(urlmail[0],_blank);}
picture_num();
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}