Textfield wont go off-screen.. WTF?

I am trying to transition a textfield from within the screen bounds to outside…
The textfield does not go beyond the edge of the screen…

Seriously pissing me off :expressionless:
Heres a plug-an-play code

[lua]local username = native.newTextField(0,0,100,30)
username:setReferencePoint(display.CenterReferencePoint)
username.y = 100
username.x = 100

timer.performWithDelay(2000,function()
transition.to(username,{x=900})
end,1)[/lua]

Heres a screenshot
[import]uid: 64174 topic_id: 34805 reply_id: 334805[/import]

I’m not sure if this is actually a problem but you actually don’t define a time within the Transition.to parameters idk if that might fix the problem. Does it go off the screen if you just set the x or y instead of transitioning? [import]uid: 14461 topic_id: 34805 reply_id: 138340[/import]

No defining time is not the issue here…

If I give
[lua]local username = native.newTextField(0,0,100,30)
username.x =900[/lua]
it works well,
But if I change the position with a time delay
If I give
[lua]local username = native.newTextField(0,0,100,30)
timer.performWithDelay(2000,function()
username.x = 900
end,1)[/lua]
does not work.

This is driving me nuts :expressionless: [import]uid: 64174 topic_id: 34805 reply_id: 138350[/import]

I see you’re using a native text object.

I found this in the docs

…Also, they do not inherit display group properties like isVisible, x, y, rotation, and alpha. If you need to set display properties on native objects, apply them to the objects directly.

What happens if you try to set the ‘left’ property instead of x?
[import]uid: 70847 topic_id: 34805 reply_id: 138351[/import]

Er… what is “left” property???

Regarding [text]apply them to the objects directly[/text], thats what I am doing. In my second code snippet, [lua]username.x = 900[/lua] is applying directly, right? [import]uid: 64174 topic_id: 34805 reply_id: 138354[/import]

I don’t know why that’s happening, but you could do this:

[code]
local username = native.newTextField(0,0,100,30)
username:setReferencePoint(display.CenterReferencePoint)
username.y = 100
username.x = 100

local function moveIt(obj)
obj.x = 900
end

timer.performWithDelay(2000,function()
transition.to(username,{x=900, onComplete=moveIt})
end,1)
[/code] [import]uid: 199310 topic_id: 34805 reply_id: 138408[/import]

Left property?? What was I talking about!? Anyway I was able to reproduce your problem, and it’s definitely a bug.

I was able to work around the issue by setting isVisible=false when the transition is finished. I also added an alpha transition to make it look nicer instead of the textbox just disappearing.

local username = native.newTextField(0,0,100,30)  
username:setReferencePoint(display.CenterReferencePoint)  
username.y = 100  
username.x = 100  
   
timer.performWithDelay(2000,function()   
 transition.to(username,{x=900, alpha=0, onComplete=function(obj) obj.isVisible=false end})  
end,1)  

for some reason setting x or y in a transition (even in onComplete) just doesn’t want to work…
EDIT:
I now realized that setting isVisible is not necessary since changing the alpha effectively hides the text box… DUH! I think I need more coffee :wink: [import]uid: 70847 topic_id: 34805 reply_id: 138427[/import]

@ingemar
Yeah [lua]isVisible=false[/lua] is what I did…

Actually, I first set [lua]alpha=0[/lua] instaead of settings isVisible=false… What happened was the textField still responded to User Touch, and the textField became visible…
So resorted to[lua]isVisible=false[/lua] finally…
And yeah, alpha transition sounds like a good idea! CHEERS!
@Rob
I did not try that out out I don’t think that would work either… My understanding is that, if you want to set your textField off-screen, the only way to do is in the SAME FRAME WHERE THE TEXT FIELD WAS CREATED… Afterwords it is not possible… [import]uid: 64174 topic_id: 34805 reply_id: 138429[/import]

I could be wrong, but like mentioned above - isn’t a time parameter crucial to the transition , isn’t that how it defines the speed to move to the x location: speed = distance/time? [import]uid: 33275 topic_id: 34805 reply_id: 138449[/import]

default time is 500ms if not specified… [import]uid: 70847 topic_id: 34805 reply_id: 138451[/import]

I didn’t know that, thanks for clarifying :slight_smile: [import]uid: 14461 topic_id: 34805 reply_id: 138549[/import]

I’m not sure if this is actually a problem but you actually don’t define a time within the Transition.to parameters idk if that might fix the problem. Does it go off the screen if you just set the x or y instead of transitioning? [import]uid: 14461 topic_id: 34805 reply_id: 138340[/import]

No defining time is not the issue here…

If I give
[lua]local username = native.newTextField(0,0,100,30)
username.x =900[/lua]
it works well,
But if I change the position with a time delay
If I give
[lua]local username = native.newTextField(0,0,100,30)
timer.performWithDelay(2000,function()
username.x = 900
end,1)[/lua]
does not work.

This is driving me nuts :expressionless: [import]uid: 64174 topic_id: 34805 reply_id: 138350[/import]

I see you’re using a native text object.

I found this in the docs

…Also, they do not inherit display group properties like isVisible, x, y, rotation, and alpha. If you need to set display properties on native objects, apply them to the objects directly.

What happens if you try to set the ‘left’ property instead of x?
[import]uid: 70847 topic_id: 34805 reply_id: 138351[/import]

Er… what is “left” property???

Regarding [text]apply them to the objects directly[/text], thats what I am doing. In my second code snippet, [lua]username.x = 900[/lua] is applying directly, right? [import]uid: 64174 topic_id: 34805 reply_id: 138354[/import]

I don’t know why that’s happening, but you could do this:

[code]
local username = native.newTextField(0,0,100,30)
username:setReferencePoint(display.CenterReferencePoint)
username.y = 100
username.x = 100

local function moveIt(obj)
obj.x = 900
end

timer.performWithDelay(2000,function()
transition.to(username,{x=900, onComplete=moveIt})
end,1)
[/code] [import]uid: 199310 topic_id: 34805 reply_id: 138408[/import]

Left property?? What was I talking about!? Anyway I was able to reproduce your problem, and it’s definitely a bug.

I was able to work around the issue by setting isVisible=false when the transition is finished. I also added an alpha transition to make it look nicer instead of the textbox just disappearing.

local username = native.newTextField(0,0,100,30)  
username:setReferencePoint(display.CenterReferencePoint)  
username.y = 100  
username.x = 100  
   
timer.performWithDelay(2000,function()   
 transition.to(username,{x=900, alpha=0, onComplete=function(obj) obj.isVisible=false end})  
end,1)  

for some reason setting x or y in a transition (even in onComplete) just doesn’t want to work…
EDIT:
I now realized that setting isVisible is not necessary since changing the alpha effectively hides the text box… DUH! I think I need more coffee :wink: [import]uid: 70847 topic_id: 34805 reply_id: 138427[/import]

@ingemar
Yeah [lua]isVisible=false[/lua] is what I did…

Actually, I first set [lua]alpha=0[/lua] instaead of settings isVisible=false… What happened was the textField still responded to User Touch, and the textField became visible…
So resorted to[lua]isVisible=false[/lua] finally…
And yeah, alpha transition sounds like a good idea! CHEERS!
@Rob
I did not try that out out I don’t think that would work either… My understanding is that, if you want to set your textField off-screen, the only way to do is in the SAME FRAME WHERE THE TEXT FIELD WAS CREATED… Afterwords it is not possible… [import]uid: 64174 topic_id: 34805 reply_id: 138429[/import]

I could be wrong, but like mentioned above - isn’t a time parameter crucial to the transition , isn’t that how it defines the speed to move to the x location: speed = distance/time? [import]uid: 33275 topic_id: 34805 reply_id: 138449[/import]

default time is 500ms if not specified… [import]uid: 70847 topic_id: 34805 reply_id: 138451[/import]