Je suis en train de cloner un flash dans ie et de changer une variable pendant que cela. C'est la fonction:Problèmes de clonage d'un objet (.clone) dans IE
$(function() {
$("select[name='variation3']").live('change', function() {
var player = $(this).parent().parent().parent().find('object:first');
if(player.length == 0)
player = $(this).parent().parent().parent().find('.player_not_single, .player_singele');
var $param = player.find("param[name='flashvars']");
var path = player.closest('.post1').attr('data-demo');
//$param.attr('value', $param.attr('value').replace(/soundFile=([^&]+)/, 'soundFile=' + path + $(this).find(':selected').val() + '.mp3'));
$param.attr("value", function(i,v) { return v.replace(/soundFile=([^&]+)/, 'soundFile=' + path + $(this).find(':selected').val() + '.mp3'); });
var new_player = player.clone();
new_player.insertBefore(player);
player.remove();
});
});
En FF cela fonctionne très bien, mais enIE il fait des problèmes. Voici le code avant le clonage:
<object name="audioplayer_1" width="270" height="24" id="audioplayer_1"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
style="outline-style:none; outline-color:invert; outline-width:medium;">
<param name="bgcolor" value="#FFFFFF"/>
<param name="wmode" value="transparent"/>
<param name="menu" value="false"/>
<param name="flashvars" value="animation=no&encode=no&initialvolume=60&remaining=no&noinfo=yes&buffer=3&checkpolicy=no&rtl=no&bg=363635&text=333333&leftbg=4f4f4f&lefticon=787171&volslider=71bced&voltrack=777987&rightbg=4d4d4d&rightbghover=66a7d9&righticon=969696&righticonhover=000000&track=c2bebe&loader=5f91f5&border=000000&tracker=90b7d1&skip=b3b3b3&soundFile=http%3A%2F%2Fwww.gameaudio.net%2Fprelisten%2Fanotherworld%2Ffulledit.mp3&playerID=audioplayer_1"/>
<param name="movie" value="http://www.gameaudio.net/wp-content/plugins/audio-player/assets/player.swf?ver=2.0.4.1"/>
</object>
Et ce code après le clonage:
<object name="audioplayer_1" width="270" height="24" id="audioplayer_1"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
style="outline-style:none; outline-color:invert; outline-width:medium;">
<param name="_cx" value="7143"/>
<param name="_cy" value="635"/>
<param name="FlashVars" value=""/>
<param name="Movie" value="http://www.gameaudio.net/wp-content/plugins/audio-player/assets/player.swf?ver=2.0.4.1"/>
<param name="WMode" value="Transparent"/>
<param name="BGColor" value="FFFFFF"/>
[...]
</object>
Il n'est pas la même chose. Dans certaines parties oui, mais pas tous et esp. les parties les plus importantes sont manquantes. Quelle pourrait être l'erreur?
MISE À JOUR: Voici mon code actuel: « fonction embedAudioPlayer (replaceElemIdStr, audiofile) {
swfobject.embedSWF(
"http://www.gameaudio.net/wp-content/plugins/audio-player/assets /player.swf?ver=2.0.4.1",
replaceElemIdStr,
width,
height,
"9.0.115",
"expressInstall.swf",
{
soundFile: audioFile
});
}
$ (function() {
$ (" sélectionner [ name = 'variation3'] "). live ('change', function() {
player = $(this).parent().parent().parent().find('.player_not_single, .player_singele');
var $param = player.find("param[name='flashvars']");
var path = player.closest('.post1').attr('data-demo');
var audioFile = path + $(this).find(':selected').val() + '.mp3';
var uniqueId = 'audio-' + +new Date;
player.replaceWith('<div id="+uniqueId+"/>');
embedAudioPlayer(uniqueId, audioFile);
}); '
fonction embedAudioPlayer (remplacerElemIdStr, fichier audio) { var swfobject = audioplayer_swfobject;
swfobject.embedSWF ( "http://www.gameaudio.net/wp-content/plugins/audio-player/assets/player.swf?ver=2.0.4.1" replaceElemIdStr, 250, 50, "9.0.115", "expressInstall.swf", { soundFile: fichier audio }); }
$ (function() {
$ ("select [name = 'variation3']") vivre ('changement', la fonction() {
player = $(this).parent().parent().parent().find('.player_not_single, .player_singele');
var $param = player.find("param[name='flashvars']");
var path = player.closest('.post1').attr('data-demo');
var audioFile = path + $(this).find(':selected').val() + '.mp3';
var uniqueId = 'audio-' + +new Date;
player.replaceWith('<div id="+uniqueId+"/>');
embedAudioPlayer(uniqueId, audioFile);
.});
Mise à jour:
` fonction embedAudioPlayer (replaceElemIdStr, audiofile) {var swfobject = audioplayer_swfobject;
swfobject.embedSWF ( "http://www.gameaudio.net/wp-content/plugins/audio-player/assets/player.swf?ver=2.0.4.1" replaceElemIdStr, 250, 50, "9.0.115", "expressInstall.swf", { soundFile: fichier audio }); }
$ (function() {
$ ("sélectionnez [name = 'variation3']").vivre ('changement', la fonction() {
player = $(this).parent().parent().parent().find('.player_not_single, .player_singele');
var $param = player.find("param[name='flashvars']");
var path = player.closest('.post1').attr('data-demo');
var audioFile = path + $(this).find(':selected').val() + '.mp3';
var uniqueId = 'audio-' + +new Date;
player.replaceWith('<div id="+uniqueId+"/>');
embedAudioPlayer(uniqueId, audioFile);
}); `
Souhaitez-vous publier une URL à un exemple de page avec ce problème? –