• User

    Gallery con immagini

    Ho utilizzato un component gallery con immagini e l'ho posizionato sullo stage in modo che la pagina su cui lo carico me lo visualizzi correttamente;
    Ho messo il percorso delle immagini sull'XML e tutto funziona. Quando però vado a caricare tutto sul server, nella pagina web la gallery con le immagini non si visualizza correttamente.
    Come mai?

    Non so se c'entra qualcosa, la gallery ha sfondo bianco mentre il filmato su cui si carica ha lo sfondo nero.


  • Super User

    Non si visualizza correttamente significa che le immagine non le vedi proprio oppure si vedono male ?
    Se non le vedi è sicuramente un errore di path.


  • User

    Bravissimo, avevi perfettamente ragione; si trattava della cartella immagini che dovevo impostare sul server;

    Posso approfittare per chiederti un'altra cosa?

    Ho fatto due file, uno gallery e uno carosello: ora, questi deu file contengono nella libreria dei suoni che attraverso l'Actionscript vengono inseriti nel filmato;
    Nel mio sito ho inserito gallery e carosello in un keyframe del mio index.swf e vengono tutti e due caricati con la funzione loadMovieNum
    I suoni sono "incorporati", per così dire, nell'actionscript;
    Come mai se io lancio i filmati dall'HD singolarmente i suoni si sentono, mentre attraverso l'index completo no, dov'è l'errore?
    Grazie


  • Super User

    Bisognerebbe vedere il codice che hai usato in gallery e carosello per riprodurre i suoni 🙂


  • User

    Per carousel:

    import mx.utils.Delegate;
    import mx.transitions.Tween;
    import mx.transitions.easing.;
    var numOfItems:Number;
    var radiusX:Number = 300;
    var radiusY:Number = 75;
    var centerX:Number = Stage.width/2;
    var centerY:Number = Stage.height/2;
    var speed:Number = 0.05;
    var perspective:Number = 130;
    var home:MovieClip = this;
    theText._alpha = 0;
    var tooltip:MovieClip = this.attachMovie("tooltip", "tooltip", 10000);
    tooltip._alpha = 0;
    var xml:XML = new XML();
    xml.ignoreWhite = true;
    xml.onLoad = function() {
    var nodes = this.firstChild.childNodes;
    numOfItems = nodes.length;
    for (var i = 0; i<numOfItems; i++) {
    var t = home.attachMovie("item", "item"+i, i+1);
    t.angle = i
    ((Math.PI2)/numOfItems);
    t.onEnterFrame = mover;
    t.toolText = nodes
    .attributes.tooltip;
    t.content = nodes*.attributes.content;
    t.icon.inner.loadMovie(nodes*.attributes.image);
    //-------
    t.icon.onEnterFrame = function() {
    car = this.inner.getBytesLoaded();
    tot = this.inner.getBytesTotal();
    per = Math.floor(car100/tot);
    if (per == 100) {
    this.percentuale.text = "";
    } else {
    this.percentuale.text = per+"%";
    }
    this._parent.r.percentuale.text = this.percentuale.text;
    };
    //-------
    t.r.inner.loadMovie(nodes
    .attributes.image);
    t.icon.onRollOver = over;
    t.icon.onRollOut = out;
    t.icon.onRelease = released;
    }
    };
    function over() {
    //BONUS Section
    var sou:Sound = new Sound();
    sou.attachSound("sover");
    sou.start();
    home.tooltip.tipText.text = this._parent.toolText;
    home.tooltip._x = this._parent._x;
    home.tooltip._y = this._parent._y-this._parent._height/2;
    home.tooltip.onEnterFrame = Delegate.create(this, moveTip);
    home.tooltip._alpha = 100;
    }
    function out() {
    delete home.tooltip.onEnterFrame;
    home.tooltip._alpha = 0;
    }
    function released() {
    //BONUS Section
    var sou:Sound = new Sound();
    sou.attachSound("sdown");
    sou.start();
    home.tooltip._alpha = 0;
    for (var i = 0; i<numOfItems; i++) {
    var t:MovieClip = home["item"+i];
    t.xPos = t._x;
    t.yPos = t._y;
    t.theScale = t._xscale;
    delete t.icon.onRollOver;
    delete t.icon.onRollOut;
    delete t.icon.onRelease;
    delete t.onEnterFrame;
    if (t != this._parent) {
    var tw:Tween = new Tween(t, "_xscale", Strong.easeOut, t._xscale, 0, 1, true);
    var tw2:Tween = new Tween(t, "_yscale", Strong.easeOut, t._yscale, 0, 1, true);
    var tw3:Tween = new Tween(t, "_alpha", Strong.easeOut, 100, 0, 1, true);
    } else {
    var tw:Tween = new Tween(t, "_xscale", Strong.easeOut, t._xscale, 100, 1, true);
    var tw2:Tween = new Tween(t, "_yscale", Strong.easeOut, t._yscale, 100, 1, true);
    var tw3:Tween = new Tween(t, "_x", Strong.easeOut, t._x, 200, 1, true);
    var tw4:Tween = new Tween(t, "_y", Strong.easeOut, t._y, 320, 1, true);
    var tw5:Tween = new Tween(theText, "_alpha", Strong.easeOut, 0, 100, 1, true);
    theText.text = t.content;
    var s:Object = this;
    tw.onMotionStopped = function() {
    s.onRelease = unReleased;
    };
    }
    }
    }
    function unReleased() {
    //BONUS Section
    var sou:Sound = new Sound();
    sou.attachSound("sdown");
    sou.start();
    delete this.onRelease;
    var tw:Tween = new Tween(theText, "_alpha", Strong.easeOut, 100, 0, 0.5, true);
    for (var i = 0; i<numOfItems; i++) {
    var t:MovieClip = home["item"+i];
    if (t != this._parent) {
    var tw:Tween = new Tween(t, "_xscale", Strong.easeOut, 0, t.theScale, 1, true);
    var tw2:Tween = new Tween(t, "_yscale", Strong.easeOut, 0, t.theScale, 1, true);
    var tw3:Tween = new Tween(t, "_alpha", Strong.easeOut, 0, 100, 1, true);
    } else {
    var tw:Tween = new Tween(t, "_xscale", Strong.easeOut, 100, t.theScale, 1, true);
    var tw2:Tween = new Tween(t, "_yscale", Strong.easeOut, 100, t.theScale, 1, true);
    var tw3:Tween = new Tween(t, "_x", Strong.easeOut, t._x, t.xPos, 1, true);
    var tw4:Tween = new Tween(t, "_y", Strong.easeOut, t._y, t.yPos, 1, true);
    tw.onMotionStopped = function() {
    for (var i = 0; i<numOfItems; i++) {
    var t:MovieClip = home["item"+i];
    t.icon.onRollOver = Delegate.create(t.icon, over);
    t.icon.onRollOut = Delegate.create(t.icon, out);
    t.icon.onRelease = Delegate.create(t.icon, released);
    t.onEnterFrame = mover;
    }
    };
    }
    }
    }
    function moveTip() {
    home.tooltip._x = this._parent._x;
    home.tooltip._y = this._parent._y-this._parent._height/2;
    }
    xml.load("icons.xml");
    function mover() {
    this._x = Math.cos(this.angle)*radiusX+centerX;
    this._y = Math.sin(this.angle)radiusY+centerY;
    var s = (this._y-perspective)/(centerY+radiusY-perspective);
    this._xscale = this._yscale=s
    100;
    this.angle += this._parent.speed;
    this.swapDepths(Math.round(this._xscale)+100);
    }
    this.onMouseMove = function() {
    speed = (this._xmouse-centerX)/2500;
    };

    Per gallery:
    ho utilizzato un component predefinito


  • Super User

    Il tuo problema è in queste righe:

    
    var sou:Sound = new Sound();
    sou.attachSound("sover");
    sou.start();
    
    

    Sintassi esatta ma secondo me ti da problemi se l'swf è caricato da un altro swf perchè quella variabile non è globale.
    Dovresti tenere i files audio in index.swf e richiamarli con le stesse righe al dato evento.


  • User

    Ho provato ad inserire i suoni nell'index ma non funziona ancora.
    Spiego meglio: i suoni che utilizzo in carousel.swf e gallery.swf non li ho salvati sull'Hard Disk ma sono nella libreria e inoltre non sono oggetti sound presenti nella timeline ma caricati attraverso l'Actionscript, come faccio per farli "sentire" all'index?


  • Super User

    Li tieni nella libreria di index e poi li riproduci da codice in index


  • User

    Scusami, ma non riesco proprio a trovare la soluzione;

    ho inserito le variabili nel keyframe in cui carico carousel e gallery, ma non credo sia il punto giusto; dove devo inserire questi codici di preciso?
    C'è il codice globale a cui accennavi nei post precedenti?
    Grazie


  • Super User

    Difficile da dirsi senza vedere l'applicazione.
    Comunque dovresti inserire il codice nel primo keyframe.
    Poi dipende quando vorresti che l'audio venisse riprodotto, cioè se scrivi il codice senza un evento allora appena apri index l'audio viene riprodotto.
    Se invece vuoi riprodurlo durante un evento devi specificare l'evento come ad esempio un onPress() di un bottone oppure al caricamento di swf esterno.
    Quindi se l'evento fosse al caricamento di carousel, all'interno di carousel dovresti chiamare una variabile di tipo Sound in index e fargli riprodurre un suono che lo stesso index ha nella libreria.


  • User

    Ti ringrazio per le pronte risposte che mi hai dato.

    Forse mi sono dimenticato un piccolo particolare, cioè che non sono musiche ma singoli suoni effetto legati agli oggetti di carousel e gallery;
    quindi tu dici che dovrei inserire qualcosa nell'Actionscript di carousel e gallery? Non è che potresti darmi una dritta sul codice da usare per richiamare i suoni della libreria dell'index?


  • User

    Non so se può essere decisivo o meno ma questo benedetto carousel e gallery praticamente sono filmati che vengono caricati su un keyframe di index "vuoto" (nel senso che ho usato la funzione goto)


  • Super User

    Ti faccio un esempio:
    se nel primo frame di index scrivi:

    
    var my_sound:Sound;
    
    

    ora vai in carousel e nel suo primo frame scrivi

    
    trace(_root.my_sound);
    
    

    Il trace dovrebbe dare : object;
    a questo punto sempre in carousel potresti scrivere:

    
    _root.my_sound=new Sound();
    _root.my_sound.attachSound('id_del_sound_nella_libreria_di_index');
    _root.my_sound.start();
    
    

  • User

    Quindi, ricapitoliamo...

    Ho i miei suoni in Index, quello di carousel è "sdown" mentre in gallery ci sono "roll" e "click" (intendi questo per id?)

    Nel primo frame di Index (in un livello actions) metto:
    var my_sound:Sound;

    In carousel metto:
    [LEFT]trace(_root.my_sound);
    [LEFT]_root.my_sound=new Sound();
    _root.my_sound.attachSound("roll");
    _root.my_sound.start();
    [LEFT]_root.my_sound=new Sound();
    _root.my_sound.attachSound("click");
    _root.my_sound.start();

    Così va bene?[/LEFT]
    [/LEFT]
    [/LEFT]


  • User

    Accidenti, non è possibile, a volte cerchi il problema ovunque ed è di una banalità estrema. Adesso funziona tutto, non c'entravano niente i codici, è bastato mettere i suoni nella library di index.fla per far funzionare il tutto!
    Oh, finalmente, thread chiuso.

    :sbonk: