Stylized Text LUA only works first time loaded?

So I went to this website: 

http://prairiewest.net/blog/2013/12/text-shadow-glow-corona-sdk/

From there I went to the github site and downloaded the stylizedText.lua.  I put it into my folder, did the require(“styledText”) line and created a test font so that I can figure out what I want exactly.  The problem is, that it works… once.  The first time I loaded it, it worked. Then if I wanted to reload the simulator, it would just come up as white text (without any style).   I removed the files and brought them back… same thing.  First time simulator ran it it worked, then after reload it went away and just had plain white text.  (little note is that my page or,main menu, has a fade but it happened even when deleting fade. 

I tried ensuring it was inserted into the sceneGroup.  I brought it to the front.  I even did a forward declaration.  I then moved it around within the scene phases.  I noticed that if I put it in the scene create phase, it will do as described above, load once then never again. However, if I put it into the scene:show section under did, it works fine (granted it doesn’t fade in and actually waits for the fade to complete before it pops on the screen.  But it does load correctly every time.  

Is this a corona simulator issue, or some issue with the code?

Below is the code I was running.  The styledText.lua can be found at the above link. 

--------------------------------------------------------------------------------- -- -- scene.lua -- --------------------------------------------------------------------------------- local sceneName = ... local composer = require( "composer" ) -- Load scene with same root filename as this file local scene = composer.newScene( sceneName ) local styledText = require("styledText") --local loadsave = require("loadSave") --local appodeal = require("plugin.appodeal") --------------------------------------------------------------------------------- local screenW, screenH, halfW = display.actualContentWidth, display.actualContentHeight, display.contentCenterX local sheetWindowOptions = { frames = { { name=border, x = 772, y = 1401, width = 13, height = 602}, { name=levelBG, x = 0, y = 0, width = 927, height = 742}, { name=menuSkinnyBorder, x = 0, y = 1401, width = 770}, { name=menuThickBorder, x = 0, y = 744, width = 927}, { name=skinnyBar, x = 0, y = 1936, width = 445} }, sheetContentWidth = 1024, sheetContentHeight = 2048 } local windowSheet = graphics.newImageSheet("windowSprite.png", sheetWindowOptions) local window local myText function scene:create( event ) local sceneGroup = self.view -- Called when the scene's view does not exist -- -- INSERT code here to initialize the scene -- e.g. add display objects to 'sceneGroup', add touch listeners, etc local background = display.newImageRect( sceneGroup, "background.png", display.actualContentWidth, display.actualContentHeight ) background.anchorX = 0 background.anchorY = 0 background.x = 0 + display.screenOriginX background.y = 0 + display.screenOriginY window = display.newImageRect(sceneGroup, windowSheet, 2, screenW\*.60, screenH\*.95) window.x = display.contentCenterX window.y = display.contentCenterY myText = styledText.newText({ text = "Welcome to the game!", textColor = {255,255,255,255}, x = display.contentCenterX, y = display.contentCenterY, font = "Arial", size = 60, shadowOffset = 5, shadowColor = {0,0,0,.5}, glowOffset = 1, glowColor = {120,3,3,180}, blurGlow = 0 }) myText:toFront() sceneGroup:insert(myText) end function scene:show( event ) local sceneGroup = self.view local phase = event.phase if phase == "will" then -- Called when the scene is still off screen and is about to move on screen -- yourScoreText = display.newEmbossedText(sceneGroup, "GAME OVER", display.contentCenterX, screenH\*.05, native.systemFont, 36) -- yourScoreText:setFillColor(0) elseif phase == "did" then -- Called when the scene is now on screen -- -- INSERT code here to make the scene come alive -- e.g. start timers, begin animation, play audio, etc end end function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if event.phase == "will" then -- Called when the scene is on screen and is about to move off screen -- -- INSERT code here to pause the scene -- e.g. stop timers, stop animation, unload sounds, etc.) elseif phase == "did" then -- Called when the scene is now off screen end end function scene:destroy( event ) local sceneGroup = self.view -- Called prior to the removal of scene's "view" (sceneGroup) -- -- INSERT code here to cleanup the scene -- e.g. remove display objects, remove touch listeners, save state, etc end --------------------------------------------------------------------------------- -- Listener setup scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) --------------------------------------------------------------------------------- return scene

Assuming that you saved this file as something like “scene1.lua”, and then you have another file “main.lua” that changes scene to this one, the code that you’ve pasted works fine for me (after I drop some random images in place for the 2 that you reference).

So main.lua looks something like this:

local composer = require("composer") composer.gotoScene( "scene1", "fade", 400 )

Are you on Windows or Mac?

I am on windows, below is my main.lua.   Not sure why, but it still doesn’t work for me.  Once I hit reload it just reverts to white text. 

--------------------------------------------------------------------------------- -- -- main.lua -- --------------------------------------------------------------------------------- -- hide the status bar display.setStatusBar( display.HiddenStatusBar ) -- require the composer library local composer = require "composer" -- Add any objects that should appear on all scenes below (e.g. tab bar, hud, etc) -- Reserve channel 1 for background music audio.reserveChannels( 1 ) -- Seed the random number generator math.randomseed( os.time() ) -- Add any system wide event handlers, location, key events, system resume/suspend, memory, etc. -- load scene1 composer.gotoScene("menu")

I also just tested your setup and it works fine with me (using mac). I re-loaded the simulator many times and I could see the styled text every time. I have attached a zip of the test project for you to compare.

 I just took your test.zip, and it didn’t have any stylized text.  This must be a simulator bug.  

I am on a Corona 2017.3176, Windows 10.  Thoughts?

Although it may be a simulator bug, I wouldn’t jump to that conclusion.  Being the code author, I’m going to assume that it’s a mistake I made in the Lua code somewhere :)  Perhaps the Mac platform is just hiding the problem.

I’ll try it on Windows this weekend.

I downloaded test.zip so I was working with the exact code as you two.

I replicated the problem on Windows 10 with Corona 2017.3178 - the text appears, but all of the styling (glow, shadow, etc) does not appear.  I played with the code a little but don’t see what’s causing the problem yet.  I’m not normally on Windows so this may take a few days.

Great! So I’m not crazy…or doing something horribly wrong LoL. Thanks for looking into it.

What happens if you try and deploy it to a device?

Keep in mind you are using a third-party library that our Engineers know nothing about, which limits our ability to help. You should consider reaching out to the author of the library and have them also see if they can get it working under Windows.

Rob

He already did… that’s me :)  Working on it.

Hey Rob! I haven’t tried deploying to a device yet. I was planning on it though but prairie west (above) is the author and is working it now.

Great!

I’ve opened a bug report, but honestly don’t understand if the docs around display.capture() are saying that this is “working as documented”.  I’ll get back to you with the result.

Awesome, thanks I’ll be looking forward to it!  This is a cool tool that I’d love to take advantage of.  Fancy/stylized text can really brighten up an App and being able to just type what you want it to say vs having to create images for all the text (with like photoshop or something) makes it so much easier.  

Assuming that you saved this file as something like “scene1.lua”, and then you have another file “main.lua” that changes scene to this one, the code that you’ve pasted works fine for me (after I drop some random images in place for the 2 that you reference).

So main.lua looks something like this:

local composer = require("composer") composer.gotoScene( "scene1", "fade", 400 )

Are you on Windows or Mac?

I am on windows, below is my main.lua.   Not sure why, but it still doesn’t work for me.  Once I hit reload it just reverts to white text. 

--------------------------------------------------------------------------------- -- -- main.lua -- --------------------------------------------------------------------------------- -- hide the status bar display.setStatusBar( display.HiddenStatusBar ) -- require the composer library local composer = require "composer" -- Add any objects that should appear on all scenes below (e.g. tab bar, hud, etc) -- Reserve channel 1 for background music audio.reserveChannels( 1 ) -- Seed the random number generator math.randomseed( os.time() ) -- Add any system wide event handlers, location, key events, system resume/suspend, memory, etc. -- load scene1 composer.gotoScene("menu")

I also just tested your setup and it works fine with me (using mac). I re-loaded the simulator many times and I could see the styled text every time. I have attached a zip of the test project for you to compare.

 I just took your test.zip, and it didn’t have any stylized text.  This must be a simulator bug.  

I am on a Corona 2017.3176, Windows 10.  Thoughts?

Although it may be a simulator bug, I wouldn’t jump to that conclusion.  Being the code author, I’m going to assume that it’s a mistake I made in the Lua code somewhere :)  Perhaps the Mac platform is just hiding the problem.

I’ll try it on Windows this weekend.

I downloaded test.zip so I was working with the exact code as you two.

I replicated the problem on Windows 10 with Corona 2017.3178 - the text appears, but all of the styling (glow, shadow, etc) does not appear.  I played with the code a little but don’t see what’s causing the problem yet.  I’m not normally on Windows so this may take a few days.