0
votes

I'm making a simple game in Flash CC using Adobe Air and publishing for Android. The movie compiles correctly and the sound plays fine on the desktop, but when publishing to Android nothing plays from my phone. I've tried using a different phone as well, and there's no sound coming out of it. My code is below:

package  {

import flash.display.MovieClip;
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.media.Sound;
import flash.net.URLRequest;

public class MainGame extends MovieClip {

    public var sndBoop:Boop = new Boop();

    public function MainGame() {

        gameTimer = new Timer(1500);
        gameTimer.addEventListener(TimerEvent.TIMER, createNewCircle);
        gameTimer.start();
    }

    public function createNewCircle(event:TimerEvent):void {

        sndBoop.play();
    }

}

}

The sound I have is a .wav file that's linked to the Boop class in the library. I've tried using a .mp3 file, adding in the sound file during the packaging settings, using the URLRequest method of grabbing an external sound file, or internal sound file. None of these methods work. It's still just playing on the desktop or emulator, but not on my actual phone. I've used three phones so far, and they all aren't playing the sound.

Is there something I've overlooked?

1
gameTimer is not declared so it should produce an error right away. Is this a pseudo code? - BotMaster
I have public var newCircle:Circle; public var newHeader:Header; public var gameTimer:Timer; added in above the call to the Boop class, I just removed them for the sake of length. - aschmelyun
Premissions maybe? Check the manifest. - Travis
What's the phone you're testing on? The sound might be too low (has more bass) in frequency, so the speakers on the phone might not be able to play it. I used to have the same issue on a game and in the end opted to buy other sounds. You should also check if the sound is exported in frame 1. - Cristina Georgescu
HTC One, Galaxy S4 and Galaxy S3. I believe the sound is being exported in Frame 1. Should it not be? - aschmelyun

1 Answers

0
votes

It appears that the problem was being caused by the compression method in Flash. Changing it from MP3 to RAW now makes the sound play on all devices. I don't know why this is the case, but it's a workaround for now.