sound.onInitialize()

16 views
Skip to first unread message

Steve Marcus

unread,
Sep 21, 2013, 12:09:34 PM9/21/13
to alternate-java-bridg...@googlegroups.com
How do you use sound.onInitialize()? 

Is this so you can do something once the sounds have been loaded? How would you call it?

Imp Inc

unread,
Sep 21, 2013, 1:55:02 PM9/21/13
to alternate-java-bridg...@googlegroups.com
It's a method that is called internally. It's used to load the sounds into memory at screen initialization. So, there's no real need to put a Event here, as you can already capture the screen initialized event. The general screen init event is thrown after any components have run their onInitialize methods.

Ryan

Steve Marcus

unread,
Sep 22, 2013, 8:51:35 AM9/22/13
to alternate-java-bridg...@googlegroups.com
Ok. Well I am getting a strange result:

Using the sound component, I use addSource in $define() to add a bunch of sound sources, which are stored in raw folder.

Using my 'fast' phone, android 4.3 this works fine and the sounds play no problem.

Using my 'slow' phone, android 2.3.3 AND using emulator, I get a bunch of error 703: Unable to Play <empty> messages. But only intermittently. Sometimes they play and sometimes they don't. 

I suspect the sounds have not loaded in time to play them? If I put the sound.Play() in a clock timer, it seems to work better, but not all the time.

Any ideas?

Steve Marcus

unread,
Sep 27, 2013, 12:51:42 PM9/27/13
to alternate-java-bridg...@googlegroups.com
I came up with a solution - my app has a splash screen which is always open.

I made a sound component public static on this screen and loaded the sounds.

Then I can call a sound from another screen anytime and there are no more errors.

Imp Inc

unread,
Sep 27, 2013, 1:18:27 PM9/27/13
to alternate-java-bridg...@googlegroups.com
Nice. Sorry I haven't had much time to help out lately.

Also, one thing I've done in the past is use a FormService for music/sounds, or anything else that may need to be accessed from any screen.

Ryan
Reply all
Reply to author
Forward
0 new messages