0

I'm trying to achieve the following:

I have a javascript object that fetches two flash objects. The two flash objects are then added to the page, the first one I set with play=true and the second one I set with play=false.

I'm presenting the one with play=true right after download, and placing the other with play=false in an hidden container.

When I press the first one it interacts with my javacsript and in turn the js code hides the first flash div container and changes the second flash (the hidden one) div container to be shown.

With that being done I also change the play attribute of this flash from false to true so it will start playing. The two actions, changing DOM visibility and changing the play attribute to true, are done in two different setTimeout functions (design constraint!).

The issue I have is that on IE10 on WIN8 the flash object doesn't adhere to the play command. To be more exact with my actions, I'm fetching the flash obj using: var myObj = document.getElementById("MY_OBJ_ID"), and then I try to set the play to true by doing myObj.Play(); using the standard Play() method flash exposes. Off course I check that the object exist before excuting the Play().

In addition, after I press the first flash that suppose to set all of the above in motion, and nothing happens... If I write the same lines manually in the console:

var myObj = document.getElementById("MY_OBJ_ID");
myObj.Play();

Then the movie plays and everything works.

And I'll mention again, this happens only on IE10 on WIN8. I'll appreciate any assistance with this issue, I'm breaking my back over this and can't figure it out.

Update - 30/06:

I think I figured out the issues somewhat, the play is not occurring indeed. In IE 10 you can query the flash obj with flashObj.Playing attribute and I see that it's returning false. In that case I just call the function with setTimeout and every time and check the attribute status until it's true. But I see that this attribute is not valid in other browser, and in all browsers there's another API function - flashObj.IsPlaying().

Is there a cross-browser implementation that will let me check if a flash object is in playing state or not? Let's say something like this:

flashObj.TGetPropertyAsNumber("/", 4) >= 1) || flashObj["IsPlaying"]()

It will check if the first frame or even more has already been played, or check if the "IsPlaying" is returning true?

Update - 01/07: Well, the above method proved to work correctly on all browsers, so my issue is somewhat resolved. In order to know if the flash player has loaded I need to preform the above check and if the flash isn't loaded I call the function I use to set play again with setTimeout.

But I'm still perplexed from IE10 on WIN8 behavior. I don't understand why the flashObj.Play() works first time on all browsers first time I call it and in IE10 I need to do setTimeout for this to work.

Oren.Me
  • 81
  • 1
  • 5
  • When the problem happens, is `document.getElementById("MY_OBJ_ID")` returning the Flash object, something else, or nothing? – Sunil D. Jun 27 '13 at 16:14
  • Yes, it does. I verify it each time. I update the question with additional info. – Oren.Me Jun 30 '13 at 05:23

0 Answers0