How can I insert a company image when I launch my app?

5 replies [Last post]
ebertole
User offline. Last seen 1 week 4 days ago. Offline
Joined: 17 Jul 2011

Hi, I would like to know how can I insert an image in my app tha

appear when I launch it and then dissappear few seconds later,

bringing the users to the main menu.

Thanks!

Replies

Danny's picture
Danny
User offline. Last seen 1 hour 16 min ago. Offline
Staff
Joined: 17 Aug 2011

You mean Default.png?

Include this with your project. And it will be the first image shown on launching your app.

Failing that, create a scene for your company, and have it set to change to the menu screen after a delay

using

timer.performWithDelay()

ebertole
User offline. Last seen 1 week 4 days ago. Offline
Joined: 17 Jul 2011

Thank you so much!

ertzel
User offline. Last seen 7 weeks 14 hours ago. Offline
Joined: 15 Jun 2011

If your using the storyboard system to change between windows/scenes in your app you could put something like this in your main.lua

1
2
3
4
5
6
7
8
9
10
11
local storyboard = require "storyboard"
 
local compImage = display.newImage("compImage.png", true) 
        compImage.x = display.contentWidth/2
        compImage.x = display.contentHeight/2
 
local function loadGame()
        storyboard.gotoScene( "menu" )
end
 
transition.to(compImage, {time=5000, alpha = 0, onComplete = loadGame })

This will display your image for 5 seconds and fade it out then load menu.lua

If your not using the storyboard, you can still use this code but need to change whats inside the loadGame function to whatever you use to switch to your menu.

EDIT: didn't see Danny's post until I submitted mine lol, his is much easier.

ebertole
User offline. Last seen 1 week 4 days ago. Offline
Joined: 17 Jul 2011

Thanks, the image appear, but the app change scene immediatly. do you know how can I fix it?

@RSCdev's picture
@RSCdev
User offline. Last seen 3 hours 28 min ago. Offline
Joined: 6 Sep 2011

Using the @ertzel`s sample code will get the "time" you want to see it.

Viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.