Ma lighbox n'affiche pas mon flash sous IE

Signaler
Messages postés
1
Date d'inscription
lundi 24 novembre 2008
Statut
Membre
Dernière intervention
26 janvier 2012
-
ma lighbox n'affiche pas mon flash sous IE

Messagede nickos007 » Jeu 26 Jan, 2012 10:23 am
Bonjour,

j'ai fait une lightbox qui affiche une animation swf au chargement de page html, de maniere automatique.
Mais sous internet explorer l'animation ne se charge pas et quand je click droit dessus c'est marqué "animation non chargée"
je ne voit pas ou se trouve le pb

voici mon fichier html
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns= "http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Test lightbox-auto</title>
    <link rel="stylesheet" href="skins/darkbox/darkbox.css" type="text/css"
    media="screen"/>
    <script type="text/javascript" src="ibox.js"></script>

    <script type="text/javascript">//<![CDATA[


    // Création d'un élément XHTML object
    function createSWF(url,width,height){
    var SWFObj,Param,e;

    try{
    SWFObj=document.createElement('object');
    SWFObj.setAttribute('type','application/x-shockwave-flash');
    SWFObj.setAttribute('pluginspage','http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash');
    SWFObj.setAttribute('data',url);
    SWFObj.setAttribute('name',url);
    SWFObj.setAttribute('width',width);
    SWFObj.setAttribute('height',height);
    Param=document.createElement('param');
    Param.setAttribute('movie',url);
    Param.setAttribute('value',url);
    Param.setAttribute('quality','height');
    SWFObj.appendChild(Param);

    return SWFObj;
    }catch(e){
    try{
    if(SWFObj){
    while(SWFObj.hasChildNodes())SWFObj.removeChild(SWFObj.lastChild);
    }
    }catch(e){}
    }
    return false;
    }

    window.onload=function(){
    var swf=createSWF('http://www.alteriade.fr/carte_voeux_2012.swf',534,285);
    swf

    // Ajoute l'object Flash dans l'arbre DOM à afficher dans la boite
    iBox.show(
    swf,

    '',// lien conduisant à l'animation complete si il ya lieu
    {
    width:534,
    height:285

    }
    );

    // Cacher la boite après 20 secondes
    setTimeout(
    function(){iBox.hide();}
    ,20000
    );
    };
    //]]>
    </script>


    </head>

    
    c'est reussi mwahahahahahahahaha 


    
    </html>

et mon script ibox:
    /**
    * iBox 2.2 (Build 1612)
    * For more info & download: http://www.ibegin.com/labs/ibox/
    * Created as a part of the iBegin Labs Project - http://www.ibegin.com/labs/
    * For licensing please see readme.html (MIT Open Source License)
    */
    var iBox = function() {
    var _pub = {
    // label for the close link
    close_label: ' Cliquez ici pour me fermer ',

    // show iframed content in the parent window
    // this *does not* work with #containers
    inherit_frames: false,

    // how fast to fade in the overlay/ibox (this is each step in ms)
    fade_in_speed: 300,
    fade_out_speed: 300,

    // our attribute identifier for our iBox elements
    attribute_name: 'rel',

    // tags to hide when we show our box
    tags_to_hide: ['select', 'embed', 'object', 'param'],

    // default width of the box (when displaying html only)
    // height is calculated automatically
    default_width: 534,

    // public version number
    version_number: '2.2',
    // internal build number
    build_number: '1612',


    // browser checks
    is_opera: navigator.userAgent.indexOf('Opera/9') ! = -1,
    is_ie: navigator.userAgent.indexOf("MSIE ") != -1,
    is_ie6: false /*@cc_on || @_jscript_version < 5.7 @*/,
    is_firefox: navigator.appName == "Netscape" && navigator.userAgent.indexOf("Gecko") != -1 && navigator.userAgent.indexOf("Netscape") == -1,
    is_mac: navigator.userAgent.indexOf('Macintosh') != -1,





    // url for including images/external files
    base_url: '',
    //url:'swf/Menu_papillon.swf',

    /**
    * Updates the base_url variable.
    * @param {String} path Relative or absolute path to this file.
    */
    setPath: function(path) {
    _pub.base_url = path;
    },



    /**
    * Checks a container for specified tags containing rel="ibox"
    * @param {Object} container
    * @param {String} tag_name
    */
    checkTags: function(container, tag_name) {
    if (!container) var container = document.body;
    if (!tag_name) var tag_name = 'a';
    var els = container.getElementsByTagName(tag_name);
    for (var i=0; i<els.length; i++) {
    if (els[i].getAttribute(_pub.attribute_name)) {
    var t = els[i].getAttribute(_pub.attribute_name);
    if ((t.indexOf("ibox") !-1) || t.toLowerCase() "ibox") { // check if this element is an iBox element
    els[i].onclick = _pub.handleTag;
    }
    }
    }
    },

    /**
    * Binds arguments to a callback function
    */
    bind: function(fn) {
    var args = [];
    for (var n=1; n x) {
    if (active.params.constrain) height = height * (x/width);
    width = x;
    }
    if (height > y) {
    if (active.params.constrain) width = width * (y/height);
    height = y;
    }
    _pub.updateObject(els.wrapper.style, {width: width + 'px', height: height + 'px'});
    }

    //els.content.style.width = width - offset.wrapper[0] + 'px';
    // TODO: this isn't adjusting to the right height for containers that are smaller than the page height
    // resize the wrappers height based on the content boxes height
    // this needs to be height - ibox_content[margin+padding+border]
    els.content.style.height = height - offset.wrapper[1] + 'px';
    if (active.dimensions != ['100%', '100%']) _pub.center(els.wrapper);
    }

    // fix overlay width/height (cant use css fixed on ie6 or fx or any
    // browser really due to issues)
    els.overlay.style.height = Math.max(document.body.clientHeight, document.documentElement.clientHeight) + 'px';
    },

    updateObject: function(obj, params) {
    for (var i in params) obj[i] = params[i];
    },

    /**
    * Centers an object
    * @param {Object} obj
    */
    center: function(obj) {
    var pageSize = _pub.getPageSize();
    var scrollPos = _pub.getScrollPos();
    var emSize = _pub.getElementSize(obj);
    var x = Math.round((pageSize.width - emSize.width) / 2 + scrollPos.scrollX);
    var y = Math.round((pageSize.height - emSize.height) / 2 + scrollPos.scrollY);
    if (obj.offsetLeft) x -= obj.offsetLeft;
    if (obj.offsetTop) y -= obj.offsetTop;
    if (obj.style.left) x += parseInt(obj.style.left);
    if (obj.style.top) y += parseInt(obj.style.top);
    // this nearly centers it due to scrollbars
    x -= 10;
    _pub.updateObject(obj.style, {top: y + 'px', left: x + 'px'});
    },

    getStyle: function(obj, styleProp) {
    if (obj.currentStyle)
    return obj.currentStyle[styleProp];
    else if (window.getComputedStyle)
    return document.defaultView.getComputedStyle(obj,null).getPropertyValue(styleProp);
    },

    /**
    * Gets the scroll positions
    */
    getScrollPos: function() {
    var docElem = document.documentElement;
    return {
    scrollX: document.body.scrollLeft || window.pageXOffset || (docElem && docElem.scrollLeft),
    scrollY: document.body.scrollTop || window.pageYOffset || (docElem && docElem.scrollTop)
    };
    },

    /**
    * Gets the page constraints
    */
    getPageSize: function() {
    return {
    width: window.innerWidth || (document.documentElement && document.documentElement.clientWidth) || document.body.clientWidth,
    height: window.innerHeight || (document.documentElement && document.documentElement.clientHeight) || document.body.clientHeight
    };
    },

    /**
    * Gets an objects offsets
    * @param {Object} obj
    */
    getElementSize: function(obj) {
    return {
    width: obj.offsetWidth || obj.style.pixelWidth,
    height: obj.offsetHeight || obj.style.pixelHeight
    };
    },

    fade: function(obj, start, end, speed, callback) {
    if (start === undefined || !(start >= 0) || !(start <= 100)) var start = 0;
    if (end === undefined || !(end >= 0) || !(end <= 100)) var end = 100;
    if (speed undefined) var speed 0;

    if (obj.fader) clearInterval(obj.fader);

    if (!speed) {
    _pub.setOpacity(null, obj, end);
    if (callback) callback();
    }

    var opacity_difference = end - start;
    var time_total = speed; // time is speed (jQuery compat)
    var step_size = 25; // step size in ms
    var steps = time_total / step_size; // total number of steps
    var increment = Math.ceil(opacity_difference / steps); // how much to incr per step

    obj.fader = setInterval(_pub.bind(function(e, obj, increment, end, callback) {
    var opacity = _pub.getOpacity(e, obj) + increment;
    _pub.setOpacity(e, obj, opacity);
    if ((increment < 0 && opacity <= end) || (increment > 0 && opacity >= end)) {
    _pub.setOpacity(e, obj, end);
    clearInterval(obj.fader);
    if (callback) callback();
    }
    }, obj, increment, end, callback), step_size);
    },

    /**
    * Sets the opacity of an element
    * @param {Object} obj
    * @param {Integer} value
    */
    setOpacity: function(e, obj, value) {
    value = Math.round(value);
    obj.style.opacity = value/100;
    obj.style.filter = 'alpha(opacity=' + value + ')';
    },

    /**
    * Gets the opacity of an element
    * @param {Object} obj
    * @return {Integer} value
    */
    getOpacity: function(e, obj) {
    return _pub.getStyle(obj, 'opacity')*100;
    },

    /**
    * Creates a new XMLHttpRequest object based on browser
    */
    createXMLHttpRequest: function() {
    var http;
    if (window.XMLHttpRequest) { // Mozilla, Safari,...
    http = new XMLHttpRequest();
    if (http.overrideMimeType) {
    // set type accordingly to anticipated content type
    http.overrideMimeType('text/html');
    }
    }
    else if (window.ActiveXObject) { // IE
    try {
    http = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
    try {
    http = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {}
    }
    }
    if (!http) {
    alert('Cannot create XMLHTTP instance');
    return false;
    }
    return http;
    },

    addEvent: function(obj, evType, fn) {
    if (obj.addEventListener) {
    obj.addEventListener(evType, fn, false);
    return true;
    }
    else if (obj.attachEvent) {
    var r = obj.attachEvent("on"+evType, fn);
    return r;
    }
    else {
    return false;
    }
    },

    addEventListener: function(name, callback) {
    if (!events[name]) events[name] = new Array();
    events[name].push(callback);
    },

    /**
    * Causes all event listeners attached to `name` event to
    * execute.
    * @param {String} name Event name
    */
    fireEvent: function(name) {
    if (events[name] && events[name].length) {
    for (var i=0; i<events[name].length; i++) {
    var args = [];
    for (var n=1; n'+default_skin+'</style>';
    head.insertBefore(htmDiv.childNodes[1], head.firstChild);

    htmDiv.innerHTML = 'x

<style type="text/css">'+core_styles+'</style>';
    head.insertBefore(htmDiv.childNodes[1], head.firstChild);
    };

    var _initialized = false;
    var initialize = function() {
    // make sure we haven't already done this
    if (_initialized) return;
    _initialized = true;
    // elements here start the look up from the start non  tags
    drawCSS();
    var els = document.getElementsByTagName('script');
    var src;
    for (var i=0, el=null; (el = els[i]); i++) {
    if (!(src = el.getAttribute('src'))) continue;
    src = src.split('?')[0];
    if (src.substr(src.length-8) == '/ibox.js') {
    _pub.setPath(src.substr(0, src.length-7));
    break;
    }
    }
    create(document.body);
    _pub.checkTags(document.body, 'a');
    _pub.http = _pub.createXMLHttpRequest();
    _pub.fireEvent('load');
    };

    _pub.addEvent(window, 'keypress', function(e){ if (e.keyCode == (window.event ? 27 : e.DOM_VK_ESCAPE)) { iBox.hide(); }});
    _pub.addEvent(window, 'resize', _pub.reposition);
    _pub.addEvent(window, 'load', initialize);
    _pub.addEvent(window, 'scroll', _pub.reposition);

    // DEFAULT PLUGINS

    /**
    * Handles embedded containers in the page based on url of #container.
    * This _ONLY_ works with hidden containers.
    */
    var iBoxPlugin_Container = function() {
    var was_error = false;
    var original_wrapper = null;
    return {
    /**
    * Matches the url and returns true if it fits this plugin.
    */
    match: function(url) {
    return url.indexOf('#') != -1;
    },
    /**
    * Called when this plugin is unloaded.
    */
    unload: function() {
    if (was_error) return;
    var elemSrc = _pub.html().firstChild;
    if (elemSrc) {
    elemSrc.style.display = 'none';
    original_wrapper.appendChild(elemSrc);
    }
    },
    /**
    * Handles the output
    * @param {iBox} ibox
    * @param {String} url
    * @return {iBoxContent} an instance or subclass of iBoxContent
    */
    render: function(url, params) {
    was_error = false;
    var elemSrcId = url.substr(url.indexOf("#") + 1);
    var elemSrc = document.getElementById(elemSrcId);
    // If the element doesnt exist, break the switch
    if (!elemSrc) {
    was_error = true;
    _pub.html(document.createTextNode('There was an error loading the document.'), params);
    }
    else {
    original_wrapper = elemSrc.parentNode;
    elemSrc.style.display = 'block';
    _pub.html(elemSrc, params);
    }
    }
    }
    }();
    _pub.plugins.register(iBoxPlugin_Container, true);

    /**
    * Handles images
    */
    var iBoxPlugin_Image = function() {
    // Image types (for auto detection of image display)
    var image_types = /\.jpg|\.jpeg|\.png|\.gif/gi;

    return {
    match: function(url) {
    return url.match(image_types);
    },

    render: function(url, params) {
    var img = document.createElement('img');
    img.onclick = _pub.hide;
    img.className = 'ibox_image'
    img.style.cursor = 'pointer';
    img.onload = function() {
    _pub.html(img, {width: this.width, height: this.height, constrain: true})
    }
    img.onerror = function() {
    _pub.html(document.createTextNode('There was an error loading the document.'), params);
    }
    img.src = url;
    }
    }
    }();
    _pub.plugins.register(iBoxPlugin_Image);

    var iBoxPlugin_YouTube = function() {
    var youtube_url = /(?:http:\/\/)?(?:www\d*\.)?(youtube\.(?:[a-z]+))\/(?:v\/|(?:watch(?:\.php)?)?\?(?:.+&)?vsmile([^&]+).*/;
    return {
    match: function(url) {
    return url.match(youtube_url);
    },

    render: function(url, params) {
    var _match = url.match(youtube_url);
    var domain = _match[1];
    var id = _match[2];
    params.width = 425;
    params.height = 355;
    params.constrain = true;
    var html = '<object width="100%" height="100%" style="overflow: hidden; display: block;"></object>';
    _pub.html(html, params);
    }
    }
    }();
    _pub.plugins.register(iBoxPlugin_YouTube);

    var iBoxPlugin_Document = function() {
    return {
    match: function(url) {
    return true;
    },

    render: function(url, params) {
    _pub.http.open('get', url, true);

    _pub.http.onreadystatechange = function() {
    if (_pub.http.readyState == 4) {
    // XXX: why does status return 0?
    if (_pub.http.status 200 || _pub.http.status 0) {
    _pub.html(_pub.http.responseText, params);
    }
    else {
    _pub.html(document.createTextNode('There was an error loading the document.'), params);
    }
    }
    }
    _pub.http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
    try {
    _pub.http.send(null);
    }
    catch (ex) {
    _pub.html(document.createTextNode('There was an error loading the document.'), params);
    }
    }
    };
    }();
    _pub.plugins.register(iBoxPlugin_Document, true);

    return _pub;
    }();