A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: XML onReply problem in Object

  1. #1
    Junior Member
    Join Date
    Feb 2003
    Posts
    8

    XML onReply problem in Object

    Hello,

    I have a problem/bug that (perhaps it is me) or perhaps not.

    I have and Object

    oContainer

    defined as

    oContainer = new Object();

    oContainer =
    {


    sTEST : new String(),

    fnFUNCTION : function(sName,iID)

    etc....

    }

    In this object I have XML loading functions

    as in


    fnLoad : function() {

    XML = new XML();
    this.sTEST = "hi";
    XML.onLoad = this.onReply;
    XML.ignoreWhite = true;
    XML.load("http://domain/load.xml);


    },

    onReply : function (bSuccess)

    {


    if (bSuccess == true) {

    // HERE IS THE PROBLEM AREA VERY FEW THINGS WORK HERE

    trace(this.sTEST); // THIS DOESN't
    trace ("hello") // THIS WORKS

    } else {

    _root.tError = aError[XML_FORUMLOAD_ERROR];

    }


    So the problem bieng I cannot access member variables from the onReply method. Is this normal??? I can remove the XML processing INFO from the object and things work but it isn't as pretty, I would like to keep everything in one object...

    Thanks in advance for any help

  2. #2
    Senior Member tupps's Avatar
    Join Date
    Jan 2001
    Location
    Melbourne
    Posts
    2,035
    You will find that in onReply that 'this' refers to the XML document that has just been loaded.

    Thanks

    Luke
    Flash-XML FAQ
    http://www.tupps.com/flash/faq/

  3. #3
    Junior Member
    Join Date
    Feb 2003
    Posts
    8
    Ah thanks, I see so I have to use _root.oObjectName.method in order to access member varibles and methods..


    Thanks

    Stefan

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