mike
mike

Reputation: 749

As3 MP3 Player not loading

So as I stated in this other post my MP3 Player is not loading online, but works perfectly on my local computer.

I was messing around with files today and I finally got flash to give me an error. Could this be why the MP3 player does not load online? Here's the error:

TypeError: Error #2007: Parameter text must be non-null.
 at flash.text::TextField/set text()
 at Mp3Player_fla::MainTimeline/id3Handler()

By the way I have the MP3 on its own swf. Its being called by the main swf. If I place all the code into the main swf could it possibly work? That should'nt make a difference, but maybe because I'm loading large movies as the backgrounds and many other swf's at the same time, its messing it up?

Upvotes: 0

Views: 581

Answers (3)

Gabriel
Gabriel

Reputation: 11

The MP3 Player I was using on my site was developed by FlashXML and initially I had the same kind of problem, but I talked with the guys from FX and they sorted my problems out.

Was really stuck untill they helped me. If you are still interested, you can check it out at www.flashxml.net/mp3-player.html

Upvotes: 1

PatrickS
PatrickS

Reputation: 9572

You could try to catch the error in the id3Handler , in case the id3 tags are not defined

function id3Handler(evt:Event):void {

    try{

      songInfo.text = /*song.id3.artist + ": " +*/ song.id3.songName;

   }catch(e:Error)
   {
      trace(e );

      //or...
      songInfo.text = "No name"
   }
}

although , you may well have a security issue , id3 info would be returned in such case. do you use a crossdomain policy file?

Extract from the Sound class docs:

Certain operations dealing with sound are restricted. 
The data in a loaded sound cannot be accessed by a file in a different domain 
unless you implement a cross-domain policy file. 
Sound-related APIs that fall under this restriction are 
Sound.id3 , 
SoundMixer.computeSpectrum(), 
SoundMixer.bufferTime, 
and the SoundTransform class.

Edit:

Here's a very permissive policy file, copy it , save it to a file and name the file

crossdomain.xml

then upload it to the root folder of your site, for instance for example.com

http://example.com/crossdomain.xml
  <?xml version="1.0"?> 
  <!DOCTYPE cross-domain-policy SYSTEM      
  "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
      <cross-domain-policy> <site-control permitted-cross-domain-policies="all"/> 
      <allow-    access-from domain="*" secure="false"/> 
      <allow-http-request-headers-from domain="*"   headers="*" secure="false"/>
 </cross-domain-policy>

If this works, read this article

http://kb2.adobe.com/cps/142/tn_14213.html

and see how you can secure your site with the crossdomain policy file

Upvotes: 0

Tyler Egeto
Tyler Egeto

Reputation: 5495

Your bug is in the id3Handler function. It appears you are trying to set the value of a text field there to null. If you cant figure it out, post the code for id3Handler and I'll give you some more info. Likely something hasn't loaded yet.

Upvotes: 0

Related Questions