Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    due flash nella stessa pagina xhtml

    ciao a tutti
    sono appena arrivato nella vostra community
    sto cercando di inserire due filmati flash nella stessa pagina xhtml (uso dreamweaver mx 2004)
    per mantenere il codice compatibile, i filmati swf su due livelli diversi, sono inseriti da un javascript esterno opportunamente linkato nella head
    purtroppo il js carica un filmato e non due
    ho provato a unire i due filmati in un solo flash ma risultano incompatibili e uno impedisce all'altro di rimanere fluido
    grazie in anticipo a chiunque mi aiuti

    nighttrain

  2. #2
    Moderatore di JavaScript L'avatar di br1
    Registrato dal
    Jul 1999
    Messaggi
    19,998
    Benvenuto sul forum
    Una descrizione del problema senza vedere nessuna riga di codice non ci consente di capire se e dove hai sbagliato... devi essere piu' prolisso

    ciao
    Il guaio per i poveri computers e' che sono gli uomini a comandarli.

    Attenzione ai titoli delle discussioni: (ri)leggete il regolamento
    Consultate la discussione in rilievo: script / discussioni utili
    Usate la funzione di Ricerca del Forum

  3. #3
    ok, scusate, provvedo subito.
    questo esempio, con un filmato swf, funziona perfettamente:
    nella pagina xhtml, in head c'è
    <script type="text/javascript" src="flashobject.js"></script>
    e nel body
    <div id="flashbox"></div>
    alla formattazione provvede un css esterno.
    il codice nel js è il seguente:
    window.onload=function(){
    var myFlashObject = new FlashObject("image_loader.swf", "", "600", "400", 6, "#230064");
    myFlashObject.write("flashbox");
    }

    FlashObject = function(swf, id, w, h, ver, c) {
    this.swf = swf;
    this.id = id;
    this.width = w;
    this.height = h;
    this.version = ver || 6; // default to 6
    this.align = "middle"; // default to middle
    this.redirect = "";
    this.sq = document.location.search.split("?")[1] || "";
    this.altTxt = "Please upgrade your Flash Player.";
    this.bypassTxt = "

    Already have Flash Player? Click here if you have Flash Player "+ this.version +" installed.</p>";
    this.params = new Object();
    this.variables = new Object();
    if (c) this.color = this.addParam('bgcolor', c);
    this.addParam('quality', 'high'); // default to high
    this.doDetect = getQueryParamValue('detectflash');
    }

    FlashObject.prototype.addParam = function(name, value) {
    this.params[name] = value;
    }

    FlashObject.prototype.getParams = function() {
    return this.params;
    }

    FlashObject.prototype.getParam = function(name) {
    return this.params[name];
    }

    FlashObject.prototype.addVariable = function(name, value) {
    this.variables[name] = value;
    }

    FlashObject.prototype.getVariable = function(name) {
    return this.variables[name];
    }

    FlashObject.prototype.getVariables = function() {
    return this.variables;
    }

    FlashObject.prototype.getParamTags = function() {
    var paramTags = "";
    for (var param in this.getParams()) {
    paramTags += '<param name="' + param + '" value="' + this.getParam(param) + '" />';
    }
    if (paramTags == "") {
    paramTags = null;
    }
    return paramTags;
    }

    FlashObject.prototype.getHTML = function() {
    var flashHTML = "";
    if (window.ActiveXObject && navigator.userAgent.indexOf('Mac') == -1) { // PC IE
    flashHTML += '<object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" width="' + this.width + '" height="' + this.height + '" id="' + this.id + '" align="' + this.align + '">';
    flashHTML += '<param name="movie" value="' + this.swf + '" />';
    if (this.getParamTags() != null) {
    flashHTML += this.getParamTags();
    }
    if (this.getVariablePairs() != null) {
    flashHTML += '<param name="flashVars" value="' + this.getVariablePairs() + '" />';
    }
    flashHTML += '</object>';
    }
    else { // Everyone else
    flashHTML += '<embed type="application/x-shockwave-flash" src="' + this.swf + '" width="' + this.width + '" height="' + this.height + '" id="' + this.id + '" align="' + this.align + '"';
    for (var param in this.getParams()) {
    flashHTML += ' ' + param + '="' + this.getParam(param) + '"';
    }
    if (this.getVariablePairs() != null) {
    flashHTML += ' flashVars="' + this.getVariablePairs() + '"';
    }
    flashHTML += '></embed>';
    }
    return flashHTML;
    }


    FlashObject.prototype.getVariablePairs = function() {
    var variablePairs = new Array();
    for (var name in this.getVariables()) {
    variablePairs.push(name + "=" + escape(this.getVariable(name)));
    }
    if (variablePairs.length > 0) {
    return variablePairs.join("&");
    }
    else {
    return null;
    }
    }

    FlashObject.prototype.write = function(elementId) {
    if(detectFlash(this.version) || this.doDetect=='false') {
    if (elementId) {
    document.getElementById(elementId).innerHTML = this.getHTML();
    } else {
    document.write(this.getHTML());
    }
    } else {
    if (this.redirect != "") {
    document.location.replace(this.redirect);
    } else {
    if (elementId) {
    document.getElementById(elementId).innerHTML = this.altTxt +""+ this.bypassTxt;
    } else {
    document.write(this.altTxt +""+ this.bypassTxt);
    }
    }
    }
    }

    function getFlashVersion() {
    var flashversion = 0;
    if (navigator.plugins && navigator.plugins.length) {
    var x = navigator.plugins["Shockwave Flash"];
    if(x){
    if (x.description) {
    var y = x.description;
    flashversion = y.charAt(y.indexOf('.')-1);
    }
    }
    } else {
    result = false;
    for(var i = 15; i >= 3 && result != true; i--){
    execScript('on error resume next: result = IsObject(CreateObject("ShockwaveFlash.ShockwaveFla sh.'+i+'"))','VBScript');
    flashversion = i;
    }
    }
    return flashversion;
    }

    function detectFlash(ver) {
    if (getFlashVersion() >= ver) {
    return true;
    } else {
    return false;
    }
    }

    // get value of querystring param
    function getQueryParamValue(param) {
    var q = document.location.search;
    var detectIndex = q.indexOf(param);
    var endIndex = (q.indexOf("&", detectIndex) != -1) ? q.indexOf("&", detectIndex) : q.length;
    if(q.length > 1 && detectIndex != -1) {
    return q.substring(q.indexOf("=", detectIndex)+1, endIndex);
    } else {
    return true;
    }
    }

    fin qui tutto perfetto.
    ora devo inserire il secondo swf in un altro livello che identificherò con un ulteriore div ma non so come fare.
    ho provato con lo stesso js opportunamente modificato per il secondo swf (avevo quindi flashbox1 e flashbox2) con due chiamate js nella head, ma la finestra del browser si apriva vuota mostrando una perenne clessidra in movimento.
    ho provato a far convivere i due filmati flash in un unico file con flash mx 2004 pro, ma si creano problemi di fluidità nella visione (hanno anche due fps diversi, per cui devo adattare la lunghezza dei fotogrammi) e una incorretta visualizzazione degli effetti sul testo che invia a un'altra pagina.
    spero di essere stato esauriente e resto a disposizione per ulteriori chiarimenti.
    grazie ancora.

    ~~~~~~~~~~

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.