Alpha Transition Not Working with "newTextField"

Hi guys,

I notice this possible bug in “transition.to()” function. It occurs when I do an “alpha” transition for a “newTextField”. Other transitions (e.g. easing.inExpo) is ok.

It is used in a storyboard.

Code :

txtInputUsername = native.newTextField( 0, 0, TEXT\_INPUT\_BOX\_WIDTH , TEXT\_INPUT\_BOX\_HEIGHT, txtInputUsernameHandler ) transition.to( txtInputUsername , { time=transitionTime3,  alpha = 1.0  } )  

Error Produced :

Attempt to perform arithmetic on a string value…

* corrected code

You newTextField is named “txtInputUsername” and you are doing a transition on “txtInputLastName”.

That being said you will not see this transition on some or all Android devices. Also transitioning position will not work.  See Gotchas: http://docs.coronalabs.com/daily/api/library/native/newTextField.html

Popular workaround is to transition an white box and then make the input box on top of it once transition is complete. 

Thanks jon. I copy/paste wrongly. I have corrected the sample code.

Thanks for pointing out that the “newTextField” does not obey the “alpha”, as stated in the document :

Also, they do not inherit display group properties like isVisible, x, y, rotation, and alpha.

Would appreciate a more detailed error message from Corona, instead of just a “runtime error” with no specific line in the code.

You newTextField is named “txtInputUsername” and you are doing a transition on “txtInputLastName”.

That being said you will not see this transition on some or all Android devices. Also transitioning position will not work.  See Gotchas: http://docs.coronalabs.com/daily/api/library/native/newTextField.html

Popular workaround is to transition an white box and then make the input box on top of it once transition is complete. 

Thanks jon. I copy/paste wrongly. I have corrected the sample code.

Thanks for pointing out that the “newTextField” does not obey the “alpha”, as stated in the document :

Also, they do not inherit display group properties like isVisible, x, y, rotation, and alpha.

Would appreciate a more detailed error message from Corona, instead of just a “runtime error” with no specific line in the code.

@jonjonsson

I read this from the docs:

“Because native text fields are not part of the OpenGL canvas, they do not obey the Corona display object hierarchy. For example, while they can be manipulated using display object methods, they always appear above normal display objects, and cannot be inserted into display groups.”

Could you please share how to put a box above the TextField? Thanks before.

I mean that you put a white box (display.newRect) where you want to have your textField. So when the scene is transitioning it looks like its the real text field. When the transition is finished (in enterScene) you create your textField on top of the newRect in the same size. When scene is about to exit, you destroy your textField and the newRect is left behind to transition with the exit.

@jonjonsson

I read this from the docs:

“Because native text fields are not part of the OpenGL canvas, they do not obey the Corona display object hierarchy. For example, while they can be manipulated using display object methods, they always appear above normal display objects, and cannot be inserted into display groups.”

Could you please share how to put a box above the TextField? Thanks before.

I mean that you put a white box (display.newRect) where you want to have your textField. So when the scene is transitioning it looks like its the real text field. When the transition is finished (in enterScene) you create your textField on top of the newRect in the same size. When scene is about to exit, you destroy your textField and the newRect is left behind to transition with the exit.