Sound.hx

Sound import module for importing wav and mp3 sound files.

Summary
Sound.hxSound import module for importing wav and mp3 sound files.
soundImports a wav or mp3 file as DefineSound swf tag.

sound

Imports a wav or mp3 file as DefineSound swf tag.

Mandatory attributes

importPath to the file to be imported.
classClass name assigned to imported data.

Optional attributes

genclass(false, symbolOnly, symbolAndClass) Controls the generation of symbols and AS3 class stubs.  Available values are: false (don’t generate neither symbol nor AS3 class stub), symbolOnly (generate only symbol), symbolAndClass (generate symbol and AS3 class stub)

Superclass

flash.media.SoundThe superclass of AS3 class stub.

Example 1

Assuming that Sound import module is assigned to namespace snd the following snippet imports pickup.mp3, exports it with symbolclass name resources.PickupSound and generates a corresponding AS3 class stub (default behavior):

<snd:sound import="pickup.mp3" class="resources.PickupSound"/>

Example 2

Manual creation of class stub.  First import the file with genclass set to symbolOnly

<snd:sound import="explode.wav" class="resources.ExplodeSound" genclass="symbolOnly"/>

then define the class stub in haXe:

package resources;

class ExplodeSound extends flash.media.Sound {
   public function new() {
      super();
   }
}
Close