Need Help Getting Info From XML And Showing It In Flash.

  • blackhart
  • Graduate
  • Graduate
  • blackhart
  • Posts: 111
  • Loc: Hartbeat

Post 3+ Months Ago

Hi, Basically I've created a flash profile for myspace but its really just something i use the teach myself actionscript. I use XML for three different things. My Blog, my photo gallery and my mp3 player. Right now the only way people could change what their viewing in each of these is by hitting next and back buttons. Thats fine but its kinda annoying. Lets say you came to my site and you wanted to see a specific picture. Instead of just going straight to it, you would have to view all my pictures before you could get to the one you wanted to see. My question is, is there a way where i could make a list of all the pictures so that people could just click on them and it would show up? i would use the same idea on the blog and the mp3 player.

Here is what i have so far.

Any help would be appreciated.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • classified
  • Expert
  • Expert
  • User avatar
  • Posts: 540
  • Loc: Bahrain

Post 3+ Months Ago

http://www.ozzu.com/flash-forum/best-way-display-dynamic-data-records-t70074.html&si ... 862840af7e

i posted a link to an xml sample ...
have a look it might be useful ..
  • blackhart
  • Graduate
  • Graduate
  • blackhart
  • Posts: 111
  • Loc: Hartbeat

Post 3+ Months Ago

So the idea is to attach a move with dynamic text for each item in the array?
  • blackhart
  • Graduate
  • Graduate
  • blackhart
  • Posts: 111
  • Loc: Hartbeat

Post 3+ Months Ago

Well i'm trying to set up a playlist for the mp3 player and its not working...


Code: [ Select ]
playlist.onLoad = function(success) {
    if (success) {
        _global.songfile = [];
        _global.songname = [];
        _global.songband = [];
        _global.songalbum = [];
        _global.total = playlist.firstChild.childNodes.length;
        for (var i = 0; i<_global.total; i++) {
            _global.songfile[i] = playlist.firstChild.childNodes[i].attributes.file;
            _global.songname[i] = playlist.firstChild.childNodes[i].attributes.name;
            _global.songband[i] = playlist.firstChild.childNodes[i].attributes.band;
            _global.songalbum[i] = playlist.firstChild.childNodes[i].attributes.album;
            //trace(songname[i]+" "+songfile[i]+" "+songband[i]);
        }
        for (var i = 0; i<_global.total; i++) {
            item = attachMovie('PlaylistItem', 'PlaylistItem'+i, 1);
            playlistitem_txt = _global.songband[i]-_global.songname[i];
            item._x = 0;
            item._y = ypos;
            ypos += 20;
        }
    }
    _root.createEmptyMovieClip("sound_mc", 1);
    _global.song_nr = random(songfile.length);
    _root.sound_mc.songStarter(songfile[song_nr], songname[song_nr], songband[song_nr], songalbum[song_nr]);
};
  1. playlist.onLoad = function(success) {
  2.     if (success) {
  3.         _global.songfile = [];
  4.         _global.songname = [];
  5.         _global.songband = [];
  6.         _global.songalbum = [];
  7.         _global.total = playlist.firstChild.childNodes.length;
  8.         for (var i = 0; i<_global.total; i++) {
  9.             _global.songfile[i] = playlist.firstChild.childNodes[i].attributes.file;
  10.             _global.songname[i] = playlist.firstChild.childNodes[i].attributes.name;
  11.             _global.songband[i] = playlist.firstChild.childNodes[i].attributes.band;
  12.             _global.songalbum[i] = playlist.firstChild.childNodes[i].attributes.album;
  13.             //trace(songname[i]+" "+songfile[i]+" "+songband[i]);
  14.         }
  15.         for (var i = 0; i<_global.total; i++) {
  16.             item = attachMovie('PlaylistItem', 'PlaylistItem'+i, 1);
  17.             playlistitem_txt = _global.songband[i]-_global.songname[i];
  18.             item._x = 0;
  19.             item._y = ypos;
  20.             ypos += 20;
  21.         }
  22.     }
  23.     _root.createEmptyMovieClip("sound_mc", 1);
  24.     _global.song_nr = random(songfile.length);
  25.     _root.sound_mc.songStarter(songfile[song_nr], songname[song_nr], songband[song_nr], songalbum[song_nr]);
  26. };


this is the code im trying but... yea i get nothing.
  • blackhart
  • Graduate
  • Graduate
  • blackhart
  • Posts: 111
  • Loc: Hartbeat

Post 3+ Months Ago

i modified the code but its still not working properly.

The playlist is being generated but the second track is being skipped. There is just a blank space where it should be but i don't know why.

Second. when i click on the links for the songs they don't work. I'm not really sure why though. I think it has something to do with the way I'm generating them.

So heres the code so far... anyone please a little help

Code: [ Select ]
var ypos = 10;
playlist = new XML();
playlist.ignoreWhite = true;
playlist.onLoad = function(success) {
    if (success) {
        _global.songname = [];
        _global.songband = [];
        _global.songfile = [];
        for (var i = 0; i<playlist.firstChild.childNodes.length; i++) {
            _global.songname[i] = playlist.firstChild.childNodes[i].attributes.name;
            _global.songband[i] = playlist.firstChild.childNodes[i].attributes.band;
            _global.songfile[i] = playlist.firstChild.childNodes[i].attributes.file;
        }
    }
    for (var i = 0; i<songfile.length; i++) {
        item = _root.attachMovie('PlaylistItem', 'PlaylistItem'+i, _root.getNextHighestDepth());
        item.onRelease = function() {
            clearInterval(timeInterval);
            timeDisplay_txt.text = "00:00";
            _root.sound_mc.songStarter(songfile[i], songname[i], songband[i], songalbum[i]);
        };
        item.itemtxt.text = i+1+". "+songband[i]+" - "+songname[i];
        item._x = 320;
        item._y = ypos;
        ypos += 16.1;
    }
    _root.createEmptyMovieClip("sound_mc", 1);
    _global.song_nr = random(songfile.length);
    _root.sound_mc.songStarter(songfile[song_nr], songname[song_nr], songband[song_nr], songalbum[song_nr]);
};
  1. var ypos = 10;
  2. playlist = new XML();
  3. playlist.ignoreWhite = true;
  4. playlist.onLoad = function(success) {
  5.     if (success) {
  6.         _global.songname = [];
  7.         _global.songband = [];
  8.         _global.songfile = [];
  9.         for (var i = 0; i<playlist.firstChild.childNodes.length; i++) {
  10.             _global.songname[i] = playlist.firstChild.childNodes[i].attributes.name;
  11.             _global.songband[i] = playlist.firstChild.childNodes[i].attributes.band;
  12.             _global.songfile[i] = playlist.firstChild.childNodes[i].attributes.file;
  13.         }
  14.     }
  15.     for (var i = 0; i<songfile.length; i++) {
  16.         item = _root.attachMovie('PlaylistItem', 'PlaylistItem'+i, _root.getNextHighestDepth());
  17.         item.onRelease = function() {
  18.             clearInterval(timeInterval);
  19.             timeDisplay_txt.text = "00:00";
  20.             _root.sound_mc.songStarter(songfile[i], songname[i], songband[i], songalbum[i]);
  21.         };
  22.         item.itemtxt.text = i+1+". "+songband[i]+" - "+songname[i];
  23.         item._x = 320;
  24.         item._y = ypos;
  25.         ypos += 16.1;
  26.     }
  27.     _root.createEmptyMovieClip("sound_mc", 1);
  28.     _global.song_nr = random(songfile.length);
  29.     _root.sound_mc.songStarter(songfile[song_nr], songname[song_nr], songband[song_nr], songalbum[song_nr]);
  30. };

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 8 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.