View Full Version : how to get numericstepper value?
tegleg
11-11-2010, 02:48 PM
yo
whats the syntax for getting values of click widgets in action script
for the NumericStepper, but in general what do you do?
eg
a numericstepper called numstep_mc
numstep_mc.value doesnt seem to work
thank you
Matt Doyle
11-11-2010, 03:12 PM
Its always a good idea to open the class file for a given component to find stuff like this out in the future.
That being said, value is the correct property to poll. So, assuming you have a numeric stepper on the root named 'ns', this ActionScript will trace its currently set value as it changes.
ns.addEventListener("change", this, "NSChange");
function NSChange() {
trace(ns.value);
}
tegleg
11-11-2010, 03:51 PM
thank you
i cant seem to get this to work, im trying to select a value then store it as a config var in an ini. it saves the ini but the value is always 0.
perhaps someone can see the problem?
theres a numericstepper called lapnum_mc
actionscript, its on an actions layer if thats important
var lapNumber:Number;
lapnum_mc.addEventListener("change", this, "NSChange");
function NSChange() {
lapNumber = lapnum_mc.value;
}
//........other stuff
// on a button press this happens
ExternalInterface.call("LapFunction", lapNumber);
unreal script
class UW2EntryGame extends UTGame
config(MyIni);
var config int GameEndLap;
function LapFunction(int lapNumber )
{
GameEndLap = lapNumber + 1;
SaveConfig();
}
it fires the functions because UDKMyIni is generated
but i get 0 every time
the ini file
[UW2_Content.UW2Game]
GameEndLap=0
thanks for any help
Matt Doyle
11-11-2010, 04:04 PM
When you test this in Fx Media Player, what value does the external interface argument display in the log? I'm guessing that part works properly.
From what I can tell, your problem is in UnrealScript somewhere. You're adding 1 to lapNumber there, yet it still saves the value as 0 in the config file. Not sure what's wrong.
tegleg
11-11-2010, 04:11 PM
in the fx media player log i get this
callback! LapFunction, nargs = 1
arg(0) = 4
so it must be the uscript
hmmm....
edit
hang on it gets generated when the game starts not when the button is pressed
gosh it must be some earlier experiments come to life somewhere
thank you matt
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.