Microsoft Small Basic

Program Listing:
Embed this in your website
gw = 1250
gh = 750
imgmax = 5
tag = "Tunnel"

GraphicsWindow.Width  = gw
GraphicsWindow.Height = gh
GraphicsWindow.Left = (Desktop.Width  - gw) / 2  ' Centralizes GraphicsWindow.
GraphicsWindow.Top  = (Desktop.Height - gh) / 2
GraphicsWindow.BackgroundColor = "Black"

LoadImages()   ' Load imgmax number of pictures.

Controls.AddButton("Forward"  10,10)
Controls.AddButton("Back"     10,50)
Controls.AddButton("Quit"     10,110)

img = 1            ' Starting from 1st picture. img is index for pic[] array.
OnButtonClicked()  ' Directly invoking it to display a picture aSaP.

Controls.ButtonClicked = OnButtonClicked

' --------------------------------------------------------------------------------------------------------------------------------------------------'
Sub OnButtonClicked

  Button= Controls.GetButtonCaption( Controls.LastClickedButton )
  Sound.PlayClick()

  If Button = "Forward"  Then
    img = img + 1
  ElseIf Button = "Back" Then
    img = img - 1
  ElseIf Button = "Quit" Then
    Sound.PlayChimeAndWait()
    Program.End()
  EndIf

  If img > PicCount Then
    img = PicCount
  ElseIf img < 1    Then
    img = 1
  EndIf

  GraphicsWindow.DrawResizedImage(pic[img]  100,30  gw-140,gh-60)
  GraphicsWindow.Title = "Image #" + img

EndSub
' --------------------------------------------------------------------------------------------------------------------------------------------------'
Sub LoadImages

  For img = 1 To imgmax
    GraphicsWindow.Title = "Loading #" + img
    Sound.PlayChimes()
    pic[img] = ImageList.LoadImage( Flickr.GetRandomPicture(tag) )
  EndFor

  PicCount = Array.GetItemCount(pic)   ' Redundant to img_max. Using just for example purposes.

EndSub
' --------------------------------------------------------------------------------------------------------------------------------------------------'
Copyright (c) Microsoft Corporation. All rights reserved.