I have a Class “Button”, it takes a string in its Constructor, and it has a Method “playPhoneme”.
I instance an object “a”, I can add the “a” object to the world and when the mouse clicks on it the “playPhoneme” method runs.
If I instance the “a” object and add it to the world inside an “if” block I can action the “playPhoneme” inside the “if” block, but I cannot action the “a.playPhoneme” method outside the “if” block.
i.e.
. if (firstPass){
. Button a = new Button("a");
. addObject(a, 63, 76);
. a.playPhoneme();
. firstPass = false;
. }
. a.playPhoneme();
The compiler throughs “cannot find symbol - variable a”
How do I access an object created inside an “if” block, from outside the “if” block?
Regards Julian

