-
Loading variable and using them to change a paint object
Hi
I havent been arround for a long time so am a bit rusty.
I am writing a small "wallboard" app to display stats for a call centre, and to an extent its working fine. I am using LoadVaribles to load the data from a text file created by a script on the server.
H=99 &W=10 &C=999 &A=999 &SL=83.3
One last thing I want to do is display the SL variable as a bargraph. using element (bar0).scale.x = ?? setting this to 83 manually works which is what I want but I want to use the SL variable to set the value, and it just wont work, Is this because the varible is a string ? any pointer ?
Any help much appriciated.
Ian Plain
Ian
www.cyber-cottage.co.uk
-
help -> language syntax -> String -> bottom of the page
myNum = Number("22.3");
myNum = Number(myString);
-
Hi
Thanks for the pointer.
Well still having problems.
This is what I have
loadVariables ("queuename.cfg" ,GET);
loadVariables ("queue.cfg" ,GET);
my_vars = new LoadVars;
my_vars.load ("queue.cfg");
my_vars.onLoad = loadTextVariables;
function loadTextVariables(success){
if(success){
barSL = Number("100")
element ("BAR").scale.x = barSL;
}
}
and this sets the varible barSL to 100, and the bar is scaled to 100.
If I change to barSL = Number(SL) then I get NaN in a text box I am using to test.
Any Ideas?
Cheers In advance
Ian
www.cyber-cottage.co.uk
-
NaN = "Not a Number" ... so there is something wrong with the string I quess.. try printing the number as a string (trace or textbox..)
It is possible that there is something "extra" in that string.. for example "," instead of "." as a decimal point. Or extra space ( "200.0 ").
-
Hm well changing barSL = Number(SL) to barSL = (SL) I get 83.3 in the text box with it seems no spaces.
Im now getting near but not near enough :-(
Ian
www.cyber-cottage.co.uk
-
Weird... try:
barSL = "[" + SL + "]";
or trace("[" + SL + "]");
or trace(SL.length);
It must be something simple..
-
Well after banging my head on the desk for far too long
I changed the script so it added some dummy data at the end
so i now have H=99 &W=10 &C=999 &A=999 &SL=83.3&dd=100 as the text file and now it works !!
Thanks for the help.
Ian
www.cyber-cottage.co.uk
-
Senior Member
The Flash player wont read the data file properly unless
the data string ends with a newline.
Also, you should assign the onLoad property before calling the load method.
Cheers,
kusco
(3DFA Support Team)
-
Hi Kusco
That explains it. its not possible realy to do that as the file is created via a logging system then passed through a collection of linux tools till its outputed as shown here. It was simple to add the dummy data and it worked great.
As to the onload this snippit was copied form another actionscript site.
I must say after a while away from 3dfa im realy impressed with it now.
Ian
Ian
www.cyber-cottage.co.uk
-
Senior Member
The best is yet to come.
Notwithstanding any bugs being found during the final testing, there will be a new version released tomorrow with much nicer scripting.
Cheers,
kusco
(3DFA Support Team)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|