PDA

View Full Version : Set mc.property by loaded variables


mdeligt
03-06-2005, 12:45 PM
Hello there, I'm trying to set the height of a mc by the value of an external loaded variable as part of a bar-chart. The decimals of the value are, sadly, seperated by a comma, not a dot. I used the 'split'-method for this. Still, the mc won't grow, the textfields ' stockchange' are ok. Hereunder the code used till now:

//variables: &change1=3,18&change2=5,70


loadText = new LoadVars();
loadText.load("data/top8gainers.txt");
loadText.onLoad = function() {
_root.stockchange1.text = this.change1.split(",").join(".");
_root.stockchange2.text = this.change2.split(",").join(".");
};

shape1.targetHeight = shape1._height;
shape1.onEnterFrame = function() {
if(this._height < Number(parseInt(String(change1), 16))*60) this._height+= 2;
};

shape1.targetHeight = shape1._height;
shape1.onEnterFrame = function() {
if(this._height < Number(parseInt(String(change2), 16))*60) this._height+= 2;
};

Thanx in advance

tg
03-06-2005, 06:04 PM
in your onEnterFrame functions, you are imporperly targeting change1 & change2. it should be, loadText.change1 & loadText.change2. since the 2 variables scope is within the loadvars object.