Hi Alexandre,

The problem you're having is because the jquery.flash plugin tries to put the flash movie inside the element you're replacing. So:

<div id="example">Replace Me</div>

becomes:

<div id="example" class="flash-replaced">
    <embed ... />
    Replace Me
</div>

Your test page is trying to replace an <input /> element, which can't contain children. So:

<input type="file" />

becomes:

<input id="example" type="file">
    <embed ... />
    Replace Me
</input>

and the <embed> gets ignored.

The solution is to write a custom replacement function that replaces the <input /> with something that allows child elements:

function replace(htmlOptions) {
    var $el = $('<div></div>');
    $el.addClass('flash-replaced');
    $el.html('<div class="alt">'+this.innerHTML+'</div>');
    $el.prepend($$.transform(htmlOptions));
    jQuery(this)
        .after($el)
        .remove();
};

$('#example').flash({ src: 'jqUploader.swf' }, { version: 8 }, replace);

(I haven't tested the replace function above, but something along those lines should work).

Cheers,
Luke

Alexandre Plennevaux wrote:
ok, i've found out taht in fact, the flash plugin does not accept to replace input fields. Does any jqGenius have an idea why ?

------------------------------------------------------------------------
*From:* jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Alexandre Plennevaux
*Sent:* jeudi 21 juin 2007 21:41
*To:* jquery-en@googlegroups.com
*Subject:* [jQuery] problem using jquery.flash plugin in my plugin

Hello!
i'm trying to switch the dependency of my plugin to a proper jquery plugin dedicated to flash embedding instead of swfobject. Yet i cannot seem to make it work: no error thrown but the element is not replaced by the flash file. here is the schematics of what i do: jQuery.fn.jqUploader = function(options) {
    return this.each(function(index) {
$(this).flash({src: 'jqUploader.swf', width: 320, height: 240}); });
};
i've posted a test suite here: test: http://www.pixeline.be/experiments/jqUploader/test2.php plugin: http://www.pixeline.be/experiments/jqUploader/jquery.jqUploader_proto.js could someone have a look and let me know what i'm doing wrong? And if you would like to see how it should work: http://www.pixeline.be/experiments/jqUploader/test.php Thanks a lot, Alexandre Alexandre Plennevaux pixeline 33 rue Stephenson
B-1030 Brussels
http://www.pixeline.be

Ce message Envoi est certifié sans virus connu.
Analyse effectuée par AVG.
Version: 7.5.472 / Base de données virus: 269.9.1/857 - Date: 20/06/2007 14:18


Ce message Envoi est certifié sans virus connu.
Analyse effectuée par AVG.
Version: 7.5.472 / Base de données virus: 269.9.1/857 - Date: 20/06/2007 14:18

Reply via email to