Last active
August 29, 2015 14:26
-
-
Save baiIey/bf4e364ce92fcf822072 to your computer and use it in GitHub Desktop.
Video layer hides when completed and has event-listeners
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bg = new BackgroundLayer | |
print "background created" | |
# Create image layer | |
finishText = new Layer | |
height: 100, width: 539 | |
image: "youFinish.png" | |
print "finishText created" | |
# finishText becomes hidden | |
finishText.visible = false | |
print "image is hidden" | |
#create video layer | |
videoRabbit = new VideoLayer | |
width: 640, height: 360, | |
video: "rabbitShort.mp4" | |
print "video created" | |
# Plays video | |
videoRabbit.player.play() | |
print "video is playing" | |
# Waits for click on video | |
videoRabbit.on Events.Click, -> | |
videoRabbit.visible = false | |
finishText.visible = true | |
print "videoRabbit is hidden and finishText is visible via click" | |
#listen for video ending | |
videoRabbit.player.onended = -> | |
videoRabbit.visible = false | |
finishText.visible = true | |
print "videoRabbit is hidden and finishText is visible via video end" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment