Can anyone help me

  • marisa
  • Born
  • Born
  • marisa
  • Posts: 1
  • Loc: England

Post 3+ Months Ago

I am having trouble still with this. If I type 7 in the input txt box I get this in my output when I submit
days = 7 by using trace("days = "+_root.days);
which is fine but I need it to output the correct rate for 7 days from my array and store that rate as a variable so I can add or multiply it to others when it calculates!
This is my array
durationDays = new Array();
durationDays [0] = "1.4375";
durationDays [1] = "2.6991";
durationDays [2] = "3.8160";
and so on.................................

So if the user types in 2 I need to turn it into 2.6991 and make this into a variable!

I'm really stuck here! please help
  • classified
  • Expert
  • Expert
  • User avatar
  • Posts: 540
  • Loc: Bahrain

Post 3+ Months Ago

if user puts in 2 ...
u gotta do it like this ...

var X:Number = sometextfield.text ;
var Y:Number = durationDays[X];

trace(durationDays[X]);
trace(Y);

should return same value for both ...

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 3 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.