如何解决“TypeError:错误#1010:术语未定义且没有属性

时间:2013-08-21 16:13:19

标签: actionscript-3 actionscript undefined

我正在使用ActionScript 3.0制作MP3播放器,下面是我的代码:

var my_songs:XMLList;
var my_total:Number;

var my_sound:Sound;
var my_channel:SoundChannel;

var current_song:Number = 0;
var myXMLLoader:URLLoader = new URLLoader();
myXMLLoader.load(new URLRequest("music/shakira.xml"));
myXMLLoader.addEventListener(Event.COMPLETE, processXML);

function processXML(e:Event):void
{
    var myXML:XML = new XML(e.target.data);
    my_songs = myXML.SONG;
    my_total = my_songs.length();

    playSong(0);
}

function playSong(mySong:Number):void
{
    var myTitle = my_songs[mySong]. @ TITLE;
    var myArtist = my_songs[mySong]. @ ARTIST;
    var myURL = my_songs[mySong]. @ URL;//title_txt.text = myTitle;
    // artist_txt.text = myArtist;
    if (my_channel)
    {
        my_channel.stop();
    }
    my_sound = new Sound();
    my_sound.load(new URLRequest(myURL));
    my_channel = my_sound.play();
}

// next_btn.addEventListener(MouseEvent.CLICK, onNext);
// function onNext(e:MouseEvent):void {
//     current_song++;
//     if (current_song>=my_total){
//         current_song=0;
//     }
//     playSong(current_song);
// }

我输出错误:

  

TypeError:错误#1010:术语未定义且没有属性   在musicplayer_fla :: MainTimeline / playSong()
  在musicplayer_fla :: MainTimeline / processXML()
  在flash.events::EventDispatcher/dispatchEventFunction()
  在flash.events :::EventDispatcher / dispatchEvent()
  在flash.net::URLLoader/onComplete()

0 个答案:

没有答案