Just recently switched back to Director 1.4 and for some odd reason
i cant forward reference anything anymore O.o any ideas?
Label: corona android iphone ipad building error inmobi problem display screen View image tableView failed object physics touch button game lua config event listener |
Can't forward reference anymore
can u provide some sample code??
Forward referencing problem
Here is a sample of what I am experiencing.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | new = function ( params ) local localGroup = display.newGroup() local bg local tapevent bg = display.newImage("bg.png", true) bg.xScale = .58 bg.yScale = .58 bg.x = display.contentWidth / 2 bg.y = display.contentHeight / 2 localGroup:insert(bg) bg:addEventListener( "tap", tapevent ) function tapevent( event ) print( "touched" ) end return localGroup end |
HOOOK! my bad, i understand what i did wrong now, mistake on my part.
If anyone else has issues forward referencing listener functions check to make sure they're called AFTER being declared in a function. Forgot the code has to run through it all first. Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | local localGroup = display.newGroup() local group = display.newGroup() local bg local touch local go localGroup:insert( group ) ------------------------------------- ------------------------------------- function go() bg = display.newImage("bg.png", true) bg.xScale = .58 bg.yScale = .58 bg.x = display.contentWidth / 2 bg.y = display.contentHeight / 2 bg:addEventListener( "tap", touch ) group:insert(bg) end function touch( event ) print( "touched" ) end go() |
views:1503 update:2012/1/1 13:29:50
热门文章
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
相关文章
Plants vs. Zombies Tutorial
Some Windows issues
How to replace long text by dots (...)
build.settings: IPhone Portrait & Ipad landscape
How to implement inneractive for android, & what's the code please?
Sharing function : Calling a function from require file
How can I delay a function??
Invalid Binary
Corona Meetup happening in San Francisco this Friday, Nov 12th!
Autorotate video to fullscreen on Android?
Some Windows issues
How to replace long text by dots (...)
build.settings: IPhone Portrait & Ipad landscape
How to implement inneractive for android, & what's the code please?
Sharing function : Calling a function from require file
How can I delay a function??
Invalid Binary
Corona Meetup happening in San Francisco this Friday, Nov 12th!
Autorotate video to fullscreen on Android?
corona forums © 2003-2011