This is my Logo class
var LoadCnt = 0;
var Game = {};
var maxX = 480;
var maxY = 800;
var scaleRatioX = 1, scaleRatioY = 1;
var gameRatio = window.innerWidth / window.innerHeight;
var firstRunLandscape;
var mTex_SoundOnBut;
var Snd_Theme, snd_GameOver, snd_levelComplete;
Game.Logo = function (game) {
};
Game.Logo.prototype = {
init: function () {
},
preload: function () {
// firstRunLandscape = this.game.scale.isGameLandscape;
},
create: function () {
var scroller = game.add.existing(new ScrollableArea(10, 10, game.width, game.height));
var textStyle = { font: "30px Arial", fill: "#ffff00" };
for (var i = 0; i < 10; i++) {
for (var j = 0; j < 80; j++) {
var text = game.make.text(i * 330, j * 30, "Yes, everything scrolls", textStyle);
text.name = 'text-' + i + '_' + 'j';
text.inputEnabled = true;
text.input.useHandCursor = true;
text.events.onInputDown.add(sayName, this);
scroller.addChild(text);
}
}
scroller.start();
// setEggs(-0.75, 0.52);
},
update: function () {
},
}
function sayName(e) {
console.log("in sayName " + e.name);
}
And following is my index.html file
Bunny Egg Fun
<script src="js/phaser-scrollable.min.js"></script>
<script src="js/Logo.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<style>
body {
margin: 0px;
padding: 0px;
}
#turn {
width: 100%;
height: 100%;
position: fixed;
top: 0px;
left: 0px;
background-color: white;
background-image: url('assets/portrait.png');
background-repeat: no-repeat;
background-position: center center;
display: none;
z-index: 2;
}
</style>
</head>
<body>
<div id = "turn"></div>
<script type="text/javascript">
window.onload = function()
{
// var gameRatio = window.innerWidth/window.innerHeight;
// window.scrollTo(0,1);
game = new Phaser.Game(480,800,Phaser.CANVAS,'GameCanvas');
game.state.add('Logo', Game.Logo);
game.state.start('Logo');
};
</script>
</body>