title: Addressing properties of a Shockwave Flash object (MultiPowUpload) in JavaScript
body: <p>Please pardon the dumb newbie question; I've only been programming Javascript for about 24 hours... :)</p>
  
  <p>I have managed (with some outside help) to embed a shockwave flash object into my page - specifically <a href="http://www.element-it.com/MultiPowUpload.aspx" rel="nofollow noreferrer">MultiPowUpload 2.1</a>.  It's appearing nicely on the page and seems to be functioning correctly; we can take that part as read.</p>
  
  <p>Now I'm trying to do some more advanced stuff in JavaScript - I have a button, and in the <code>onClick()</code> code I have the following:</p>
  
  <pre><code>var swf = document.getElementById("FlashFilesUpload1");
  var itemsCount = swf.filesCount;
  alert("items: "+itemsCount);
  </code></pre>
  
  <p>But the alert statement tells me "items: undefined".  It does the same if I set <code>itemsCount</code> to <code>swf.nonExistentProperty</code> - everything is "undefined".  But from what I read in the <a href="http://www.element-it.com/OnlineHelpMulti/index.html" rel="nofollow noreferrer">documentation</a>, there definitely is a <code>filesCount</code> property.  I tried accessing all the other properties and methods of this swf object, and none of them work, except for <code>toString()</code>, which returns "HTMLObjectElement".</p>
  
  <p>I am obviously addressing this object incorrectly - but what am I doing wrong?</p>
  
  <hr>
  
  <h2>Clarification</h2>
  
  <p>In response to <a href="https://stackoverflow.com/questions/838621/addressing-properties-of-a-shockwave-flash-object-multipowupload-in-javascript/838754#838754">@brianpeiris</a>: I am doing this quite differently from the page at the <a href="http://www.element-it.com/Examples/MultiPowUpload/AdvancedHTMLinterface.html" rel="nofollow noreferrer">link you suggested</a>.  I didn't do this with any great knowledge, I'm just really acting like a monkey, trying to copy other people's code that works, then tweak it so it does what I want... so don't assume I know anything, however obvious - remember, I've only been doing JavaScript for about a day now!</p>
  
  <p>So here's the code for the control itself:</p>
  
  <pre><code>          &lt;object id="FlashFilesUpload1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
            classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" viewastext&gt;
            &lt;!-- Replace symbols " with the &amp;quot; at all parameters values and 
      symbols "&amp;" with the "%26" at URL values or &amp;amp; at other values!
      The same parameters values should be set for EMBED object below. --&gt;
            &lt;param name="FlashVars" value="uploadButtonVisible=false&amp;uploadUrl=../ReceiveBulkCases.aspx" /&gt;
            &lt;param name="BGColor" value="#F8F6E6" /&gt;
            &lt;param name="Movie" value="ClientSideControls/ElementITMultiPowUpload2.1.swf" /&gt;
            &lt;param name="Src" value="ClientSideControls/ElementITMultiPowUpload2.1.swf" /&gt;
            &lt;param name="WMode" value="Window" /&gt;
            &lt;param name="Play" value="-1" /&gt;
            &lt;param name="Loop" value="-1" /&gt;
            &lt;param name="Quality" value="High" /&gt;
            &lt;param name="SAlign" value="" /&gt;
            &lt;param name="Menu" value="-1" /&gt;
            &lt;param name="Base" value="" /&gt;
            &lt;param name="AllowScriptAccess" value="always" /&gt;
            &lt;param name="Scale" value="ShowAll" /&gt;
            &lt;param name="DeviceFont" value="0" /&gt;
            &lt;param name="EmbedMovie" value="0" /&gt;
            &lt;param name="SWRemote" value="" /&gt;
            &lt;param name="MovieData" value="" /&gt;
            &lt;param name="SeamlessTabbing" value="1" /&gt;
            &lt;param name="Profile" value="0" /&gt;
            &lt;param name="ProfileAddress" value="" /&gt;
            &lt;param name="ProfilePort" value="0" /&gt;
            &lt;!-- Embed for Netscape,Mozilla/FireFox browsers support. Flashvars parameters are the same.--&gt;
            &lt;!-- Replace symbols " with the &amp;quot; at all parameters values and symbols "&amp;" with the "%26" at URL values or &amp;amp; at other values! --&gt;
            &lt;embed bgcolor="#F8F6E6" id="EmbedFlashFilesUpload" src="ClientSideControls/ElementITMultiPowUpload2.1.swf"
              quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"
              type="application/x-shockwave-flash" width="450" height="350" flashvars="uploadButtonVisible=false&amp;uploadUrl=../ReceiveBulkCases.aspx"&gt;
  &lt;/embed&gt;
          &lt;/object&gt;
  </code></pre>
  
  <p>As you see it's embedded in the HTML as an <code>object</code>, unlike the reference you gave, where they do some other trick using script to get it onto the page.</p>
  
  <p>BTW, when I tried it their way (not very hard, I grant you), I didn't manage to get the control even to appear on my page!</p>
  
  <p>Thanks for your help... much appreciated</p>