# Defining a scale in AS2 (with xml)

**URL:** <https://forum.kirupa.com/t/defining-a-scale-in-as2-with-xml/283617>\
**Category:** flash\
**Created:** [March 9, 2009, 8:09am UTC](https://forum.kirupa.com/t/defining-a-scale-in-as2-with-xml/283617 "2009-03-09T08:09:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![annonse](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@annonse](https://forum.kirupa.com/u/annonse)\
**Post date:** [March 9, 2009, 8:09am UTC](https://forum.kirupa.com/t/defining-a-scale-in-as2-with-xml/283617/1 "2009-03-09T08:09:14Z")

</div>

Hi all.  
I’m having some trouble with my xml-input, which is all numbers.  
Basicly, the xml feeds number up to one million (1000000) into flash.  
Now, I have one movieclip which has the following code:

a little explaination before reading code:  
\_root.mcMeter.mcNeedle.gotoAndStop(2); makes a needle [COLOR=Lime]green[/COLOR].  
\_root.sold.gotoAndStop(2); makes text [COLOR=Lime]green[/COLOR].  
\_root.mcMeter.mcNeedle.gotoAndStop(1); keeps needle [COLOR=Red]red[/COLOR].  
\_root.sold.gotoAndStop(1); keeps text [COLOR=Red]red[/COLOR].

```auto

importXML.onLoad = function(success) {
    if(success) {
        soldsofar = this.firstChild.childNodes[0].firstChild.nodeValue;
        salesgoal = this.firstChild.childNodes[2].firstChild.nodeValue;
        louise_avis.mcMeter.setValue(soldsofar);
        louise_avis.mcGoal.setValue(salesgoal);
        }
    if (soldsofar >= salesgoal){
        _root.mcMeter.mcNeedle.gotoAndStop(2);
        _root.sold.gotoAndStop(2);
    } else{
        _root.mcMeter.mcNeedle.gotoAndStop(1);
        _root.sold.gotoAndStop(1);
    }
} 

```

However, if the xml input for “salesgoal” is set to 255000, and the “soldsofar” is set to anything between 26-99 (not 260000 or 990000, but twentysix and ninetynine), flash thinks it’s greater than the “soldsofar”-value. Seems like it does not read the “salesgoal” as the reference-value. But if “soldsofar” exceeds 100 (one hundred), it goes back to red.

So what I’m looking for is a way to define a scale which is based on “salesgoal”, because now flash reads “salesgoal” 255000 as 25.5 until “soldsofar” exceeds 100.

Anybody?
