nageeb2016 / swfobject

Automatically exported from code.google.com/p/swfobject
0 stars 0 forks source link

Flex call to Application.application.id returning null #493

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a Flex object that uses Application.application.id
2. Load that object onto the page using swfobject

What is the expected output?
  Application.application.id returns the ID of the flash object.

What do you see instead?
  Application.application.id returns null.

What version of the product are you using?
   swfobject 2.2

On what operating system?
   windows 7

On what browsers?
   firefox 3.6.8, Chrome 5.0.375.126, Safari 5.0.1

Please provide any additional information below.
  Application.application.id works correct in IE8 with the current implementation of swfobject.
  If I manually add the object to the page and include an embed element in the object Application.application.id returns the ID set in the embed in the browsers listed above.

Original issue reported on code.google.com by tucker...@gmail.com on 17 Aug 2010 at 7:42

GoogleCodeExporter commented 9 years ago
The same goes for ExternalInterface.objectID

Original comment by tucker...@gmail.com on 17 Aug 2010 at 8:19

GoogleCodeExporter commented 9 years ago
From the action script docs for flash.external.ExternalInterface:
objectID : String
[static] [read-only] Returns the id attribute of the object tag in Internet 
Explorer, or the name attribute of the embed tag in Netscape.

Original comment by tucker...@gmail.com on 30 Aug 2010 at 2:45

GoogleCodeExporter commented 9 years ago
After playing with the object element some more I found that if you put a name 
attribute in the object element for Firefox, objectID and id work as expected.

Original comment by tucker...@gmail.com on 13 Sep 2010 at 10:59

GoogleCodeExporter commented 9 years ago
Adding the name attribute worked in Firefox and Chrome, but not in Safari. To 
get it to work in Safari, I added an embed tag with just the name attribute:

I did this using the callback in swfobject:
swfobject.embedSWF(
  ... all other params ...,
  // callback
  function (e) {
    if (e.success) {
      var flash = $(e.ref);
      // mozilla and webkit
      if ($.browser.webkit || $.browser.mozilla) {
        // add name attribute
        flash.attr('name', e.id);
      }
      if ($.browser.webkit) {
        // add embed element
        flash.append('<embed name=" + e.id + " />');
      }
    }
  }
);

Original comment by JNSal...@gmail.com on 20 Jan 2011 at 5:59

GoogleCodeExporter commented 9 years ago
Guys, did you try adding the id/name properties using the attributes object as 
per the docs in swfobject? This will add the id and name attributes in the 
<object> tag which is required for ExternalInterface etc

<script type="text/javascript">

var flashvars = {
  name1: "hello",
  name2: "world",
  name3: "foobar"
};
var params = {
  menu: "false"
};
var attributes = {
  id: "myDynamicContent",
  name: "myDynamicContent"
};

swfobject.embedSWF("myContent.swf", "myContent", "300", "120", 
"9.0.0","expressInstall.swf", flashvars, params, attributes);

</script>

SWFObject never generates an <embed> tag...

Original comment by aran.rhee@gmail.com on 20 Jan 2011 at 4:14

GoogleCodeExporter commented 9 years ago
Yes that is what I ended up doing.

Original comment by tucker...@gmail.com on 21 Jan 2011 at 2:09

GoogleCodeExporter commented 9 years ago
I'm closing this issue then

Original comment by aran.rhee@gmail.com on 21 Jan 2011 at 4:44