user1641831
user1641831

Reputation:

Corona Sdk: storyboard API and object alpha (opacity)

i am having troubles changing an object alpha in a storyboard corona application.

When the page is loaded, the object has a default alpha of 0 (it is invisible). Then, by clicking on a button, his alpha is set to 1 (it becomes visible).

If i leave the page, move to another storyboard page, and then get back, the object is still visible, even though i set his alpha back to 0 again with this code both in the function that gets me back to other pages:

local function gotoHomefun()
if objectname then
objectname.alpha = 0
end
storyboard.gotoScene( "home", "crossFade", 400 )
return true
end

and in the destroyScene event:

function scene:destroyScene( event )
local group = self.view
if objectname then
objectname.alpha = 0
objectname :removeSelf()    
objectname = nil
end
display.remove( group )
group = nil     
end

I really don't know if im doing something wrong, or i found a bug.

Any help would be really appreciated! Thanks!

Upvotes: 0

Views: 913

Answers (1)

dhaval
dhaval

Reputation: 7659

Do you call the removeScene or purgeScene from other scene??

if not then your scene won't be removed unless it is a low memory situation. Try setting executing the current code in the exitScene event which gets called whenever the view is changed to new scene.

Refer to this doc for the event specific detail - Storyboard Lifecycle Events

Upvotes: 1

Related Questions