If variable=variable simple problem!

Ok i’m having this problem;i have tried a lot of times to try to find what is wrong but could not;it looks pretty simple though but i’m a newbie;

here is the situation:
I have 2 buttons:
-Next page
-Previous page

a dynamic text box where i load an external text;it is called “contents”(the var).

my “Previous page” button works fine while i’m having problem with my “next page” button.

I use loadVariablesNum("…/texts/"+pagenum+".txt", 0);
So that when i press on
next page" button;the pagenum is incremented and it loads 1.txt , 2.txt ,etc…(where in each text; “contents” variable is loaded).

I also use a variable(lastpage) so that to stop the “next page” button to go further than the last page.

I load the lastpage variable value from an external text too.

here is the code the “next page” button:

on (release) {
if (pagenum=lastpage) {
break;
} else {
pagenum = pagenum+1;
loadVariablesNum("…/texts/"+pagenum+".txt", 0);
}
}

The “next page” button doesn’t stop when pagenum=lastpage.

Any idea why? thanks in advance

anyone can help??? please

else if(condition){action}
as opposed to else{condition;action}

and i wrote a mini tut on IF statements here: http://www.kirupaforum.com/forums/showthread.php?t=60750&highlight=if+statements
why not do a search?

Prophet.

thanks i have reada you tutorial but still don’t know why my code doesn’t work :frowning: