
Supported units:
on any Android or iOS units that helps Air apps
plus Starling desktop apps
Recordsdata Included:
- .as3proj (FlashDevelop AIR pattern mission)
- .as (supply codes)
- 5 pattern vector avatars
- asDoc sort Documentation
check out the none-starling version here
Sample Android App
with utilizing this little however cool library, it is possible for you to to initialize a speaking avatar in your Starling Air cell initiatives. It is possible for you to to select from present obtainable avatars in your “bin” folder and insert your personal voice .mp3 file after which addChild the Avatar class anyplace in your mission and also you’re finished.
import com.doitflash.utils.avatar.StarlingAvatar;
import com.doitflash.utils.avatar.AvatarEvent;
// set Class variable
var _avatar:StarlingAvatar;
// initialize a _holder. avatar might be addchilded in _holder.
// _holder should have a particular width and peak so we create a brand new Form() within the _holder
var _holder:Sprite = new Sprite();
var rect:Form = new Form();
rect.graphics.beginFill(0xf64a5f, 1);
rect.graphics.drawRect(0, 0, 400, 600);
_holder.addChild(rect);
_holder.x = 100;
_holder.y = 100;
this.addChild(_holder);
// initialize the StarlingAvatar
_avatar = new StarlingAvatar();
// add a listener to be notified when the avatar is loaded
_avatar.addEventListener(AvatarEvent.LOADED_AVATAR, onLoadedAvatar);
// add a listener to be notified when the mp3 file is loaded
_avatar.addEventListener(AvatarEvent.LOADED_VOICE, onLoadedVoice);
_avatar.holder = _holder;
_avatar.avatarUrl = "WomanAvatar.swf"; // set the handle to the avatar graphic you want to make use of
_avatar.voiceUrl = "take a look at.MP3"; // set the handle to the mp3 file which you want to make use of for lip-syncing
// name this technique and cargo the avatar graphic begins
_avatar.loadAvatar();
non-public perform onLoadedAvatar(e:AvatarEvent):void
{
// name this technique and cargo the mp3 file begins
_avatar.loadVoice();
}
non-public perform onLoadedVoice(e:AvatarEvent):void
{
hint("sound size: ", e.param); // mp3 size is predicated on miliseconds
// use this listener to be notified when the mp3 playback is completed.
_avatar.addEventListener(AvatarEvent.SOUND_PLAY_FINISHED, onPlayComplete);
// name this technique and the mp3 file begins enjoying
_avatar.play();
}
non-public perform onPlayComplete(e:AvatarEvent):void
{
hint("onPlayComplete");
}
// name this technique to pause the mp3 file whereas enjoying and it returns the millisecond place of the sound.
// you should use this place to play the mp3 once more and begin from the place it was paused.
// var place:Quantity = _avatar.pause();
// _avatar.play(place);
//
// name this technique to cease the sound.
// _avatar.cease();
// Whenever you're finished with this class, name this technique to scrub up the reminiscence.
// _avatar.dispose();
we used the DMT library for dynamically producing textures for use in Starling: https://github.com/XTDStudios/DMT

