473,664 Members | 2,972 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Flash / XML mp3 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 2234

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

Similar topics

3
6843
by: Emil | last post by:
This is my problem: I'm writing a script that... 1. creates a customized pls/m3u playlist 2. sends the pls or a m3u playlist to the webbrowser. The browser should open Winamp/Windows Media Player and load the downloaded playlist.
9
4338
by: Randy | last post by:
Flash Remoting is a way for Flash applications to make "native" method calls in Action Script to a server side program, using the AMF binary format. Flash has commercial versions of a Flash Remoting servers. There are open-source alternatives for php, java, and perl. But alas, no Python. Does anyone have any interest in a project like this? It would be port for the most part; the AMF format is already well known. In
0
1145
by: Konaje | last post by:
Hi, I am creating a web application for slideshow. Idea is to create a playlist of different media files like JPG/SWF/MOV etc. and play them one after the other. For flash files I can not depend on duration, but I need to display the flash movie entirely before I switch to the next media file. Can someone please guide me, how to get the end point of a flash file using C#/Flash/HTML.
1
3693
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)));
19
19251
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?
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...
1
6072
by: thomasc | last post by:
Hello, This question is about VB.NET2003. I have a WindowsMediaPlayer Control on a windows form. Now I want to create a playlist for the control so it plays all the media files specified in the playlist. But I haven't been able to how to create a playlist and make my WindowsMediaPlayer Control play it.
0
2351
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
8348
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
8636
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7375
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
6187
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
5660
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
4185
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...
1
2764
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
2
2003
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1759
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.