Avatar

Correct answer by
Level 5

Hi,

You could use code like this on the "+" and "-" buttons

//This code is for the "+" button

// get font size

var currentSize = TextField1.font.size;

// get location of the "pt" string

var ptPlace = currentSize.indexOf ( "pt");

// get the part of the string that is just numbers

var currentSizeInt = currentSize.substr ( 0, ptPlace);

// parse that new string as an integer and add 1

var newSizeInt = parseInt (currentSizeInt, 10) + 1;

// set that as the new font size ( adding the "pt" back on)

TextField1.font.size = currentSizeInt + "pt";

Obviously for the "-" you just change the line that adds one to subtract 1

Hope this helps

Malcolm

View solution in original post