You're setting the text in the text field before the handler
(completeXMLListener) even runs.

Also - Text is  a bad name for a function, it's common practice for
method names to be underlined, and also use non-reserved words.  Text is
a reserved word in Actionscript.  Also - it's also common practice to
capitalize class names.

Lastly, you should declare your methods as public, private or protected,
and specify return types.  In this case, I would make them all private.


Jason Merrill 

Bank of  America  Global Learning 
Learning & Performance Solutions

Join the Bank of America Flash Platform Community  and visit our
Instructional Technology Design Blog
(note: these are for Bank of America employees only)





-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of John
Singleton
Sent: Tuesday, May 04, 2010 8:30 AM
To: Flash Coders List
Subject: Re: [Flashcoders] Template w/ XML?



----- Original Message ----

> From: Jared <[email protected]>
> To: Flash Coders List <[email protected]>
> Sent: Fri, April 30, 2010 6:16:37 PM
> Subject: Re: [Flashcoders] Template w/ XML?
> 
> Try root.loaderinfo.parameters.varname

That got me on the right track. I have one little wrinkle to work out of
this first attempt. Here's my code:

package
{
imports here

class suchandsuch extends MovieClip
{
        var pageDetails:String = new String();
        var urlXMLLoader:URLLoader;

function suchandsuch()
{
            XMLLoader();
            Text();
        }
        
        function XMLLoader()
        {
            var urlXMLRequest:URLRequest = new
URLRequest('pageDetails.xml');
            urlXMLLoader = new URLLoader();
            urlXMLLoader.addEventListener(Event.COMPLETE,
completeXMLListener);
            urlXMLLoader.load(urlXMLRequest);
        }
        
        function completeXMLListener(e:Event):void
        {
            var xmlData:XML = XML (e.target.data);
            pageDetails = xmlData.DETAILS.toString();
        }


function Text()
{
more stuff here
            myText.htmlText = pageDetails;
            myText.htmlText += "Lorem ipsum dolor sitipsum, convallis
consequat orci.<br /><br />"; more stuff

Now, if I put a trace under this line:

            myText.htmlText = pageDetails;

I get :

[object textField]

which is what I want. But it doesn't print anything to screen. If I put
the following trace under this line:


            pageDetails = xmlData.DETAILS.toString();
trace(pageDetails);

it traces out what I want. No errors. Please advise.
TIA,
John



      
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to