We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › use variables in size() Method
Page Index Toggle Pages: 1
use variables in size() Method (Read 1545 times)
use variables in size() Method
May 17th, 2010, 5:59am
 
Hey,

how can I use variables in the size() (http://processing.org/reference/size_.html) method I need a dynamic scene, because I want to change the width and the height.

I got the following error message, when I start the EclipseP5Exporter v0.2.4:
Code:
The size of this applet could not automatically be determined from your code. Use only numeric values (not variables) for the size() command. See the size() reference for an explanation. 

Re: use variables in size() Method
Reply #1 - May 17th, 2010, 6:07am
 
do you want to change the screensize on runtime ?
Re: use variables in size() Method
Reply #2 - May 17th, 2010, 6:35am
 
Cedric, I doubt we can change the screen size on runtime, unless the monitor is a Transformer... Tongue

donnar, you can use variables, but exporters won't be able to find out the applet size, hence the message. They analyze the size() call to extract width and height value and generate the corresponding applet HTML tag.

Note that you can make the frame resizable or change its size dynamically after it started (not sure how it behaves in a browser), search the forum for solutions.
Re: use variables in size() Method
Reply #3 - May 17th, 2010, 8:38am
 
Thanks for your answers. I will search in the forum for more informations.
Re: use variables in size() Method
Reply #4 - May 17th, 2010, 10:22am
 
Re: use variables in size() Method
Reply #5 - May 18th, 2010, 3:34am
 
Hey Cedric,

that isn't the method I searched for. In both Links you can only change the frame, but I need to change the scene. The scene is resizable with the method "size". I don't want to change it with the frame, like the code in your second link. I want to change the size with variables.
Re: use variables in size() Method
Reply #6 - May 18th, 2010, 4:17am
 
I have solved the problem. I forgot the call of the size() function in the setup() method. Only in the setup method I must not use varibles. In the draw() method I can use variables. Thanks for your help.
Page Index Toggle Pages: 1