what i want to do is using nested pages as calculator. in this case to calculate the player's current resist cap.
the testing xml:
Code:
<Page Name="Test" ScrollExtent="320,240" Size="320,240">
<Page BackgroundColor="#0F00F0" BackgroundOpacity="1.000" Name="Dummy" ScrollExtent="100,40" Size="100,40">
<Page BackgroundColor="#00FF00" BackgroundOpacity="1.000" Name="Inner" PackLocation="left" PackLocationProp="0000/0001,xxxx/xxxx" PackSize="proportional" PackSizeProp="0100/0100,xxxx/xxxx" ScrollExtent="100,40" Size="100,40"/>
</Page>
<Page BackgroundColor="#0F00F0" BackgroundOpacity="1.000" Location="0,45" Name="Container" ScrollExtent="100,40" Size="100,40">
<Page BackgroundColor="#00FF00" BackgroundOpacity="1.000" Name="Bar" PackLocation="left" PackLocationProp="0000/0001,xxxx/xxxx" PackSize="proportional" PackSizeProp="0100/0100,xxxx/xxxx" ScrollExtent="100,40" Size="100,40"/>
</Page>
<Text Font="normal" LocalText="35" Location="4,91" Name="Level" ScrollExtent="50,20" Size="50,20"></Text>
<Text Font="normal" LocalText="2700" Location="4,114" Name="Cold" ScrollExtent="50,20" Size="50,20"></Text>
<TextStyle Algorithm="simple" FontName="Arial" Language="english" Name="normal" PointSize="20" UseCachedFont="true"/>
<Button BackgroundColor="#0FFFF0" Location="86,134" Name="New Button" OnPress="parent.Dummy.Size=70,40
parent.Dummy.Inner.Size=parent.Level.LocalText ## , ## 40
parent.Dummy.Size=10500,40
parent.Container.Size=parent.Dummy.Inner.Size
parent.Container.Bar.Size=parent.Cold.LocalText ## , ## 40
parent.Container.Size=100,40" ScrollExtent="64,32" Size="64,32"></Button>
</Page>
commented script code:
Code:
parent.Dummy.Size=70,40 // set outer dummy to the level cap
parent.Dummy.Inner.Size=parent.Level.LocalText ## , ## 40 // set inner to the current level
parent.Dummy.Size=10500,40 // by resizing the outer dummy to the cap for level 70, the inner page gets resized to the cap for the current level
parent.Container.Size=parent.Dummy.Inner.Size // *** failure here *** set the container's size to the dummy's inner page. this remains at 35 for this example
parent.Container.Bar.Size=parent.Cold.LocalText ## , ## 40 // set the size of the container's inner page to the current resistance value
parent.Container.Size=100,40 // this should resize the inner page to the progress onto the current level's cap
i use this code as an underlay in the persona window to give a visual feedback on how much room is left to increase a stat. it's not a representation of the actual mitigation, it's just the progress towards the cap. currently it's towards the cap of a level 70 player cause i don't get the current cap calculation to work.
i also tried it with three nested pages, this would do away the dummy pages. but with three nested pages the innermost page gets (directly via textfield's localtext) resized before the second layer page is resized via it's proportional setting. this leads to the innermost page always getting set to the maximum size (outer size of 100 vs. inner size of 1000++)