PDA

View Full Version : Help with code (Please)



madman
September 21st, 2009, 19:29
i have been trying to make this work for months and i have had no luck

is there anyone who could break down this template code for me. i.e. what each spot is doing. ijust want to rearrange the npc sheey.


<script>
function onInit()
if anchor then
setAnchor("bottom", anchor[1], "top", "absolute", 2);
setAnchor("left", anchor[1], "left", "absolute", 0);
setAnchor("right", anchor[1], "right", "absolute", 0);
end
end
</script>

Thank You

Chris

Moon Wizard
September 22nd, 2009, 05:52
The code you posted will execute right after the control it is attached to is created. Then, it will look for an <anchor> tag value. If it finds one, then it calls the setAnchor function for the control it is attached to, in order to set the bottom, left and right boundaries of the control.

It looks like it is part of a template to allow labels to be quickly stacked on top of the field the label is referencing.

Cheers,
JPG

madman
September 28th, 2009, 00:54
i get it now!

Chris