473,666 Members | 2,038 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XML / Flash Mp3 player playlist problem

6 New Member
Hey there.
I am learning XML and Actionscript.
I have a problem with getting my XML data to load when my SWF is in an HTML page in a browser. When I open the SWF on it's own whether in Flash Player or browser, my playlist of songs comes up. But in the HTML page it's a no go. Here is what my XML looks like:

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" ?>
  2. <playlist>
  3.     <song title="Alliance" artist="Jack Hammer & B Mac" src="../content/music/Alliance.mp3" />
  4.     <song title="Black Friday" artist="King Gregor" src="../content/music/BlackFriday.mp3" />
  5.     <song title="A Dangerous Man" artist="Jack Hammer" src="../content/music/DangerousMan.mp3" />
  6. </playlist>
And my actionscript, which admittedly I did copy and paste from a tutorial and have little idea of how it all works, I just know that it doesn't:

Expand|Select|Wrap|Line Numbers
  1. XMLNode.prototype.moveBefore = function(beforeNode){
  2.     if (this == beforeNode) return (0);
  3.     beforeNode.parentNode.insertBefore( this.cloneNode(true), beforeNode);
  4.     this.removeNode();
  5. }
  6. Clamp = function(min, n, max){
  7.     if (n<min) return min;
  8.     if (n>max) return max;
  9.     return n;
  10. }
  11.  
  12.  
  13.  
  14. var song_spacing = 20;
  15. var over_node;
  16. GenerateSongListing = function(playlist_xml, target_mc){
  17.  
  18.     target_mc = target_mc.createEmptyMovieClip("list_mc",1);
  19.  
  20.     var songs = playlist_xml.firstChild.childNodes;
  21.     for (var i=0; i<songs.length; i++){
  22.         var song_mc = target_mc.attachMovie("song", "song"+i, i);
  23.         song_mc._y = i*song_spacing;
  24.  
  25.         song_mc.node = songs[i];
  26.         song_mc.title_txt.text = songs[i].attributes.title;
  27.         song_mc.moved = false;
  28.  
  29.         song_mc.select_btn.onPress = function(){
  30.             this._parent.onMouseMove = function(){
  31.                 if (!this.moved){
  32.                     dragline_mc._visible = true;
  33.                     dragline_mc._y = playlist_mc._y + this._y;
  34.                     highlight_mc._visible = true;
  35.                     highlight_mc._y = playlist_mc._y + this._y;
  36.                     this.moved = true;
  37.                 }
  38.             }
  39.         }
  40.  
  41.         song_mc.select_btn.onDragOver = function(){
  42.             over_node = this._parent.node;
  43.             dragline_mc._y = playlist_mc._y + this._parent._y;
  44.         }
  45.  
  46.         song_mc.onMouseUp = function(){
  47.             if (this.onMouseMove){
  48.                 delete this.onMouseMove;
  49.                 dragline_mc._visible = false;
  50.                 highlight_mc._visible = false;
  51.                 if (this.moved){
  52.                     this.node.moveBefore(over_node);
  53.                     GenerateSongListing(playlist_xml, playlist_mc);
  54.                 }
  55.             }
  56.         }
  57.  
  58.         song_mc.select_btn.onRelease = function(){
  59.             if (!this._parent.moved){
  60.                 SetSong(this._parent.node);
  61.             }
  62.         }
  63.  
  64.     }
  65. }
  66.  
  67.  
  68. var playlist_xml = new XML();
  69. playlist_xml.contentType = "text/xml";
  70. playlist_xml.ignoreWhite = true;
  71. playlist_xml.onLoad = function(success){
  72.     if (success){
  73.         GenerateSongListing(this, playlist_mc);
  74.     }else trace("Error loading XML file"); // no success?  trace error (wont be seen on web)
  75. }
  76. playlist_xml.load("../xml/playlist.xml");
  77.  
  78. dragline_mc._visible = false;
  79. highlight_mc._visible = false;
  80.  
I'm sure it's just a simple issue. Something that I'm not aware of or haven't done properly. I'm a total newbie with XML and Actionscript and have tried most everything I could think of but so far no answers. Can anyone help?

Cheers.

Jack.
Jul 5 '08 #1
0 2351

Sign in to post your reply or Sign up for a free account.

Similar topics

3
3039
by: steve | last post by:
Sir, Unable to compile this xine player code on visual C++ on windows xp environoment is it only for Linux it is not an assignment. code downloaded from web is as follows /* * Copyright (C) 2000-2002 the xine project
1
3694
by: manoj | last post by:
hi, I am developing a Player like windows media player. I added some components from WMP. I want to load a playlist directly when .wpl file is loaded , can some one tell me how to do it. for example to add a song :: Playlist.appendItem(Player.newmedia(url)));
1
14631
by: Sirmarty | last post by:
I am using the visual express edition 20005 for C#. I am trying to write a program which will randomly play songs weighted by a 0 to 100 rating scale. I can player a single song using the windows media player, but I cnnot play music continuously. I need to either add an event handler which is triggered by the end of a song, be able to loop while a song is being played while testing for the end of the song or be able to add a playlist of...
19
19253
by: Tony | last post by:
I'm working on project that plays movies using Windows Media Player and I'm controlling everything with JavaScript. Per the client I only need to support IE 6 or greater which happens to make things a bit easier. What I need to do is create a playlist and play it using JavaScript. I keep on getting close but not close enough to play the dang files. Has anyone done this before and can shed some light on what worked for them?
3
2913
by: alice | last post by:
I've been trying for a long time to figure this out, to have a page with several MP3 clips, and each one having a custom start and stop button next to them to play the track. I finally found a bit of code that does this, but it's made for only one mp3 file. I don't know enough about javascript to customize the code myself. I know there probably needs to be an "array" of some sort, but I need some help figuring out where and how that works....
1
3524
by: Ringo | last post by:
I'm trying to use windows media player in an app. I can give it an mp3 and it plays it, but if I give it a playlist it will not play and even the play button on the control is not active. btn_open_mediaFile works fine, tn_open_playlist acts likes nothing happened except I see the name of the playlist. What am I missing? Also, if an mo3 is playing, loading a playlist stops it from playing. here is my code
0
2805
by: crisscross27 | last post by:
Hi, I found a page called "myflashfetish" where you chan choose mp3 players for my space, well the problem is this, I wanted to place 2 or more players in myspace in a particular place, I read another sources how to do that, so i tried to add "position:absolute;left:525px;top:250", i succeed moving the first player but i couldn´t move the second, in change it appears besides the first one every time i move the first one, could you help me? how...
0
2235
by: jiwas78 | last post by:
Hey there. I am learning XML and Actionscript. I have a problem with getting my XML data to load when my SWF is in an HTML page in a browser. When I open the SWF on it's own whether in Flash Player or browser, my playlist of songs comes up. But in the HTML page it's a no go. Here is what my XML looks like: <?xml version="1.0" ?> <playlist> <song title="Alliance" artist="Jack Hammer & B Mac" src="../content/music/Alliance.mp3" /> <song...
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8869
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7386
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5664
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4368
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2771
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.