Background switch example

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Post Reply
Livecode Staff Member
Livecode Staff Member
Posts: 249
Joined: Fri Feb 24, 2006 9:45 am

Background switch example

Post by elanorb » Thu Sep 12, 2013 10:38 am


Here is a small stack showing how to change a background image based on a menu selection.

The stack builds the path to the chosen image file, which it assumes is in a folder called "backgrounds" located next to the stack itself. It then appends the chosen image name to the folder and resets the filename property of the background image.

The code is in the menuPick handler of the drop down menu.

Code: Select all

on menuPick pItemName
   set the itemDel to "/"
   put item 1 to -2 of the filename of this stack & "/backgrounds/" & pItemName & ".jpg" into tImageFilePath
   set the filename of image "background" to tImageFilePath
end menuPick
Please let me know if you have any questions.

Kind regards

(33.67 KiB) Downloaded 128 times
Elanor Buchanan
Software Developer

Post Reply

Return to “Summer School 2013”