Reputation: 193
I am developing a game with AIR for android and Starling framework. I am using Flash CC as IDE. When I test i inside flash it works fine but when I publish it to android it does not work properly.
I have a Screen Manager Class that hides and shows Menu , Level selection and game-play screens. For that I have a custom Event Class. The function below is inside the Screen manager class. It is working for every destination value but not for TO_GAME.
private function onNavigate(e: NavEvent)
{
if (e.destination == Destination.TO_HOME)
{
menuScreen.wake();
}
else if (e.destination == Destination.TO_LEVELS)
{
levelScreen.wake();
}
else if (e.destination == Destination.TO_GAME)
{
gameScreen.wake();
}
else if (e.destination == Destination.TO_HELP)
{
helpScreen.wake();
}
else if (e.destination == Destination.TO_ABOUT)
{
aboutScreen.wake();
}
}
he event is fired when the user clicks a level button. See the else part
var btn:Button = e.target as Button;
if (btn == backBtn)
{
this.dispatchEvent(new NavEvent(NavEvent.NAVIGATE , Destination.TO_HOME));
this.sleep();
}
else
{
//just testing if I can get the level number from the position of the level button
trace(this.getLevelNumber(btn.x,btn.y));
this.dispatchEvent(new NavEvent(NavEvent.NAVIGATE , Destination.TO_GAME));
this.sleep();
}
I fired this event from different buttons but no luck so far. It is working inside he IDE but nothing happens inside the device. All other events are working. Event the first condition in the above function is working fine.
Upvotes: 0
Views: 42
Reputation: 193
When publishing on AIR for Android platform, you should keep in mind that file names are case sensitive.
For example I had a file named "LevelData.json". Notice the capital 'D'.
I was loading this file into starling asset-Manager like below
assets.enqueue(dir.resolvePath("Data/Levels/leveldata.json"));
Note that I used the small letter for 'd'. Since windows has case insensitive file names, it did not cause any problem but when I ran the application on an actual Android device. It did not work. So I changed the original file name to "leveldata.json" ans voila! The app runs fine now.
Upvotes: 1