embed and DOM

hi everybody,

first, thank's Toddos, because i 've built a second flash games gadgets with all the rules you've told me....and it works very well.

so, so, excellent teacher you are....

i have another problem

I push flash in my gadget in embed tags using this way :

initializeBase :
var swf = m_module.resolveUrl("swf/foo.swf");
initialize :
Divglobal = document.createElement('div');
Divglobal.className = 'Divglobal';
Divglobal.innerHTML= "<embed src="+swf+" type=\"application/x-shockwave-flash\" width='250px' height='250px'>";
p_elSource.appendChild(Divglobal);

This works well but i would like to bypass the innerHtml method, with a DOM method , for ex :

source = document.createElement('embed');
source.className = .........

but i would like to use the DOM to built the embed elements, and i tried different ways, i searched examples on the web, and, up to now, i've found nothing wich is working properly.

Is there a different way i did'nt find

thank you for your answers i hope

albidochon



Answer this question

embed and DOM

  • Shadow Chaser

    Mostly because I haven't run into a need for Flash lately :).

    As for the pluginspage attribute, that just tells the browser where to send the user if they don't have the plugin already installed.  You can do without it, or you can try setting it indirectly with setAttribute().


  • Coggsa

    hi toddos,

    i spend a part of the nigth, and....DOM with a embed create element works...

    http://albidochon.free.fr/embed/gadget.xml

    for the getBaseMethod of p_objscope, i tried :

    Divglobal = document.createElement('div');
    Divglobal.className = 'Divglobal';
    p_elSource.appendChild(Divglobal);
      
      source = document.createElement('embed')
      source.src =  m_module.resolveUrl("boum.swf");
      source.title = 'This is a clock';
      //source.pluginspage = m_module.resolveUrl("http://www.macromedia.com/go/getflashplayer");
      source.width= '250px';
      source.height = '250px';
      source.textAlign = 'center';
      source.type = 'application/x-shockwave-flash';
      Divglobal.appendChild(source);

    The Attributes/Properties pluginspage doesn't work, but it works without this attribute....May be some attributes are unusefull, but i tried all to see which one were workin

    "The NAME attribute cannot be set at run time on elements dynamically created with the createElement method. To create an element with a name attribute, include the attribute and value when using the createElement method" (from the MSND library)

    may be it's enough, may be you can find better way to adjust more attributes ....

    tell me

    thank's Mister Toddos

    albidochon


  • geoff hirst

    hi toddos,

    you did'nt tell me about the issue i found on including embed in dom....so i wonder why....

    albidochon


  • Ricardo Pinto

    <embed> is one of the few cases where I've been unsuccessful using DOM creation. It should be possible, but I've never gotten it to work. Thus in the gadgets where I've used Flash, I've used the innerHTML approach.
  • embed and DOM