단순한 소리 만 재생하는 데 문제가있어서 기능이 정의되지 않았습니다. 사운드 파일은 올바른 위치에 있으므로 잘못된 점을 알지 못합니다. 나는 이것에 초심자이다 그래서 도움은 다량 평가된다.티타늄에서 소리내는 중 오류가 있습니다. 기능을 찾을 수 없습니다.
//Level 1 Page
var win = Titanium.UI.currentWindow;
var tab = Titanium.UI.currentTab;
var leveloneview = Ti.UI.createView({
width : '100%',
height : '100%',
backgroundColor : 'blue',
});
var tile1 = Ti.UI.createImageView({
bottom : '100',
width : '100',
height : '100',
image : "images/pirate-icon.png",
});
var tile2 = Ti.UI.createImageView({
left : '50',
bottom : '100',
width : '100',
height : '100',
image : "images/pirate-icon.png",
});
var tile3 = Ti.UI.createImageView({
right : '50',
bottom : '100',
width : '100',
height : '100',
image : "images/pirate-icon.png",
});
var sound = Titanium.Media.createSound({
url : 'sounds/wheres_me_rum.mp3',
preload : true
});
var button = Ti.UI.createButton({
title : 'Click to play sound',
width : '200',
height : '40',
top : 20,
align:'center',
});
button.addEventListener('click', function(e) {
sound.play();
});
leveloneview.add(tile1);
leveloneview.add(tile2);
leveloneview.add(tile3);
leveloneview.add(button);
win.add(leveloneview);
정확한 오류 로그를 추가 할 수 있습니까? – phil
Uncaught TypeError : /index.html에서 undefined가 (라인 6080) – SavageShadow
의 함수가 아닙니다. Ti.Media.createsound 및 버튼 이벤트 리스너가 추가되었으므로이 오류가 발생했음을 잊어 버렸습니다. 그 전에 .js 파일이로드됩니다. – SavageShadow