FAQ  •  Register  •  Login

Hook XSPF player to a drop down

<<

darran

Posts: 2

Joined: Tue Jul 24, 2007 2:31 pm

Post Tue Jul 24, 2007 2:37 pm

Hook XSPF player to a drop down

Hi,

I`m looking to use XSPF player but I`d like to hook it up to a drop down menu. I was thinking of having a xspf file for each track the changing this dynamically with javascript when the user selects the drop down. This woulod either be by removing the existing flash obejct and creating a new one or ideally updating the existing flash object.

I`m more of a server side Java developer then a front end developer so I wasn`t sure if this is the right idea or if theres a better way of doing this.

Any thoughts on this would be great

thanks
<<

boriel

Site Admin

Posts: 492

Joined: Wed Nov 01, 2006 6:18 pm

Post Tue Jul 24, 2007 10:19 pm

Try AJAX (Javascript)

Darran, I think you can do what you want using some Javascript. If you have a "div" tag within your page with an Id, like this:
  Code:
<div id="playerframe"></div>

then you can insert some html, using something like:
  Code:
<script type="text/javascript">
<!--
playerarea = document.getElementById("playerframe");
playerarea.innerHTML = '<object ....'; // <= Here is the HTML code for the player. Not PHP code
--></script>

If you want this code to change dynamically (that is, the innerHTML), then we call it AJAX :roll: :lol: But it's just asking the server to give you the HTML code you want to insert using the innerHTML property.

I think you can start trying this way.
<<

darran

Posts: 2

Joined: Tue Jul 24, 2007 2:31 pm

Post Wed Jul 25, 2007 7:09 am

Thanks Boriel, thats kinda how I thought of doing it. I just wasn`t sure if it was the best way. Good work on the XSPF player by the way, works like a dream.

Return to XSPF Player Plugin (English)

Who is online

Users browsing this forum: No registered users and 1 guest

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.