WEB action script help

Discussion in 'OT Technology' started by AnoesisX, Feb 14, 2008.

  1. AnoesisX

    AnoesisX New Member

    Joined:
    Feb 19, 2005
    Messages:
    2,866
    Likes Received:
    0
    Location:
    Boca Rotten, Florida
    ok the flash file is simple.its a button that plays an mp3 (load it and it plays you press the button to stop it and press it again to start it again. Its loaded from an xml file.

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <Total_songs>
        <song path="music/kitchenmusic.mp3" />
    </Total_songs>
    
    ok now what i want to do is make mp3 loop.

    here is the action script
    Code:
    XML.prototype.ignoreWhite = true;
    
    var audiolist_xml = new XML();
    audiolist_xml.load("song.xml");
    
    _global.vol = 100;
    
    audiolist_xml.onLoad = function(success){
        if (success){
            //trace ("yes");
            songFilepath = new Array();
            songTitle = new Array();
            songBand = new Array();
            ////
            eachTrack = new Array();
            eachTrack = this.firstChild.childNodes;
            totalTracks = eachTrack.length;
            
            var i = 0;
            
            while ( i < totalTracks){
                
                songFilepath.push(eachTrack[i].attributes.path);
                
                
                i = i + 1;            
            }
            
            _global.trackNum = 0;
            currentFilePath = songFilepath[trackNum];
            
        }else {
            trace ("NOOOOO!!!!");
        }
    }
    
    and
    Code:
    stop();
    
    if (audiolist_xml.loaded = true) {
        
        mysound = new Sound ();
        mysound.loadSound(currentFilePath, true);
        mysound.start();
        
    }else{
        gotoAndPlay(2);
    }
    
     
  2. Ractoon

    Ractoon Shibumi in progress...

    Joined:
    Apr 30, 2001
    Messages:
    256
    Likes Received:
    0
    Code:
    mysound.onSoundComplete = function() {
       this.start();
    };
     

Share This Page