A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: [RESOLVED] Problem in Firefox

  1. #1
    Member
    Join Date
    Jun 2007
    Posts
    41

    resolved [RESOLVED] Problem in Firefox

    The problem only occurs in Firefox, but not IE. This seems like it is not a display problem, but that it is happening within the movie, or when the movie is making http requests.

    It occurs when I am loading in pictures from a database through POST data. The pictures are downloading quickly, but something is hanging, causing the code to wait nearly 15 seconds before starting the next picture. This does not happen at all in IE.

    The only AS involved with this process are events. Everything is triggered by events, and it seems that when the loader.load event is Complete, the function I have designated is not being called for a long time, but is eventually called after a long wait. The Progress event works just fine throughout this whole time.

    Much Thanks

  2. #2
    Senior Member
    Join Date
    Sep 2005
    Location
    Detroit
    Posts
    193
    I recommend using ExternalInterface(function(){alert('Some Function Called')})
    It will give you JS alerts where you put those tags and that why you can figure out where in your code things are hanging.
    While the music played you worked by candlelight
    Those san francisco nights
    You were the best in town
    Just by chance you crossed the diamond with the pearl
    You turned it on the world
    That’s when you turned the world around

  3. #3
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    In theory, I agree with Kid Charlie about the necessity of debugging to find out exactly where things are going wrong. However, I'd hope you can avoid "alert", as that is a blocking operation and can cause any timing dependent bugs to act much differently. As an alternative, I'd suggest Xray (though I've never actually used it, from what I've read it's a lot like what you need), or using an external js method which updates a logging div on the host page. Here's a rough version of the js function:
    Code:
    function logFlash(msg){
      var logtag = document.getElementById('logtag');
      var d = new Date();
      logtag.innerHTML += "<br/>"+d+": "+msg;
    }
    Then if you have an html tag (div or span or whatever) with id="logtag" it should be updated with each message as they occur.

  4. #4
    Member
    Join Date
    Jun 2007
    Posts
    41
    I am sorry, I was not specific enough in my first message.

    The movie itself is loading perfectly. All of the images, menus, and little animations are running perfecting in Firefox and IE. As of now, there is no JavaScript interaction at all with my browser.

    The problem is in this little slideshow script I am running WITHIN the movie. The images from the slideshow are loaded dynamically into flash, by repeated http requests that return my images from a database. Each loader.load call gets its contents with an HTTP request.
    I then have several events set up. PROGRESS shows how much of the file is downloaded, and COMPLETE saves the picture in an array, and then triggers another loader.load call.

    In IE, the pictures load instantly, and the slideshow is underway in no time. The hang happens in Firefox. The PROGRESS event is showing really fast downloads, but then nothing happens for a while in between pictures. I dont know if somehow the COMPLETE event is not being called, but there are no other conditional loops occuring for the code to get hung up in.

    I thought as3 was browser independent, but what I am asking, is if anybody knows of any reason why Firefox is having different results. Maybe there is some little glitch with the Flash 9 Firefox Plugin, or maybe my publish settings are somehow obscuring quick communication. I really just dont know.

    I am fairly positive that this is not a javascript problem (although I am using the ac_runactivecontent and the HTML that gets published ). Now, as far as using javascript to comment my flash, where do I need to put it if everything is triggered with events?

    Thanks again
    Last edited by cpetzol2; 09-12-2007 at 11:19 AM.

  5. #5
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    We weren't suggesting it was a javascript problem, only that you can use javascript to help you debug. For instance, you could call the js logging method in the complete event, which would let you know if/when it's being called.

  6. #6
    Senior Member
    Join Date
    Sep 2005
    Location
    Detroit
    Posts
    193
    The reason we are asking you to put the JS in there is to figure out precisely which piece of code is hanging in Firefox. Because it is browser specific you can't work this out by using trace because that won't work inside of firefox. Js is the best way to see what function or call is hanging.

    Flash itself is mostly independent but the way things post and the way data to transferred is different. This is why it is important to figure out exactly what is hanging so you can fix it.

    Flax is right about the alert. It's a strange call, that I use to debug my JS apps and probably won't work quite right with debugging flash.
    While the music played you worked by candlelight
    Those san francisco nights
    You were the best in town
    Just by chance you crossed the diamond with the pearl
    You turned it on the world
    That’s when you turned the world around

  7. #7
    Member
    Join Date
    Jun 2007
    Posts
    41
    ok, first of all, the ExternalInterface call just was not working, so I just dropped that and made a php script.

    Every "trace" I made created a URLRequest, a URLLoader, and then did a .load. The php script took the string and loaded it into a database. Given all of that, I am not sure if the length of time this took interfered with our debugging, but the hangtime on the loads is almost the exact time (its almost always 17 seconds).
    The debugger slowed down IE only by a fraction of a second (this thing sent out like 5 messages a second)

    Here is the rundown...

    -initializations
    -start getPicture() /*getPicture encapsulates the loading of a single image*/
    -add url request()
    -start getPicture()
    -event listeners added to loader
    -load request made()

    Now, the following two messages get called 37 times each
    -PROGRESS was called
    -progress bar updated

    and then finally we get...
    -COMPLETE was called
    -adding bitmap to array
    -start getPicture()

    That was the result of the first picture being loaded. And in my flash file, the progress of the download is at 100% instantly once it starts, so for most of the PROGRESS events, the thing was done downloading. I tried using the INIT event instead of COMPLETE, but that did nothing.

    I am smoothing these pictures. They are no bigger than 300x300 pixels, but they could be smaller than that, and they are jpegs.

    If you can tell me how to sneak a message into the actual processing of the loader, or I can insert a line in the PROGRESS event that reads back properties of the loader, but I dont know what Im looking for.

    THanks for all your help guys
    Last edited by cpetzol2; 09-12-2007 at 01:25 PM.

  8. #8
    Member
    Join Date
    Jun 2007
    Posts
    41
    I did this again with an HTTP_STATUS event included. I will save you the trouble of looking through all the messages, but the big difference between IE and Firefox, is that every now and then HTTP_STATUS show up as '0' in Firefox, but shows up as '200' in IE.


    This made me think that something is wrong with the images that I am sending back by calling "www.mysite.com/image.php?id=23". Turns out I had a stupid little syntax error in one of the Headers, and I guess IE was just ignoring it, and it was causing problems with Firefox.

    I was incorrectly putting quotes around the file_size, such as you would if it were a string.
    Code:
    header('Content-Length: ' . $data->file_size); //correct

    Everything appears to be good now.

    Thanks for all of your help guys.
    Last edited by cpetzol2; 09-12-2007 at 02:28 PM.

  9. #9
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Neat. Good to know the problem and the result.

  10. #10
    Member
    Join Date
    Jun 2007
    Posts
    41
    Thanks again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center