A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: XML.onLoad(success) doesn't work like it used to?

  1. #1
    ·»¤«· >flashl!ght<'s Avatar
    Join Date
    Jun 2003
    Posts
    746

    XML.onLoad(success) doesn't work like it used to?

    taken from a Flash MX project, works in SA player 6, MX IDE, IE player 7, but not in a browser with player 8:
    code:

    //SITE DATA LOAD
    _global.siteXML = new XML();
    XML.prototype.ignoreWhite = true;
    siteXML.load("site.xml");
    siteXML.onLoad = function(success){
    if(success){
    //snipped
    }else{ //if XML failed to load, show a error message textfield
    _root.createTextField("txt",1,0,0,100,20);
    txt.text = "XML load failed.";
    }
    }



    The textfield never shows up in F8...

    What's going on? It's just a simple onLoad(success) method...

    I'm on a Pentium III / XP, tried Mozilla, and IE doesn't have F8 installed(and it works on IE, player 7)
    Last edited by >flashl!ght<; 09-06-2005 at 11:32 AM.
    >flashl!ght<
    All the normal names were taken.
    Ron Paul was right.

  2. #2
    Senior Moderator
    Join Date
    Apr 2000
    Location
    Sheffield, UK
    Posts
    3,881
    Code works for me.

  3. #3
    ·»¤«· >flashl!ght<'s Avatar
    Join Date
    Jun 2003
    Posts
    746
    drat.

    In Mozilla/Netscape?
    >flashl!ght<
    All the normal names were taken.
    Ron Paul was right.

  4. #4
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    I've always placed my load after the onLoad. Can't remember where I learned that but it might help.

  5. #5
    Senior Moderator
    Join Date
    Apr 2000
    Location
    Sheffield, UK
    Posts
    3,881
    Your code works fine on Firefox and IE, Mac and Windows.

  6. #6
    ·»¤«· >flashl!ght<'s Avatar
    Join Date
    Jun 2003
    Posts
    746
    Great, my computer is possessed. What other factors might be causing it to fail? The exact code above does not work for me in Mozilla 1.7.8 with player 8. I'm about to install FireFox on this machine...

    PS - thanks jAQUAN, that didn't do anything though. Like I said, it works in all other cases but player 8 on my machine(which is installed in Moz)
    >flashl!ght<
    All the normal names were taken.
    Ron Paul was right.

  7. #7
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    If you haven't already, file a bug report with Macromedia.

    http://www.macromedia.com/go/fp_public_beta_feedback

  8. #8
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Why are you using _global? Should be avoided as much as possible.
    - The right of the People to create Flash movies shall not be infringed. -

  9. #9
    ·»¤«· >flashl!ght<'s Avatar
    Join Date
    Jun 2003
    Posts
    746
    Really, I appreciate the crits on my coding, I'm not an AS guru, but my code works already. On all previous versions of Flash, but something is amiss in player 8 somewhere. The fact that it worked properly(problem was not reproducable) for others using player 8 shows it's a very system specific problem. Yes, I have filed it with MM(crosses fingers).

    Incidentally, why avoid _global as much as possible? I'm a _global junkie, I use it as much as possible. Testing also shows you get the fastest results with _global referencing. And why in this case did I use it? Because of all my references to the source XML from nested movieclips and functions and such... much easier when I know I'm dealing with a globally scoped reference to my XML.
    >flashl!ght<
    All the normal names were taken.
    Ron Paul was right.

  10. #10
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    I don't have experience with other programing languages, basically none, but from what I learnt from others is that _global is basically banned in some languages such as java for example. Somebody with more experience may make some comment on this.
    The main reason not to use _global frequently is that that a _global var can be accessed from everywhere. However, accession is something which should be limited (in AS2) as much as possible. That is why people use "private" vars. Now think you have a complex script network and there is more than one programmer who contributed. If you use _global you will run into trouble if somewhere is another var with the same name. So I limit myself to relatively unimportant features using _global such as the style of components if I want all of them to have the same style. In that case it will save coding. Otherwise I usually refer to the exact path of the var and don't run into problems.

    It is my opinion and probably others have different opinions. Once some time ago Mike Chambers from MM brought this up here and some of my knowledge I learnt from him.
    - The right of the People to create Flash movies shall not be infringed. -

  11. #11
    ·»¤«· >flashl!ght<'s Avatar
    Join Date
    Jun 2003
    Posts
    746
    Fair enough. I think for the scope of most of my projects _global is alot of help and not a concern. When making components and such though, I certainly agree; I always keep everything local.
    >flashl!ght<
    All the normal names were taken.
    Ron Paul was right.

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