Skip to main content
Participant
January 18, 2007
Question

setRGB(0x"Color from a node in xml")

  • January 18, 2007
  • 2 replies
  • 393 views
Hello
I have a map that is going to show a color for each Dep DID. I use setRGB(0x"Color") method but I am having a hard time figuring out how to populate each of the movieclips(different cities and places) with the color that matches the Dep DID.
I have this xml:
<?xml version="1.0" encoding="utf-8"?>
<Deps>
<Dep DID="1" Value="0.56" Color="FF0000">
<Name>Italy</Name>
<Dep DID="11" Value="0.74" Color="00CC33">
<Name>Verona</Name>
<Dep DID="1901" Value="0.74" Color="00CC33">
<Name>Arena</Name>
<Dep DID="1902" Value="0.74" Color="00CC33">
<Name>Plaza</Name>
</Dep>
<Dep DID="21" Value="0.95" Color="FFCC00">
<Name>Milano</Name>
<Dep DID="4"Value="0.95" Color="FFCC00">
<Name>Malpensa</Name>
</Dep>
</Dep>
</Dep>
</Dep>
</Deps>

Can anyone help me please.
This topic has been closed for replies.

2 replies

Marghoob Sulemaan
Inspiring
January 18, 2007
There is lots of way to do this... yes ofcourse you can use XPath.
Marghoob Sulemaan
Inspiring
January 18, 2007
you can set rgb.

var color = "FF0000" // this value should be from xml
var myColor:Color = new Color(target_mc) // target_mc should be your map city
myColor.setRGB(Number("0x" + color))

one more thing... xml fromat should be like this...

<?xml version="1.0" encoding="utf-8"?>
<Deps>
<Dep DID="1" Value="0.56" Color="FF0000">
<Name>
Italy
</Name>
</Dep>
<Dep DID="11" Value="0.74" Color="00CC33">
<Name>
Verona
</Name>
</Dep>
<Dep DID="1901" Value="0.74" Color="00CC33">
<Name>
Arena
</Name>
</Dep>
<Dep DID="1902" Value="0.74" Color="00CC33">
<Name>
Plaza
</Name>
</Dep>
<Dep DID="21" Value="0.95" Color="FFCC00">
<Name>
Milano
</Name>
</Dep>
<Dep DID="4" Value="0.95" Color="FFCC00">
<Name>
Malpensa
</Name>
</Dep>
</Deps>
Participant
January 18, 2007
Thanks for the answer ! But I`m still in need for more help.
The problem is how to retrieve the value from xml.
Can I use Xpath ?
Participating Frequently
January 18, 2007
This will load and display the contents of your XML file in the output window.