PDA

View Full Version : Accessing and manipulating variables brought in by LoadVariablesNum()


gregorykai
01-18-2002, 09:50 PM
I have a flash file that is using LoadVariablesNum() to bring in 6 numerical values from a text file. I am trying to use those values to create a bar graph. I am having trouble accessing and manipulating those values after they come in. When I am debugging... The list of variables shows the 6 values coming in from the text file, so I know the values make it into Flash. I have even been able to display those values using a dynamic text field. When I try to multiply those values with some other number or try to use them in subtraction.. I get no result. It's like I can't use those variables for math funtions. What am I don't wrong? The variables are loaded into level0.

Here is the output from the "List Variables"
Level #0:
Variable _level0.$version = "WIN 5,0,30,0"
Variable _level0.graphbottom = 186
Variable _level0.billinggraph = 0
Variable _level0.supportgraph = 0
Variable _level0.salesgraph = 0
Variable _level0.dedicatedgraph = 0
Variable _level0.networkgraph = 0
Variable _level0.overallgraph = 0
Variable _level0.billing = "30"
Variable _level0.support = "30"
Variable _level0.sales = "30"
Variable _level0.dedicated = "50"
Variable _level0.network = "30"
Variable _level0.overall = "30"



Here is the actionscript code for the graph
var graphbottom;
graphbottom = 186

billinggraph=billing*3
supportgraph=support*3
salesgraph=sales*3
dedicatedgraph=dedicated*3
networkgraph=network*3
overallgraph=overall*3

setProperty (_root.Graph1.SGBar1, _y, graphbottom-billinggraph);
setProperty (_root.Graph1.SGBar2, _y, graphbottom-supportgraph);
setProperty (_root.Graph1.SGBar3, _y, graphbottom-salesgraph);
setProperty (_root.Graph1.SGBar4, _y, graphbottom-dedicatedgraph);
setProperty (_root.Graph1.SGBar5, _y, graphbottom-networkgraph);
setProperty (_root.Graph1.SGBar6, _y, graphbottom-overallgraph);
setProperty (_root.Graph1.SGBar1, _height, billinggraph);
setProperty (_root.Graph1.SGBar2, _height, supportgraph);
setProperty (_root.Graph1.SGBar3, _height, salesgraph);
setProperty (_root.Graph1.SGBar4, _height, dedicatedgraph);
setProperty (_root.Graph1.SGBar5, _height, networkgraph);
setProperty (_root.Graph1.SGBar6, _height, overallgraph);

Any help anyone can provide would be greatly appreciated.

tg
01-18-2002, 11:57 PM
in your variable list, the variables are listed like
Variable _level0.support = "30"
flash imports data from files as "strings" so 30 is not the number 30 it is the string (or word) "30".

try this

billinggraph=Number(billing)*3 ;
...

also, flash is case sensative, so make sure it is a capital N on Number.