1

ユーザーがswfの一部またはすべてのページ(AS 2.0)を印刷できる印刷ボタンを含む埋め込みswfがあります。ユーザーが swf から印刷ボタンをクリックすると、ブラウザーの印刷ダイアログ ボックスが開きます。ただし、ユーザーが印刷をクリックすると、swf が空白になります。これは IE と FF でのみ発生します - Chrome では問題なく動作します。AS2.0 コードは次のとおりです。

print_btn.onPress = function() {
    attachMovie("printbg", "printbg", 5000);
    printbg._x = 623;
    printbg._y = 360;
    attachMovie("printall", "printall", 5001);
    printall._x = 621;
    printall._y = 316;
    attachMovie("printun", "printun", 5002);
    printun._x = 622;
    printun._y = 342;
    attachMovie("printcancel", "printcancel", 5003);
    printcancel._x = 622;
    printcancel._y = 367;
    printcancel.onPress = function() {
        removeprint();
    };
    function removeprint() {
        removeMovieClip("printbg");
        removeMovieClip("printall");
        removeMovieClip("printun");
        removeMovieClip("printcancel");
    }
    printall.onPress = function() {
        printallterms();
        removeprint();
    };
    printun.onPress = function() {
        printunlearnedterms();
        removeprint();
    };
};
function printallterms() {
    pageno = 0;
    toptitle = "<b>"+title+"</b>\nALL\n\n";
    attachMovie("printpage_mov", "printall"+pageno, 500);
    this["printall"+pageno]._x = 1000;
    this["printall"+pageno]._y = 0;
    this["printall"+pageno].printtxt.htmlText = toptitle;
    for (x=1; x<=20; x++) {
        if (this["printall"+pageno].printtxt.textHeight+45>680) {
            pageno++;
            attachMovie("printpage_mov", "printall"+pageno, 501);
            this["printall"+pageno]._x = 1000;
            this["printall"+pageno]._y = 0;
            this["printall"+pageno].printtxt.htmlText = "";
        }
        this["printall"+pageno].printtxt.htmlText += "<b>"+term_i[x]+"</b>"+"\n";
        this["printall"+pageno].printtxt.htmlText += definition_i[x]+"\n\n";
    }
    printjobs();
}
function printunlearnedterms() {
    pageno = 0;
    toptitle = "<b>"+title+"</b>\nREMAINING\n\n";
    attachMovie("printpage_mov", "printall"+pageno, this.getNextHighestDepth());
    this["printall"+pageno]._x = 1000;
    this["printall"+pageno]._y = 0;
    this["printall"+pageno].printtxt.htmlText = toptitle;
    for (x=1; x<=20; x++) {
        if (this["printall"+pageno].printtxt.textHeight+45>680) {
            pageno++;
            attachMovie("printpage_mov", "printall"+pageno, this.getNextHighestDepth());
            this["printall"+pageno]._x = 1000;
            this["printall"+pageno]._y = 0;
            this["printall"+pageno].printtxt.htmlText = "";
        }
        if (learned[x] == 0) {
            this["printall"+pageno].printtxt.htmlText += "<b>"+term_i[x]+"</b>"+"\n";
            this["printall"+pageno].printtxt.htmlText += definition_i[x]+"\n\n";
        }
    }
    printjobs();
}
function printjobs() {
    var allprintjob:PrintJob = new PrintJob();
    allprintjob.start();
    pagesToPrint = 0;
    while (pagesToPrint<=pageno) {
        allprintjob.addPage(this["printall"+pagesToPrint], {xMin:0, xMax:540, yMin:0, yMax:700});
        //trace(this["printall"+pagesToPrint]._height);
        removeMovieClip(this["printall"+pagesToPrint]);
        pagesToPrint++;
    }
    if (pagesToPrint>0) {
        allprintjob.send();
    }
    delete allprintjob;
}

助けてください!

4

0 に答える 0