Storyboard and display objects

What I am trying to do is have an image and some other stuff that is inside of a display object appear barely on the screen and when tapped to transition on the screen like this

mainGroup = display.newGroup ( )  
subGroup = display.newGroup ( )  
  
bg = display.newRect(0,0,display.contentWidth,display.contentHeight)  
bg:setFillColor ( 220, 0, 0 )  
  
mainGroup:insert(bg)  
  
bg2 = display.newRect(0,0,display.contentWidth,display.contentHeight)  
bg2:setFillColor ( 0, 220, 0 )  
subGroup:insert(bg2)  
  
c1 = display.newCircle( 100, 100, 20 )  
c1:setFillColor ( 100, 30, 30 )  
subGroup:insert(c1)  
  
c2 = display.newCircle( 180, 200, 40 )  
c2:setFillColor ( 10, 120, 110 )  
subGroup:insert(c2)  
  
c3 = display.newCircle( 380, 520, 90 )  
c3:setFillColor ( 10, 12, 210 )  
subGroup:insert(c3)  
  
subGroup.x, subGroup.y = 0,display.contentHeight - 50  
  
mainGroup:insert(subGroup)  
  
function move()  
 print("Moving")  
 x = transition.to( subGroup, { time=1500, alpha=1, x=(0), y=(0) } )  
end  
  
bg2:addEventListener ( "tap", move )  

When I try this in my project and create everything in storyboards createScene function then add the event listener in the enterScene function it throws an error like this

Runtime error
?: in function ‘addEventListener’

any ideas on what I’m doing wrong? It’s kinda late and I have been banging my head on this for a while

I know I could use the built in storyboard overlay thing but didn’t want to go that route but if I had this would probably be done by now :frowning: [import]uid: 105129 topic_id: 36107 reply_id: 336107[/import]

Where in the code are you placing the move() function?

Make sure it is above all the storyboard functions otherwise at the point where you are adding the event listener the function has not yet been defined. [import]uid: 93133 topic_id: 36107 reply_id: 143444[/import]

I am placing the move() function inside of the enterScene() storyboard function and adding the eventListener after the function is created, the display objects are created in the createScene() storyboard function.

There are other images being created the same way and I don’t have any problems with those, however they are placed in the mainGroup not the subGroup.
[import]uid: 105129 topic_id: 36107 reply_id: 143472[/import]

Where in the code are you placing the move() function?

Make sure it is above all the storyboard functions otherwise at the point where you are adding the event listener the function has not yet been defined. [import]uid: 93133 topic_id: 36107 reply_id: 143444[/import]

I am placing the move() function inside of the enterScene() storyboard function and adding the eventListener after the function is created, the display objects are created in the createScene() storyboard function.

There are other images being created the same way and I don’t have any problems with those, however they are placed in the mainGroup not the subGroup.
[import]uid: 105129 topic_id: 36107 reply_id: 143472[/import]

Where in the code are you placing the move() function?

Make sure it is above all the storyboard functions otherwise at the point where you are adding the event listener the function has not yet been defined. [import]uid: 93133 topic_id: 36107 reply_id: 143444[/import]

I am placing the move() function inside of the enterScene() storyboard function and adding the eventListener after the function is created, the display objects are created in the createScene() storyboard function.

There are other images being created the same way and I don’t have any problems with those, however they are placed in the mainGroup not the subGroup.
[import]uid: 105129 topic_id: 36107 reply_id: 143472[/import]

Where in the code are you placing the move() function?

Make sure it is above all the storyboard functions otherwise at the point where you are adding the event listener the function has not yet been defined. [import]uid: 93133 topic_id: 36107 reply_id: 143444[/import]

I am placing the move() function inside of the enterScene() storyboard function and adding the eventListener after the function is created, the display objects are created in the createScene() storyboard function.

There are other images being created the same way and I don’t have any problems with those, however they are placed in the mainGroup not the subGroup.
[import]uid: 105129 topic_id: 36107 reply_id: 143472[/import]