Hey Tim, I have run into this before as well, with both ActionScript and using alert() in JavaScript.
What I concluded was that the trace/alert basically adds a small pause or causes something to happen (i.e. skip a frame or something of the sort) so that the code below it works. I may be totally wrong and this may sound crazy and stupid, but whenever I did something like take the trace out and put the rest of the code into a COMPLETE event for a timer, or had the code run on the next frame with an onEnterFrame, it started working. I know you say you don't think its a timing issue, but instead of the loop try doing a Timer and see if that solves it. On Fri, Apr 17, 2009 at 9:09 AM, Tim Hawkins <tim...@googlemail.com> wrote: > Well, it becomes a null - so if I do select1.toString() in the trace I just > get a runtime error.. And I don't want to turn the results of my query into > a string, because I need it as an XML ref. > > 2009/4/17 Glen Pike <g...@engineeredarts.co.uk> > >> Have you tried the toString or toXMLString for this - check the XML class >> for the proper function name... >> Glen >> >> >> Tim Hawkins wrote: >> >>> Hi Matt, >>> No, afraid not.. I actually use the select1 variable elsewhere, so it's >>> not >>> just that trace which is the problem. >>> >>> Thanks for the suggestion though! >>> >>> >>> >>> 2009/4/17 Matt S. <mattsp...@gmail.com> >>> >>> >>> >>>> Does it make a difference if you write the trace as : >>>> >>>> trace("formData="+formData); >>>> trace("select1:"+ select1); >>>> >>>> >>>> On 4/17/09, Tim Hawkins <tim...@googlemail.com> wrote: >>>> >>>> >>>>> Hi, >>>>> I've come across this a few times in my own code, but haven't seen it >>>>> mentioned online - though it's a difficult thing to google for. >>>>> >>>>> In the following function, if the trace at the top is present, formData >>>>> traces a load of XML and select1 also traces a load of XML. >>>>> >>>>> If I comment out the top trace, formData still traces the same pile of >>>>> >>>>> >>>> XML >>>> >>>> >>>>> but select1 traces null! >>>>> >>>>> public function testMakeModelFilterWorks():void { >>>>> >>>>> trace(""); >>>>> default xml namespace = NAMESPACE; >>>>> >>>>> var select1:XML = formData..select1[2]; >>>>> trace("formData=", formData); >>>>> trace("select1:", select1); >>>>> >>>>> // etc >>>>> default xml namespace = null; >>>>> } >>>>> >>>>> Any ideas? I'm getting fed up of leaving 'trace("");//don't delete me' >>>>> at >>>>> the top of functions. >>>>> (I don't think it's a timing thing, if I put a 100000-item >>>>> increment-a-variable loop in there instead of a trace the E4X still >>>>> >>>>> >>>> fails.) >>>> >>>> >>>>> t. >>>>> _______________________________________________ >>>>> Flashcoders mailing list >>>>> Flashcoders@chattyfig.figleaf.com >>>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders >>>>> >>>>> >>>>> >>>> _______________________________________________ >>> Flashcoders mailing list >>> Flashcoders@chattyfig.figleaf.com >>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders >>> >>> >>> >>> >> >> > _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders