
sub Main(aa as Object)
    print "in Main()"
    'Indicate this is a Roku SceneGraph application'
    screen = CreateObject("roSGScreen")
    m.port = CreateObject("roMessagePort")
    screen.setMessagePort(m.port)

    di = CreateObject("roDeviceInfo")
    di.setMessagePort(m.port)

    hs= CreateObject("roHdmiStatus")
    hs.setMessagePort(m.port)

    'Create a scene and load /components/mainscene.xml'
    scene = screen.CreateScene("MainScene")
    screen.show()

    while(true)
        msg = wait(0, m.port)
        msgType = type(msg)
        if msgType = "roSGScreenEvent"
            if msg.isScreenClosed()
                print "Screen is closed. End of Main()"
                return
            end if
        end if
        if msgType = "roHdmiStatusEvent"
            ?"--------------------------"
            ?"hdmi status event received"
        end if
        if msgType = "roDeviceInfoEvent"
            ?"--------------------------"
            ?"device info event received"
        end if
    end while
end sub