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:1370 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
相关文章
LinkedIn API
Integration of the Console into the Menu for the simulator
Welcome Eric Herrmann and Evan Kirchhoff
App deadlocks during a transition.to on Android
Shuffling table values
auto-rotation on Android
Garbage collection?
Riddenhurst >> An Epic Point and Click Adventure Game
An error occurred during the build!
Accelerometer in Simulator (+implementation idea)
Integration of the Console into the Menu for the simulator
Welcome Eric Herrmann and Evan Kirchhoff
App deadlocks during a transition.to on Android
Shuffling table values
auto-rotation on Android
Garbage collection?
Riddenhurst >> An Epic Point and Click Adventure Game
An error occurred during the build!
Accelerometer in Simulator (+implementation idea)
corona forums © 2003-2011