How or what did I do here

Hey guys.

OK brand new and jumped in the deep end.

I started a new project and in the main.la file I wanted to have a splash screen video play. I also wanted to have the back ground the same colour as the video.

I assumed I had to put the local background image first and assumed the video would would play onto of that?

No, I messed around and moved things left right and centre. What I get is my video play with a black background at completion the screen changed to the title page.

While that is good. I don’t understand (and really need to understand) how the screen showed the titler screen after the video was complete.  You will see in my code here the entire thing is on the main.lua file. From what I have read and looked up some of this needs to be on a 2nd TAB but I am not understanding what part or how to move to another screen/scene after the video completes.

Hope someone can point me in the right direction. (sorry this was so log winded)

[lua]-- SPlash screen of logo

media.playVideo(“1.mp4”,false)

– sets title screen to background image

local iImage = display.newImage( “background.png”)

– sets  image on title page

local balls = display.newImage( “6balls.png” ,157,75)

– game titl5 and developer information

LabelRe = display.newText (“A Red Engine Project”, 155,360, native.sys,019)

LabelRe:setTextColor(282,0,0)

LabelGT = display.newText (“6 in sixty”, 156,160, native.sys,069)

LabelGT:setTextColor(0,255,0)

LabelGT = display.newText (“6 in sixty”, 160,155, native.sys,069)

LabelGT:setTextColor(245,245,245)

[/lua]

Welcome to Corona :slight_smile:

He first thing I see is that you play the video first.
Corona will work top down based on what you posted.

Using Conposer within Corona you can move through scenes but it doesn’t have to be that way.

You will need to layer what you display in the order you want to see it.

For a first step try changing the order you’re displaying.
(Since I’m on a phone I can’t look up much more right now)

There are a few key concepts that might explain what’s going on.  

First, for the most part, Corona’s API’s draw in the reverse order you called the API’s.  In your example above the object “balls” will be on top of “iImage” unless you execute certain API calls to move objects to the front or send to the back. Think of it as layers of paper that stack upon each other.

Now for the exceptions.

Corona supports grouping. Display objects can be put into logical groups. These groups are also “display objects” and are dependent on the drawn in order layering as describe above.  But let’s say you have a background image, then a group called “firstGroup”, then you draw three more images, those three images will be on top of firstGroup which is on top of background.  Now you create a new image object but you insert it into “firstGroup”, it will be on top of background but below the other three images since the group is the next to the lowest level.

This segues to the Composer set of API’s. Composer works by using groups. All managed objects are added to a scene’s view group or else it’s not managed. All Composer objects are inserted into the overall display hierarchy below and display objects that are not in composer groups. This is by design but can frustrate people using Composer because they forget to add them to the scene’s group.

Finally there are a special type of object called “native.*” objects. These are objects created with the native.* API Calls like native.newWebView are not part of the Corona display hierarchy and will always be on top of any Corona display object. There is nothing we can do about it because of the way OpenGL works with native objects.  I believe that media.playVideo() is considered a native object. Your video will be on top of any object created with display.* and you can’t change it.

Next there is the concept of synchronous API’s vs asynchronous APIs. Most of our API’s are synchronous in that the API has to complete before the next line of code executes. We design some of our APIs like network.request() to return immediately so your game/app’s UI doesn’t “block” while you’re waiting for something slow to finish. I do not believe that media.play is asynch. So your video is going to complete before your iImage object even gets created. 

I would draw the background image first, then play the video, then remove the video.

Rob

Welcome to Corona :slight_smile:

He first thing I see is that you play the video first.
Corona will work top down based on what you posted.

Using Conposer within Corona you can move through scenes but it doesn’t have to be that way.

You will need to layer what you display in the order you want to see it.

For a first step try changing the order you’re displaying.
(Since I’m on a phone I can’t look up much more right now)

There are a few key concepts that might explain what’s going on.  

First, for the most part, Corona’s API’s draw in the reverse order you called the API’s.  In your example above the object “balls” will be on top of “iImage” unless you execute certain API calls to move objects to the front or send to the back. Think of it as layers of paper that stack upon each other.

Now for the exceptions.

Corona supports grouping. Display objects can be put into logical groups. These groups are also “display objects” and are dependent on the drawn in order layering as describe above.  But let’s say you have a background image, then a group called “firstGroup”, then you draw three more images, those three images will be on top of firstGroup which is on top of background.  Now you create a new image object but you insert it into “firstGroup”, it will be on top of background but below the other three images since the group is the next to the lowest level.

This segues to the Composer set of API’s. Composer works by using groups. All managed objects are added to a scene’s view group or else it’s not managed. All Composer objects are inserted into the overall display hierarchy below and display objects that are not in composer groups. This is by design but can frustrate people using Composer because they forget to add them to the scene’s group.

Finally there are a special type of object called “native.*” objects. These are objects created with the native.* API Calls like native.newWebView are not part of the Corona display hierarchy and will always be on top of any Corona display object. There is nothing we can do about it because of the way OpenGL works with native objects.  I believe that media.playVideo() is considered a native object. Your video will be on top of any object created with display.* and you can’t change it.

Next there is the concept of synchronous API’s vs asynchronous APIs. Most of our API’s are synchronous in that the API has to complete before the next line of code executes. We design some of our APIs like network.request() to return immediately so your game/app’s UI doesn’t “block” while you’re waiting for something slow to finish. I do not believe that media.play is asynch. So your video is going to complete before your iImage object even gets created. 

I would draw the background image first, then play the video, then remove the video.

Rob