Visualizzazione dei risultati da 1 a 6 su 6
  1. #1
    Utente di HTML.it
    Registrato dal
    Jun 2004
    Messaggi
    295

    preload non carica, aiuto!

    ciao a tutti, il mio filmato in flash è composto da 2 scene: Scena 1 in cui c è il mio preload e Scena 2 in cui c è il filmato del libro fatto in actionscript con le pagine che si aprono, però in preload non carica come mai?l azione del preload va in conflitto con le azioni del libro?qui sotto vi incollo il codice del preload che sta nel primo fotogramma:

    // assegna a "car" il numero di bytes caricati del filmato principale
    car = _level0.getBytesLoaded();
    // assegna a "tot0" il numero di bytes totali del filmato principale
    tot = _level0.getBytesTotal();
    // assegna a "perc" la percentuale caricata
    perc = parseInt((car*100)/tot);
    // percentuale da mostrare nel campo dinamico
    progres = perc+"%";
    // fa avanzare la barra sincronizzandola con la percentuale caricata
    _root.barra.gotoAndStop(perc);
    // se i bytes caricati sono uguali a quelli dell'intero filmato
    if (car == tot) {
    // passa alla scena successiva
    nextScene();
    }


    E i codici del libro:

    1° codice situato nel primo e solo fotogramma:

    // larghezza delle pagine;
    w = 400;
    //
    // altezza delle pagine;
    h = 600;
    //
    // colore delle pagine
    pageColor = 0xFAFFE5;
    //
    // velocità (minore di 1) per lo scorrimento automatico delle pagine
    speed = 0.1;
    //
    // se metti 'manual = false' basta un clic per girare pagina
    manual = true;
    //
    // il vettore delle pagine (il numero deve essere pari); sono gli identificatori delle pagine in libreria
    pages = ["print1", "print2", "print3", "print4", "print5", "print6", "print7", "print8", "print9", "print10"];
    //
    // funzione per creare il libro
    libro.init(w, h, pageColor, pages, speed, manual);
    //
    // è possibile passare come ultimo parametro un oggetto Sound se per esempio possedete il rumore del foglio
    // il suono verrà riprodotto quando la pagina gira se 'manual' è impostato su false.
    //
    //
    // ho aggiunto anche una funzione autoClose per riportare
    // il libro alla prima pagina
    chiudi.onRelease = function() {
    libro.autoClose();
    };


    2° codice situato nel clip filmato(PageFlip): Vedi sotto
    sara

  2. #2
    Utente di HTML.it
    Registrato dal
    Jun 2004
    Messaggi
    295
    #initclip
    function PageFlip() {
    }
    PageFlip.prototype = new MovieClip();
    Object.registerClass("PageFlip", PageFlip);
    PageFlip.prototype.init = function(w, h, pageColor, pages, speed, manual, pageSoundFX) {
    this.pageRatio = 0;
    this.pageWi = w;
    this.pageHi = h;
    this.pageWiHi = this.pageWi+this.pageHi;
    this.pivotY = this.pageHi/2+this.pageWi;
    this.pageColor = pageColor;
    this.dir = 1;
    this.flipPage = 1.5;
    this.curPage = .5;
    this.pageVect = pages;
    this.maxPages = pages.length;
    this.autoStep = (speed != undefined) ? speed : 0.05;
    this.dragging = false;
    this.manualFlip = (manual != undefined) ? manual : true;
    this.flipping = false;
    this.pageSFX = pageSoundFX;
    this.attachMovie("cornerButton", "RButton", 11);
    this.RButton._x = this.pageWi;
    this.RButton._y = -this.pageWi;
    this.attachMovie("cornerButton", "LButton", 12);
    this.LButton._x = -this.pageWi;
    this.LButton._y = -this.pageWi;
    this.LButton._xscale = -100;
    if (this.manualFlip) {
    this.LButton.onPress = function() {
    this._parent.startFlip(-1);
    };
    this.LButton.onReleaseOutside = function() {
    this._parent.flipRelease();
    };
    this.LButton.onRelease = function() {
    this._parent.flipRelease();
    };
    this.RButton.onPress = function() {
    this._parent.startFlip(1);
    };
    this.RButton.onReleaseOutside = function() {
    this._parent.flipRelease();
    };
    this.RButton.onRelease = function() {
    this._parent.flipRelease();
    };
    } else {
    this.LButton.onRelease = function() {
    this._parent.autoFlip(-1);
    };
    this.RButton.onRelease = function() {
    this._parent.autoFlip(1);
    };
    }
    this.pageInit(this.flipPage, this.dir);
    this._y += this.pivotY;
    };
    PageFlip.prototype.pageInit = function(cp, d) {
    this.flipPage = cp;
    this.dir = d;
    this.setStationary();
    this.setFlipping();
    this.setShadows();
    this.makeMasks();
    this.limitBook();
    };
    PageFlip.prototype.makePage = function(targ, xQuadrant) {
    targ.beginFill(this.pageColor, 100);
    targ.moveTo(0, -this.pageWi);
    targ.lineTo(0, -this.pageWiHi);
    targ.lineTo(xQuadrant*this.pageWi, -this.pageWiHi);
    targ.lineTo(xQuadrant*this.pageWi, -this.pageWi);
    targ.endFill();
    };
    PageFlip.prototype.makeShade = function(targ, xQuadrant) {
    var pageColors = [0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000];
    var alphas = [40, 25, 15, 5, 0, 1, 6];
    var ratios = [0, 1, 17, 51, 89, 132, 255];
    var matrix = {matrixType:"box", x:0, y:this.pageWi, w:xQuadrant*this.pageWi, h:this.pageHi, r:0};
    targ.beginGradientFill("linear", pageColors, alphas, ratios, matrix);
    targ.moveTo(0, -this.pageWi);
    targ.lineTo(0, -this.pageWiHi);
    targ.lineTo(xQuadrant*this.pageWi, -this.pageWiHi);
    targ.lineTo(xQuadrant*this.pageWi, -this.pageWi);
    targ.endFill();
    };
    PageFlip.prototype.makeShadow = function(targ, xQuadrant) {
    var pageColors = [0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000];
    var alphas = [40, 25, 15, 5, 0, 1, 6];
    var ratios = [0, 1, 17, 51, 89, 132, 255];
    var maxLength = Math.sqrt((this.pageWi*this.pageWi)+(this.pageWiHi *this.pageWiHi));
    var matrix = {matrixType:"box", x:0, y:-maxLength, w:xQuadrant*this.pageWi, h:maxLength-this.pageWi, r:0};
    targ.beginGradientFill("linear", pageColors, alphas, ratios, matrix);
    targ.moveTo(0, -this.pageWi);
    targ.lineTo(0, -maxLength);
    targ.lineTo(xQuadrant*this.pageWi, -maxLength);
    targ.lineTo(xQuadrant*this.pageWi, -this.pageWi);
    targ.endFill();
    };
    PageFlip.prototype.setStationary = function() {
    this.createEmptyMovieClip("SLPage", 1);
    if (this.flipPage != 1.5) {
    this.makePage(this.SLPage, -1);
    this.SLPage.attachMovie(this.pageVect[(this.flipPage-1.5-1)], "Print", 1);
    this.SLPage.Print._x = -this.pageWi/2;
    this.SLPage.Print._y = -this.pivotY;
    }
    this.createEmptyMovieClip("SRPage", 2);
    if (this.flipPage != this.maxPages-.5) {
    this.makePage(this.SRPage, 1);
    this.SRPage.attachMovie(this.pageVect[(this.flipPage+1.5-1)], "Print", 1);
    this.SRPage.Print._x = this.pageWi/2;
    this.SRPage.Print._y = -this.pivotY;
    }
    var targ = this.dir>0 ? this.SLPage : this.SRPage;
    targ.createEmptyMovieClip("Shade", 2);
    this.makeShade(targ.Shade, -this.dir);
    };
    PageFlip.prototype.setFlipping = function() {
    this.createEmptyMovieClip("FTPage", 3);
    this.makePage(this.FTPage, this.dir);
    this.FTPage.attachMovie(this.pageVect[(this.flipPage-this.dir*.5-1)], "Print", 1);
    this.FTPage.Print._x = this.dir*this.pageWi/2;
    this.FTPage.Print._y = -this.pivotY;
    this.FTPage.createEmptyMovieClip("Shade", 2);
    this.makeShade(this.FTPage.Shade, this.dir);
    this.createEmptyMovieClip("FBPage", 4);
    this.makePage(this.FBPage, -this.dir);
    this.FBPage.attachMovie(this.pageVect[(this.flipPage+this.dir*.5-1)], "Print", 1);
    this.FBPage.Print._x = -this.dir*this.pageWi/2;
    this.FBPage.Print._y = -this.pivotY;
    this.FBPage._rotation = this.dir*90;
    };
    PageFlip.prototype.setShadows = function() {
    this.createEmptyMovieClip("FShadow", 5);
    this.makeShadow(this.FShadow, -this.dir);
    this.FShadow._rotation = this.dir*45;
    this.createEmptyMovieClip("SShadow", 6);
    this.makeShadow(this.SShadow, this.dir);
    this.SShadow._rotation = this.dir*45;
    };
    PageFlip.prototype.makeMasks = function() {
    this.createEmptyMovieClip("FBPageMask", 7);
    this.FBPageMask.beginFill(0x005500, 100);
    this.FBPageMask.lineTo(this.pageWiHi, -this.pageWiHi);
    this.FBPageMask.curveTo(0, -2*this.pageWiHi, -this.pageWiHi, -this.pageWiHi);
    this.FBPageMask.endFill();
    this.FBPageMask.duplicateMovieClip("FTPageMask", 8);
    this.createEmptyMovieClip("FShadowMask", 9);
    this.makePage(this.FShadowMask, -this.dir);
    this.FShadowMask._rotation = this.dir*90;
    this.createEmptyMovieClip("SShadowMask", 10);
    this.makePage(this.SShadowMask, this.dir);
    this.FBPage.setMask(this.FBPageMask);
    this.FTPage.setMask(this.FTPageMask);
    this.FShadow.setMask(this.FShadowMask);
    this.SShadow.setMask(this.SShadowMask);
    };
    PageFlip.prototype.limitBook = function() {
    if (this.flipPage == 1.5) {
    this.SLPage._visible = 0;
    this.LButton._visible = 0;
    this.SShadow._visible = 0;
    if (this.dir == 1) {
    this.FTPage.Shade._alpha = 67;
    this.SShadow._visible = 1;
    } else {
    this.FShadow._alpha = 67;
    }
    } else if (this.flipPage == this.maxPages-.5) {
    this.SRPage._visible = 0;
    this.RButton._visible = 0;
    this.SShadow._visible = 0;
    if (this.dir == -1) {
    this.FTPage.Shade._alpha = 67;
    this.SShadow._visible = 1;
    } else {
    this.FShadow._alpha = 67;
    }
    }
    };
    PageFlip.prototype.flip = function(curVal) {
    var rot = this.dir*45*curVal;
    this.FBPageMask._rotation = this.FTPageMask._rotation=-rot;
    this.FBPage._rotation = this.FShadowMask._rotation=(this.dir*90)-rot*2;
    this.FShadow._rotation = this.SShadow._rotation=(this.dir*45)-rot;
    };
    PageFlip.prototype.getPageRatio = function() {
    if (this.dragging) {
    this.pageRatio = -this.dir*(this._xmouse-this.startX-this.dir*20)/(2*this.pageWi);
    } else {
    this.pageRatio>2/3 ? this.pageRatio += this.autoStep : this.pageRatio -= this.autoStep;
    }
    if (this.pageRatio<=0) {
    this.pageRatio = 0;
    if (!this.dragging) {
    this.flipDone();
    }
    } else if (this.pageRatio>=1) {
    this.pageRatio = 1;
    if (!this.dragging) {
    this.flipDone();
    }
    }
    return (this.pageRatio);
    };
    PageFlip.prototype.startFlip = function(dir) {
    this.dir = dir;
    this.pageInit(this.curPage+this.dir, this.dir);
    this.startX = this.dir*this.pageWi;
    this.dragging = true;
    this.RButton._visible = 0;
    this.LButton._visible = 0;
    this.onEnterFrame = function() {
    var pr = this.getPageRatio();
    this.flip(pr);
    };
    };
    PageFlip.prototype.flipRelease = function() {
    this.dragging = false;
    if (this.pageRatio>2/3) {
    this.curPage += 2*this.dir;
    }
    };
    PageFlip.prototype.flipDone = function() {
    this.flipping = false;
    this.onEnterFrame = null;
    if (this.curPage != .5) {
    this.LButton._visible = true;
    }
    if (this.curPage != this.maxPages+.5) {
    this.RButton._visible = true;
    }
    if (this.pageRatio == 0) {
    this.FShadow.removeMovieClip();
    this.FShadowMask.removeMovieClip();
    this.SShadow.removeMovieClip();
    this.SShadowMask.removeMovieClip();
    this.FBPage.removeMovieClip();
    this.FBPageMask.removeMovieClip();
    if (this.dir == 1) {
    this.SRPage.removeMovieClip();
    } else {
    this.SLPage.removeMovieClip();
    }
    } else {
    this.FTPage.removeMovieClip();
    if (this.dir == -1) {
    this.SRPage.removeMovieClip();
    } else {
    this.SLPage.removeMovieClip();
    }
    }
    this.FTPageMask.removeMovieClip();
    };
    PageFlip.prototype.autoFlip = function(dir, autoclose) {
    this.dir = dir;
    if (autoclose && this.curPage == .5) {
    this.flipDone();
    this.pageInit(1.5, 1);
    } else {
    this.pageInit(this.curPage+this.dir, this.dir);
    this.dragging = true;
    this.RButton._visible = false;
    this.LButton._visible = false;
    this.pageRatio = 0;
    this.pageSFX.start();
    this.onEnterFrame = function() {
    this.pageRatio += autoclose ? 2*this.autoStep : this.autoStep;
    if (this.pageRatio<=0) {
    this.pageRatio = 0;
    this.curPage += 2*this.dir;
    if (this.curPage<0) {
    this.curPage = .5;
    }
    this.dragging = false;
    this.flipDone();
    if (autoclose && this.curPage>1) {
    this.autoFlip(-1, true);
    }
    } else if (this.pageRatio>=1) {
    this.pageRatio = 1;
    this.dragging = false;
    this.curPage += 2*this.dir;
    if (this.curPage<0) {
    this.curPage = .5;
    }
    this.flipDone();
    if (autoclose && this.curPage>1) {
    this.autoFlip(-1, true);
    }
    }
    this.flip(this.pageRatio);
    };
    }
    };
    PageFlip.prototype.autoClose = function() {
    this.autoFlip(-1, true);
    };
    #endinitclip


    dova va in conflitto?premetto che con altri filmati il preload mi ha sempre funzionato.
    sara

  3. #3
    Ciao Sara, inizia ad utilizzare i nomi dei fotogrammi anzichè utilizzare nextScene(). Dai un etichetta al primo fotogramma della seconda scena, per esempio inizio, poi quando devi farlo passare alla scena successiva basta che dai gotoAndStop("inizio").
    Poi spiegati bene cosè che non carica, non ti passa alla scena successiva, oppure non vedi avanzare la barra del preload?

  4. #4
    Utente di HTML.it
    Registrato dal
    Jun 2004
    Messaggi
    295
    grazie jeck.dovrei mettere un preload su un swf il quale mi carichi(subito dopo il preload) un swf esterno in cui c è il libro.chi mi aiuta o se può mi dice qualche esempio di preload simile?
    sara

  5. #5
    Utente di HTML.it
    Registrato dal
    Nov 2004
    Messaggi
    36
    Scusa Sara 80
    se mi intrometto ma anch'io ho un problema analogo,
    Quando carico swf di partenza tutto ok preload ma clikko per caricare un swf esterno non mi fa vedere il preload della nuova pagina mentre la pagina si carica correttamente, come si può ovviare.

  6. #6
    Utente di HTML.it
    Registrato dal
    Jun 2004
    Messaggi
    295
    ciao, il mio problema è che il filmato che devo caricare dopo il preload è un filmato o scena di un libro fatto in actionscript e perciò secondo me il codice del preload va in conflitto con il codice del libro e non si vede il preload.la soluzione è quella di mettere in un swf solo il preload e in un altro swf esterno il libro o filmato che sia.ma il problema è che non so il codice del preload da adottare.qualcuno ci da una mano?
    grazie
    sara

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.