I have an external module that creates several display objects, buttons and text. I display this module in every scene. It has a background that is set up as a gradient from black a the top to grey at the bottom and 50 percent saturation. So in the first scene you can see the background through the bottom of the background. This is what I want. As I display more scenes the background seems to become more and more saturated, still gradient and blocking out the background. This I don’t want. I have tried removing the object and setting it to nil and I get errors. Any suggestions?
Are you making your gradient object local? Are you (assuming you’re using Composer/Storyboard) inserting it into the scene group object? Can you confirm it’s being fully removed in each scene (again, assuming Composer/Storyboard) with print statements?
Posting your code would be the best way to identify the issue.
It’s tough to read your code without it being formatted.
To check to see if your gradient object is removed, you could put something like this in your main.lua file:
local function printStats() print("barContainer = "..tostring(barContainer)) end Runtime:addEventListener("enterFrame", printStats)
Are you removing the “barContainer” object at any point in your workflow?
Sorry, it looks formatted to me.
I dont reference barContainer anywhere in my code outside of the module. The module is referenced as navbar. Do you know how to remove a module? It gets loaded in the next scene. I thought composer.removeScene( “menu2” ) would remove the scene and its’ objects. Apparently not.
I hate to do this, but the “module(…, package.seeall)” method is very outmoded and replaced by simple module creation, which is detailed here. I’m sure you’re not in a place to re-create your external modules, but moving to the “new” way is the best way to go.
I believe Composer will handle any object that is entered into the group scene. Looks like the link to the Composer API is broken right now, or else I would post the direct reference. Composer (if it’s anything like Storyboard) doesn’t know to do anything with display objects unless they are entered into the group scene. I suppose you could also code a function in your external module to delete the “background” object and call that when the scene is removed.
I removed “package.seeall”. No change. I viewed the module creation and thought package.loaded[] = nil might be the solution. No change. I guess I could add navbar to the sceneGroup next and see if that works.
That looks like it worked. Thanks for your help.
Are you making your gradient object local? Are you (assuming you’re using Composer/Storyboard) inserting it into the scene group object? Can you confirm it’s being fully removed in each scene (again, assuming Composer/Storyboard) with print statements?
Posting your code would be the best way to identify the issue.
It’s tough to read your code without it being formatted.
To check to see if your gradient object is removed, you could put something like this in your main.lua file:
local function printStats() print("barContainer = "..tostring(barContainer)) end Runtime:addEventListener("enterFrame", printStats)
Are you removing the “barContainer” object at any point in your workflow?
Sorry, it looks formatted to me.
I dont reference barContainer anywhere in my code outside of the module. The module is referenced as navbar. Do you know how to remove a module? It gets loaded in the next scene. I thought composer.removeScene( “menu2” ) would remove the scene and its’ objects. Apparently not.
I hate to do this, but the “module(…, package.seeall)” method is very outmoded and replaced by simple module creation, which is detailed here. I’m sure you’re not in a place to re-create your external modules, but moving to the “new” way is the best way to go.
I believe Composer will handle any object that is entered into the group scene. Looks like the link to the Composer API is broken right now, or else I would post the direct reference. Composer (if it’s anything like Storyboard) doesn’t know to do anything with display objects unless they are entered into the group scene. I suppose you could also code a function in your external module to delete the “background” object and call that when the scene is removed.
I removed “package.seeall”. No change. I viewed the module creation and thought package.loaded[] = nil might be the solution. No change. I guess I could add navbar to the sceneGroup next and see if that works.
That looks like it worked. Thanks for your help.