Save the state info into an array on first launch and read the states from the array when you load the level. You can easily update the states in the array when you complete a level.
example:
start with an array of size 0,1,1
on start of layout
-if array.height = 0:
-- for each levels_button ordered by levels_button.level descending:
--- if array.height < levels_button.level: set size to levels_button.level,1,1
--- : set at levels_button.level-1: levels_button.state
- for each levels_button ordered by levels_button.level ascending:
-- : levels_button set state to array.at(levels_button.level-1)
set levels_button animation frame to levels_button.state
going to a level:
- save global var currentlvl = levels_button.level; go to level
end of level:
- set array.at(currentlvl-1) = 2; set array.at(currentlvl) = 1
go to level selection
and don't forget to set animation speed of your level buttons to 0