Counter concept in Perspective

I would like to create a countdown timer in the progress bar component using value change script however I’m facing issues the script runs fine but the value in the progress bar does not change.

Any light on this issues?

Much Appreciated, Thank you.

this is the scripting I have written for countdown timer


Where are you assigning the component prop you are trying to change? I don’t see a line that is trying to update your GUI.

1 Like

The problem with your code is that j is a value - not a reference. So even though you’re decrementing j, you are never telling the Progress Bar to use the new value.

while self.props.selected and j > 0:
    j -= 1
    self.parent.getChild("FlexContainer").getChild("FlexContainer_0").getChild("Progress").props.value = j

j = self.parent.getChild(“FlexContainer”).getChild(“FlexContainer_0”).getChild(“Progress”).props.value

this is the component I was trying to assign the new value

Right. As @cmallonee said, this only assigns the current value to j, not a reference to .props.value.

So you need to do

self.parent.getChild(“FlexContainer”).getChild(“FlexContainer_0”).getChild(“Progress”).props.value = someNewvalue


I think maybe you could do

j =  self.parent.getChild(“FlexContainer”).getChild(“FlexContainer_0”).getChild(“Progress”)
j.props.value = someNewValue

if you really wanted to, but I don’t think this makes anything more readable or gives any advantage.

1 Like

@cmallonee Thank you for your help

1 Like