FORUMS: list search recent posts

Convert XML Data into Numbers

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Tony Ingrassia
Convert XML Data into Numbers
on Aug 17, 2009 at 5:08:23 pm

What I'm trying to do is control the length of a timer through XML. Here's my code:

//----------

stop();

var timer_xml:XML;
var xmlReq:URLRequest = new URLRequest("variables.xml");
var xmlLoader:URLLoader = new URLLoader();
var topTextTimer;
var timerDelay:int = parseInt(topTextTimer);


function xmlLoaded(event:Event):void
{
timer_xml = new XML(xmlLoader.data);
topTextTimer = timer_xml.image.toptexttimer;
}
xmlLoader.load(xmlReq);
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);


import flash.utils.Timer;
var pauseTimer:Timer = new Timer(timerDelay, 1);

function playTopText (event:TimerEvent):void
{
play();
}

pauseTimer.addEventListener(TimerEvent.TIMER, playTopText);
pauseTimer.start();

//---------

So, as you can see, I'm loading the XML data from an external file (variables.xml). Using the above code, when I preview I get no errors, but the timer does not work. However, if I go to the timer controls (where you set the delay and repeat values) and add...

var pauseTimer:Timer = new Timer(timerDelay+5000, 1);

...it works! It's almost as if the action script is seeing my timerDelay variable as having a value of "0"

I know that the XML data has to be converted from a String to a Number, and I thought that using "parseInt" would accomplish this.

What am I missing?



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]