View Full Version : Array problem

03-12-2012, 03:35 AM
What's wrong with this? :(

<!--SCM Music Player by Adrian C Shum - http://scmplayer.net-->
<script type="text/javascript" src="http://scmplayer.net/script.js" ></script>
<script type="text/javascript">
var Nasyeed = [{'title':'Qasidah Burdah','url':'http://www.youtube.com/watch?v=tsk9LPDsgsA'},{'title':'Sahabat Sejati','url':'http://www.youtube.com/watch?v=6-OtuuV9IqA'},{'title':'Sebuah Pertemuan','url':'http://www.youtube.com/watch?v=ajmN6ByXnJY'},{'title':'Kau Sahabat Kau Teman','url':'http://www.youtube.com/watch?v=NcEyGU8eB2M'},{'title':'Doa Perpisahan','url':'http://www.youtube.com/watch?v=lOaTAV2_ibM'}];
var Song = [{'title':'A Shoulder To Cry On','url':'http://www.youtube.com/watch?v=nSJ3sSxv0yg'},{'title':'All Out Of Love','url':'http://www.youtube.com/watch?v=yr3dJxeT4oA'},{'title':'Take My Heart','url':'http://www.youtube.com/watch?v=eXoIbbE1KXs'},{'title':'Perfect Two','url':'http://www.youtube.com/watch?v=-lLvtydTM78'},{'title':'A Drop In The Ocean','url':'http://www.youtube.com/watch?v=mt8jifKlbTc'}];
var Percent = Math.floor(Math.random()*100);
var selected;
if (Percent >= 50)
selected = Nasyeed;
selected = Song;
<!--End of SCM Music Player script-->

03-12-2012, 04:33 AM
What's wrong with this? :(

there is no explanation of what you want to happen, or what problems you're having.

Your question is unclear.
Please provide more information, and be as specific as possible.
What do you want to accomplish? What have you already tried? What problems did you encounter?
Also, please be sure that you have included all relevant code and/or a link to the page in question.

Please post a link to the page on your site that contains the problematic script so we can check it out.

Without more information, we can only guess.
Maybe you're trying to pass an object to SCMMusicPlayer.init() (currently, you're passing a string)?
(also, in that string, you have 'playlist':selected (no quotes around the value) - might be part of it.)

03-12-2012, 04:37 AM
There's nothing intrinsically wrong in that code, at least nothing that jumps out at me. I don't like the idea of using a String to represent an Object, but that's not my call as it appears to be code for the SCM Music Player by Adrian C Shum. As such it was/should have been generated by the SCM Music Player Setup Wizard. Any attempt to edit it after it's generated is not advised. If you need to edit it (from SCM Music Player website):

You can select "Import Profile" (Bottom left of Setup Wizard) to import your existing SCM code into the setup wizard. After done editing, copy and paste the new code to replace the old one.

03-12-2012, 04:50 AM
Thanks for the advice. I thought if I edit the code I would make what I wanted it to be.

03-12-2012, 05:17 AM
What about it were you trying to change? What did the code look like before when it was working?