Forward referencing an ui button

Is there a way to forward reference an ui button as we can do with other components. Check the attached code:

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
31
32
    local act_action_421 
 
       local Shape1  
       local Layer1  
  
       function act_action_421 (event) 
         transitionStash.newTransition = transition.to( Shape 1, {alpha=0, time=1000, delay=0}) 
       end 
 
 
 
       Layer1 = display.newImageRect( imgDir.. "p1_layer1.png", 1024, 768 ); 
       Layer1.x = 512; Layer1.y = 384; Layer1.alpha = 1 
 
 
       local onShape1Touch = function(event) 
          if event.phase=="ended" then  
            act_action_421() 
          end 
       end 
       Shape1 = ui.newButton{ 
           defaultSrc=imgDir.."p1_shape1.png", 
           defaultX = 280, 
           defaultY = 70, 
           overSrc=imgDir.."p1_shape1.png", 
           overX = 280, 
           overY = 70, 
           onRelease=onShape1Touch, 
           id="Shape1Button" 
       } 
 
       Shape1.x = 401; Shape1.y = 362; Shape1.alpha = 1 

Hello, on line 7 you have an extra space on the first argument passed to transition.to()

Should be like this:

1
transitionStash.newTransition = transition.to( Shape1, {alpha=0, time=1000, delay=0})

Nothing like a fresh eye :) thanks a lot Raul!

views:1408 update:2011/11/5 17:18:39
corona forums © 2003-2011