views:

24

answers:

2

So as I stated in this other post.. http://stackoverflow.com/questions/3700338/as3-mp3-player-loads-when-opened-locally-but-doesnt-show-up-at-all-on-my-server ..my MP3 Player is not loading online, but works perfectly on my local computer...

I was messing around with filse today and I finally got flash to give me an error...Could this be why the MP# player does not load online? heres 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 shoudnt make a difference, but maybe becuause im loading large movies as the backgrounds and many other swf's at the same time, its messing it up?!

A: 

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.

Tyler Egeto
his code is in the previous question, check the link
PatrickS
yea, just like patrick said check the link on my link in the initial post. It has all the code im using for the MP3!! thanks for your reply though!
mike
A: 

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"&gt;
      <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

PatrickS
so yea I tried your code and the error went away. I uploaded the file but still no change, MP3 still does not load. I don't know what you mean about crossdomain, but all of my sites files are in the same folder on the same server if thats what your wondering..Also, I made a seperate folder on m ycomputer and moved everything I needed into that folder and uploaded everything in that folder into my folder on my server, thats why its so weird..its exactly the same on my computer, but only works locally and not online
mike
I even tried compressing the audio files from 9mb's down to 2.5 megabytes but still no change...im going to try to move everything into the main swf instead of loading the mp3 swf seperatly..I doubt that will change anything though...
mike
check the edited answer, i think it's very likely that you have a security error, it would explain why it works locally and not online
PatrickS
damn, that looked really promising...still doesnt work though. I tried it on my serves root folder, the folder the specific flash site is located in...im gonna try inputting that text in my html n see if that does anything...thanks for your help so far!!!!
mike
wait, I have been reading your link and there are a fews things. there is one paragraph that says "A web site that allows access to and from all sub-domains" and says a different xml file to save as crossdomain.xml .... I have my website located inside a folder thats in my main domain...its my portfolio site for class, which has a folder with the name of each site, with each site in each different folder...Do I have to specify the fact that I have my flash site inside a folder of the root folder?? If so, which one of the blocks of xml should I copy and where?!...
mike
I am bringing in like 2-3 FLV's that are the size of the whole stage(so the entire flash site appears animated). I am loading the swf at the bottom of all the code, could it be that its loading but its under all the other stuff???
mike
that could be a reason, test it , don't add the flvs to the stage and see what happens... if your crossdomain.xml is on your root folder if should work for all the subfolders... putting the xml text in your html file won't do anything...
PatrickS
no, putting the swf loader at the top of all the code didnt doo anything. removing all the videos loading didn't do anything either..however I just had the idea to test the mp3 by going directly to its url and it works, it loads and plays the song, but the text says NULL:NULL instead of the BandName:SongName...check this ish out here: http://www.originalengine.com/web/liafail/mp3player.swf ..maybe we can figure this out.
mike
ok, so if the mp3 player will load in when I go to its direct link, you must not be able to load it(SWF W/ MP3's) in the way im loading it...could you please tell me the correct way? this is how I open a any swf, including the different sections of my site and the MP3Player: var songLoader:Loader = new Loader();songLoader.load(new URLRequest("mp3Player.swf"));addChild(songLoader);
mike