TypeError #1009, XML and AS3

Posted by VideoDnd on Stack Overflow See other posts from Stack Overflow or by VideoDnd
Published on 2010-03-25T14:30:16Z Indexed on 2010/03/25 14:33 UTC
Read the original article Hit count: 440

Filed under:
|
|

My animation is advanced forward, but it's frozen. It throws a TypeError #1009. How do I get rid of this error and get it to play?

ERROR

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at _fla::MainTimeline/frame1()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at _fla::MainTimeline/incrementCounter()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()

download
http://sandboxfun.weebly.com/

XML

<?xml version="1.0" encoding="utf-8"?>
<SESSION>
    <TIMER TITLE="speed">1000</TIMER>
    <COUNT TITLE="starting position">10000</COUNT>
</SESSION>

FLA

//DynamicText 'Count'
    var timer:Timer = new Timer(10);  
    var count:int = 0;
    var fcount:int = 0; 

timer.addEventListener(TimerEvent.TIMER, incrementCounter);  
    timer.start();  

function incrementCounter(event:TimerEvent) { 
    count = myXML.COUNT.text();
    count++;  
    fcount=int(count*count/1000);
    mytext.text = formatCount(fcount);
    }

function formatCount(i:int):String { 
    var fraction:int = i % 100; 
    var whole:int = i / 100;  

    return ("0000000" + whole).substr(-7, 7) + "." + (fraction < 10 ? "0" + fraction : fraction); 
    } 

//LOAD XML
    var myXML:XML;
    var myLoader:URLLoader = new URLLoader();
    myLoader.load(new URLRequest("time.xml"));
    myLoader.addEventListener(Event.COMPLETE, processXML);
        /*------CHANGED TIMER VALUE WITH XML------*/
        timer = new Timer( Number(myXML.TIMER.text()) );
        //timer.start();

//PARSE XML
function processXML(e:Event):void {
    myXML = new XML(e.target.data);
        trace(myXML.COUNT.text()); 
        trace(myXML.TIMER.text()); 
    }
//var count:int = 0;//give it a value type
    /*------CHANGED COUNT VALUE WITH XML------*/
    count = myXML.COUNT.text();

© Stack Overflow or respective owner

Related posts about flash

Related posts about Xml