Hi,
A new user, I’ve read movie doc, reviewed samples, scoured the forum, and tried every iteration that i can think of to solve this problem, but can’t. Scenario for iPad:
Open intro.lua. Play movie. All goes swimmingly. Movie ends. Ignores ‘onComplete’ function. App quits.
Goal: movie ends, onComplete changeScene(“menu”), open main menu. (Alternate: movie ends, reveals intro.lua bg graphics and buttons)
Here’s the current intro.lua code:
module(..., package.seeall);
function new()
local localGroup = display.newGroup();
local isSimulator = "simulator" == system.getInfo("environment")
local movie = media.playVideo("media/intro.mov", true, onComplete)
local bgfull = display.newImageRect("images/bgo.png", \_W, \_H-4);
bgfull:setReferencePoint(display.CenterReferencePoint);
bgfull.x = \_W/2; bgfull.y = \_H/2;
local onComplete = function(event)
localGroup:remove(movie)
--movie:removeSelf(); --doesn't work
--director:changeScene("menu"); --doesn't work
--localGroup:insert(bgfull); --tried re-inserting before and after remove
end
if isSimulator then
msg = display.newText( "No Video on Simulator!", 0, 60, "Verdana-Bold", 22 )
else
media.playVideo(movie)
end
--movie:addEventListener("remove",onComplete) --proposed in forum, didn't work
localGroup:insert(bgfull);
localGroup:insert(movie);
return localGroup;
end
I don’t understand why changeScene doesn’t work within onComplete function. Does it need a local changeScene function like Rafael Hernandez uses in his Screen Transitions tutorial? Not sure how to convert that touch-phase-based example for passive video-complelte usage.
Current code is influenced by the forum discussion
Mobile Application Development | Working With Movie Clips @ansca #CoronaSDK
which suggests it’s possible to create a local ‘movie’ variable, insert movie into localGroup, then use onComplete to remove the movie (leaving bg images and button visible/active); but, movie still plays, ends, app quits. Seems logical; doesn’t work.
I’ve been at this for quite a while, probably missing something obvious. Does anyone see what’s missing? What I’m doing wrong? Any help you can give is greatly appreciated.
Thanks very much,
LB [import]uid: 11631 topic_id: 13789 reply_id: 313789[/import]
[import]uid: 6981 topic_id: 13789 reply_id: 50642[/import]
) to :