cardWidth, cardHeight
Posted: Thu May 08, 2014 5:58 pm
I recently discovered cardWidth and cardHeight when learning how to maintain the position of controls when resizing the card.
Now I want to use cardWidth and cardHeight to position an image at a random position on the card, even when the card has been resized.
Say my object is 100x100 I wanted to do something like this:
when I try to run this code I get the error:
button "START":execution error at line 25 (Operators-:error in left operand), char11
Line 25 mentioned in the error is actually line 1 of the code snippet I posted.
The only thing I can think of is when I use cardWidth and cardHeight for resizing I first have a line like:
Do I need to add a similar line of code to tell LiveCode to "get" the cardWidth and cardHeight?
Thanks for any ideas or suggestions,
TJ.
Now I want to use cardWidth and cardHeight to position an image at a random position on the card, even when the card has been resized.
Say my object is 100x100 I wanted to do something like this:
Code: Select all
put cardWidth-100 into cwidth
put cardHeight-100 into cheight
put random(cwidth) into rwidth
put random(cheight) into rheight
set the topleft of image "image" to rwidth, rheight
button "START":execution error at line 25 (Operators-:error in left operand), char11
Line 25 mentioned in the error is actually line 1 of the code snippet I posted.
The only thing I can think of is when I use cardWidth and cardHeight for resizing I first have a line like:
Code: Select all
on resizeStack cardWidth, cardHeight
Thanks for any ideas or suggestions,
TJ.