Tutorial 1 - Survey of basic Lingo Operations

This tutorial presents a Director panel containing series of left-hand windows containing sample Lingo instructions which you can click on to trigger their execution.

One general principle that these examples illustrate is that every property of any Director object (e.g. sprite, text area or field, bitmap, stage shape, vector shape, script, cast, score, etc.) that can be changed by a manual authoring-time operation can be changed in the same way by a corresponding run-time Lingo operation.

More generally, Director's 'run mode' and 'authoring mode' are very closely integrated.

1..2..3..4..5..6..7..8..9..10..11..12..13..14..15..16..17..18..19..20..

1..2..3..4..5..6..7..8..9..10..11..12..13..14..15..16..17..18..19..20..

The global code used in this embed is as follows

on show txt
  set the text of member "Outwin" = "Output Window" & RETURN & txt
end 

on show_page page_no    -- jump to the indicated page number
  global code_page
  code_page = integer(page_no)
  txt = ""  & member("CodePage" & page_no).text
  member("CodeDisplay").text = txt
end 

on rotate_sprite sno 
  repeat with j = 1 to 36
    sprite(sno).rotation = sprite(sno).rotation + 10.0
    updatestage
  end repeat
end 

on mouseUpOutside me
  show("called on mouseUpOutside")
end

on toggle    -- returns alternate 0's and 1's
  global the_val
  if the_val = void or the_val = 0 then 
    the_val = 1
  else
    the_val = 0
  end if
  
  show(the_val) 
  return the_val
end

on EvalScript stg   -- handle messages from browser
  do stg
end

on hyperlinkClicked me,text,range
  alert("Hyperlink characters" && range && "were clicked. Internal link data is" && text) 
end

on showSizes   -- utiltiy to show sizes of all non-empty members
  repeat with j = 1 to the number of members
    if member(j).type = #empty then next repeat
    put member(j).type && member(j).size && member(j).name
  end repeat
end