Difference between revisions of "MovieClip Event.COMPLETE"

From GiderosMobile
Line 5: Line 5:
 
=== Description ===
 
=== Description ===
 
This event is dispatched when a '''MovieClip''' object finishes playing (by reaching its final frame or a frame with stop action).
 
This event is dispatched when a '''MovieClip''' object finishes playing (by reaching its final frame or a frame with stop action).
 +
 +
=== Example ===
 +
<syntaxhighlight lang="lua">
 +
local pixel = Pixel.new(0xff0000, 1, 64, 64)
 +
local timing2 = 300
 +
local mc2 = MovieClip.new{
 +
{1, timing2, pixel, {x={10, 100, "easeOut"}}},
 +
}
 +
mc2:gotoAndPlay(1)
 +
-- position
 +
mc2:setPosition(128, 128)
 +
-- scale
 +
mc2:setScale(1.25, 1.25)
 +
-- order
 +
stage:addChild(mc2)
 +
-- listeners
 +
mc2:addEventListener(Event.COMPLETE, function(e)
 +
print("movie clip stopped")
 +
end)
 +
</syntaxhighlight>
  
 
{{MovieClip}}
 
{{MovieClip}}

Revision as of 20:15, 22 August 2024

Available since: Gideros 2012.2.1
Value: complete
Defined by: MovieClip

Description

This event is dispatched when a MovieClip object finishes playing (by reaching its final frame or a frame with stop action).

Example

local pixel = Pixel.new(0xff0000, 1, 64, 64)
local timing2 = 300
local mc2 = MovieClip.new{
	{1, timing2, pixel, {x={10, 100, "easeOut"}}},
}
mc2:gotoAndPlay(1)
-- position
mc2:setPosition(128, 128)
-- scale
mc2:setScale(1.25, 1.25)
-- order
stage:addChild(mc2)
-- listeners
mc2:addEventListener(Event.COMPLETE, function(e)
	print("movie clip stopped")
end)