home *** CD-ROM | disk | FTP | other *** search
/ Neil's C++ Stuff / 2016-02-neilstuff-weebly.iso / apps / audioPlayer2.swf / scripts / __Packages / net / onepixelout / audio / Track.as < prev   
Encoding:
Text File  |  2016-02-05  |  1.9 KB  |  87 lines

  1. class net.onepixelout.audio.Track
  2. {
  3.    var _soundObject;
  4.    var _src;
  5.    var _isLoaded;
  6.    var _isFullyLoaded;
  7.    var _id3Loaded;
  8.    var _notFound;
  9.    var _id3Tags;
  10.    function Track(src, title, artist)
  11.    {
  12.       this._soundObject = new Sound();
  13.       this._src = src;
  14.       this._isLoaded = false;
  15.       this._isFullyLoaded = false;
  16.       this._id3Loaded = false;
  17.       this._notFound = false;
  18.       this._id3Tags = new Object();
  19.       if(title != undefined && artist != undefined)
  20.       {
  21.          this._id3Tags.songname = title;
  22.          this._id3Tags.artist = artist;
  23.          this._id3Loaded = true;
  24.       }
  25.    }
  26.    function setTitle(title)
  27.    {
  28.       this._id3Tags.songname = title;
  29.       this._id3Loaded = true;
  30.    }
  31.    function setArtist(artist)
  32.    {
  33.       this._id3Tags.artist = artist;
  34.       this._id3Loaded = true;
  35.    }
  36.    function load(checkPolicy)
  37.    {
  38.       if(!this._isLoaded)
  39.       {
  40.          this._soundObject.onLoad = mx.utils.Delegate.create(this,function(success)
  41.          {
  42.             this._notFound = !success;
  43.             this._isFullyLoaded = success;
  44.          }
  45.          );
  46.          this._soundObject.checkPolicyFile = checkPolicy;
  47.          this._soundObject.loadSound(this._src,true);
  48.          this._isLoaded = true;
  49.       }
  50.       return this._soundObject;
  51.    }
  52.    function unLoad()
  53.    {
  54.       if(!this._isFullyLoaded)
  55.       {
  56.          delete this._soundObject;
  57.          this._isLoaded = false;
  58.          this._soundObject = new Sound();
  59.       }
  60.    }
  61.    function isFullyLoaded()
  62.    {
  63.       return this._isFullyLoaded;
  64.    }
  65.    function isLoaded()
  66.    {
  67.       return this._isLoaded;
  68.    }
  69.    function exists()
  70.    {
  71.       return !this._notFound;
  72.    }
  73.    function isID3Loaded()
  74.    {
  75.       return this._id3Loaded;
  76.    }
  77.    function setInfo()
  78.    {
  79.       this._id3Tags = this._soundObject.id3;
  80.       this._id3Loaded = true;
  81.    }
  82.    function getInfo()
  83.    {
  84.       return this._id3Tags;
  85.    }
  86. }
  87.