Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 407 Vote(s) - 3.52 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to subscribe to Windows Media Player events without using an extra script tag?

#1
I'm embedding a Windows Media Player control in an HTML page.

<object width="720"
height="480"
id="Player"
classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
<!-- <param> tags left out -->
</object>

To subscribe to events from the control (e.g. [`PlayStateChange(newState)`](

[To see links please register here]

)), I have to add a `<script>` tag, like the following:

<script language="JScript" for="Player" event="PlayStateChange(newState)">
var newStateText = document.createTextNode('' + newState);
var playStateContainer = document.getElementById('PlayState');
while (playStateContainer.firstChild) {
playStateContainer.removeChild(playStateContainer.firstChild);
}
playStateContainer.appendChild(newStateText);
</script>

Isn't there a way to subscribe to these event through plain JavaScript (**without the extra `<script>` tag for every event I'm interested in on every single instance of the control**)?

With 5 instances of the control and 5 events I want too subscribe to, this would be 25 script tags.
Furthermore, the control is wrapped in some library code in an external JavaScript file. The event handling code should be there too, and not in the HTML of the client application.
Reply

#2
According to [this MSDN article](

[To see links please register here]

) (see sections *Naming Conventions* and *Automagic*), you can write all your event handlers inside the same `<script>` tag, provided that you name the functions `objectname::eventname` or `objectname.eventname`:

<script language="JScript">
function Player::playStateChange(newState) {
...
}

function Player.currentPlaylistChange(change) {
...
}
</script>

I didn't try this though. And of course, this is all IE-specific.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through