Page 1 of 1

still not sure how to pass commands through stack

Posted: Tue Mar 31, 2009 5:58 pm
by magice
I have a main stack and a sub stack. I need for the cancel button on the substack to change the visibility of a graphic on the mainstack.

currently in the cancel button i call deleteRect.

then in the main stack script.

Code: Select all

on deleteRect
    global tRectInc
  
   do "set the visible of graphic Rect" & tRectInc & "  to false"

end deleteRect
(the tRectInc is a number that is incremented based on which rectangle is being modified)

The problem, is that I am getting a "no such object" error when the script runs. It is correctly seeing the object name, but does not detect that there is an object of that name. Earlier scripts are correctly modifying the object so there is no question that it exists and is properly named. I believe that the problem occurs because I am calling the command from a substack and trying to modify a graphic on the mainstack. Is there something I need to add for the "on deleteRect" script to look in the right place for the designated rectangle?

Posted: Tue Mar 31, 2009 7:10 pm
by bn
magice,
you dont indicate where the graphic is. If you call it from the card the graphic is on then it finds it, if the graphic is somewhere else you must tell rev where to find it.
set the visible of graphic (myrect & rectInc) of card x of stack y to false

please look up the reserved words of Rev. You use rect & something. Rect is a reserved word. If you would use myRect & something you would not have to code it with
do "mycode here"
actually eventually using reserved Keywords will bite you, dont do it, even if you get away with it in your workaround.
you make things more complicated then they are this way.
Look at the tutorials, they are very helpful.
regards
Bernd