Welcome, Guest
  • Author Topic: XML.onload and ' this ' - difficult question!  (Read 3425 times)

    tomtom

    • Server what's that
    • *
    • Posts: 1
      • View Profile
      • Email
    Hi!
    Really Nice Board!  :)

    I made a MovieClip which shows the data from a XML file.

    The problem is that in the function 'xmlResponseLoaded' the 'this-
    reference' points to the XML data and not to the movie-clip. I.e., the
    call 'xmlSuccess()' is not '_level0.myClip.xmlSuccess', but
    '_level0.xmlSuccess'.

    Since 'myClip' is attached dynamically, I don't know the name of
    'myClip' after it is attached (so '_level0.myClip.xmlSuccess();' will
    not work)
    I absolutely need the 'this-reference' in the movie-clip.

    Does anyone have an idea??
    Thanks much for your help!

    Greetings from Germany
    ralf


    source:
    //-----------------------------------
    // Get XML-Data:
    xmlResponse = new XML();
    xmlResponse.onLoad = xmlResponseLoaded;
    xmlResponse.load("myXML.xml");

    // Wait for XML-Data:
    function xmlResponseLoaded(success)
    {
    if (success)
    {
    trace("this = " add this);
    xmlSuccess();
    }
    else {RequestStatus = "Request failed.";}
    }
    // XML-Load success:
    function xmlSuccess()
    {
    //makeChart:
    //...
    }

    Flash-db

    • Administrator
    • Systems Administrator
    • *****
    • Posts: 1876
      • View Profile
      • Flash-db.com
    Re:XML.onload and ' this ' - difficult question!
    « Reply #1 on: 01/29/02, 01:09 »
    Can you call the XML function from inside of the loaded movie clip - instead of the root movie.  

    Or can you load the movie onto a specific Level like Level 2 - Then just reference that Level.  This might work as well if you loaded a Movie that is not inside a MC to a different level such as 2 or 3.

    What do you need to tell this Loaded movie to do.  I'm sure theirs a work around, I'm just not sure what your trying to do exactly so it's hard to find one.  I've had this problem as well in the past - and I would usually be able to get around it by calling the xml functions from inside the loaded movie clip instead of the root.  Also you can place the XML code on a frame somewhere then use the   call("FrameLabel");  function to bring the functions into the context of the Movie clip you are using.  If that makes sense at all.
    Flash-DB