Background switch example

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Locked
elanorb
Livecode Staff Member
Livecode Staff Member
Posts: 516
Joined: Fri Feb 24, 2006 9:45 am

Background switch example

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

Hi

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

Elanor
Attachments
backgroundSwitcher.zip
(33.67 KiB) Downloaded 392 times
Elanor Buchanan
Software Developer
LiveCode

Locked

Return to “Summer School 2013”