HELP on Graph Plotting!

Can anyone help me out with this? I attached the source file. It’s a graph plotting when user can enter values for a quadratic /cubic equation and it’ll plot the graph.

However, my problem is i wish to set the range when the graph will shown. That means if i enter -5 to 5, the graph will plots from that range. (i named it ak and bk) When i enter let’s say -5 to -1 and it will only show that range.

Another question, how do i set so the graph will fit dynamically into the screen exactly.

Thanx in advance!

ive done graph plotting myself in flash and for me dynamically fitting the graph in the screen was way too complicated

maybe you could mask the graph and give the user pan and zoom tools

I did use mask for certain purpose but not in showing the range. i wish to set the range by user defined like i said the ak and bk i put in the file. Really headache how to get it right. Help pls. Thank you