I would like to put a title for each level that appears for a couple of seconds. Since the wallpaper and the title text size change from level to level, I want to put a 80% opaque black rectangle behind the white text, and make the black rectangle auto-adjusting to the text size (since I rather not manually create the text bg one by one).
Is this possible?
Label: corona android iphone ipad building error inmobi problem display screen View image tableView failed object physics touch button game lua config event listener |
Self adjustable text background box?
not sure what u r looking for but something like this can help
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | local function newTextinblackRect(str,x,y,font,height) local myText = display.newText(str,x,y,font,height) local width = myText.width local height = myText.height local rect = display.newRect(x-5,y-5,width+10,height+10) rect:setFillColor(255,0,0,100) local myGroup = display.newGroup() myGroup:insert(rect) myGroup:insert(myText) return myGroup end local function callMe(e) e.target:removeSelf() end for i=1,10 do myText = newTextinblackRect(math.random(1000),10*i,30*2*i,nil,36) myText:addEventListener("tap",callMe) end |
Didn't realize you could get height and width value from a text element!
I 'll give it a try.
Thanks!!
you welcome
:)
views:1371 update:2011/11/25 8:45:21
热门文章
GameCenter LeaderBoards and Achievements Enabled Through OpenFeint
send message and call to a person
Forum: Report Spam + PM
[INSTALL_PARSE_FAILED_NO_CERTIFICATES]
[SOLVED] Director ERROR: Failed to execute new( params ) function on 'screen1'
Too many (200) local variables
Corona SVG Level Builder released. Drag and drop physics level editor with Inkscape and SVG.
Small bug in Collectible Items example
Pivot Joints and apparent elasticity
Can't make removeSelf() delayed
send message and call to a person
Forum: Report Spam + PM
[INSTALL_PARSE_FAILED_NO_CERTIFICATES]
[SOLVED] Director ERROR: Failed to execute new( params ) function on 'screen1'
Too many (200) local variables
Corona SVG Level Builder released. Drag and drop physics level editor with Inkscape and SVG.
Small bug in Collectible Items example
Pivot Joints and apparent elasticity
Can't make removeSelf() delayed
相关文章
how to switch levels with buttons
MysticGlyph a Monument of Mystery Wrapped in a Riddle
TabBar, buttons and pages
showWebPopup
Tiles separating on rotation or scale
Custom iOS Wheel Picker **Looks Native** Download
disable a button for some time
Asset Localization
Are Android phones reliable?
Stop draggable Objects, After and before of variable change
MysticGlyph a Monument of Mystery Wrapped in a Riddle
TabBar, buttons and pages
showWebPopup
Tiles separating on rotation or scale
Custom iOS Wheel Picker **Looks Native** Download
disable a button for some time
Asset Localization
Are Android phones reliable?
Stop draggable Objects, After and before of variable change
corona forums © 2003-2011