-2
클릭하면 창으로 이동하는 버튼을 만들려고합니다. 이미 창을 만들고 자체 .js 파일을 만들었습니다. 나는 버튼을 작동시킬 수 없다. 내가 잘못 가고있는 곳을 제안한다. 여기 내 코드는 다음과 같습니다.버튼에 이벤트 리스너 추가 티타늄, 윈도우에 연결
var platformWidth = Titanium.Platform.displayCaps.platformWidth;
var platformHeight = Titanium.Platform.displayCaps.platformHeight;
var win = Titanium.UI.currentWindow;
var playButton = Titanium.UI.createButton({
title: "Play",
style:Titanium.UI.iPhone.SystemButtonStyle.BORDERED,
center: {
x: platformWidth * 0.5,
y: platformHeight * 0.5
}
});
win.add(playButton);
playButton.addEventListener('click' , function() {
playButton.url='playWindow.js'
});
나는 연결된 페이지에서 작업하는 탭을 가지고 있기 때문에 playWindow.js가 작동한다는 것을 알고 있습니다. 내가 다른 파일로 다른 창을 가진 것이 좋은 생각인지 궁금
playWindow.js
var platformWidth = Titanium.Platform.displayCaps.platformWidth;
var platformHeight = Titanium.Platform.displayCaps.platformHeight;
var win = Titanium.UI.currentWindow;
var testTextField = Titanium.UI.createTextField({
backgroundColor: 'white',
borderStyle: Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
center: {
x: platformWidth * 0.5,
y: platformHeight * 0.3 },
width: platformWidth * 1
});
win.add(testTextField);
. 그들은 올바르게 작동하지 않는 것 같습니다. 어떻게 탭을위한 간단한 코드가 없다는 것입니까 (예 : window : 'playWindow')?
제 질문에 대해 연구 노력이 전혀 없다고 말하면 -1이 있습니다. 나는 지난 4 ~ 5 시간 동안 너무 단순한 해결책을 찾기 위해 노력했다. 아마도 너무 단순하다. 내가 할 수 있기를 원하는 건 한 페이지에 버튼이 있습니다, 클릭 할 때, 다른 간다 ...
TIA 앙
나는 이것을 시험해 보았지만 여전히 작동하지 않는다. 잘 작동하지만 실제 playWindow.js에 제대로 연결되지 않는다. (다른 배경을 가지고있다.) –
plz playWindow.js의 코드를 붙여 넣는다. –
var platformWidth = Titanium.Platform.displayCaps.platf ormWidth; var platformHeight = Titanium.Platform.displayCaps.platformHeight; var win = Titanium.UI.currentWindow; VAR testTextField Titanium.UI.createTextField = ({ \t의 backgroundColor : \t의 BorderStyle '흰색', Titanium.UI.INPUT_BORDERSTYLE_ROUNDED \t 센터 { \t \t X : platformWidth * 0.5 \t \t는 Y : platformHeight * 0.3 \t}, \t 폭 : platformWidth * 1 \t }); win.add (testTextField); –