AS3 Talking Avatar library for Starling
Description
Supported devices:
on any Android or iOS devices that supports Air apps
plus Starling desktop apps
Files Included:
- .as3proj (FlashDevelop AIR sample project)
- .as (source codes)
- Five sample vector avatars
- asDoc type Documentation
check out the none-starling version here
Sample Android App
with using this little but cool library, you will be able to initialize a talking avatar in your Starling Air mobile projects. You will be able to choose from current available avatars in your “bin” folder and insert your own voice .mp3 file and then addChild the Avatar class anywhere in your project and you’re done.
import com.doitflash.utils.avatar.StarlingAvatar;
import com.doitflash.utils.avatar.AvatarEvent;
// set Class variable
var _avatar:StarlingAvatar;
// initialize a _holder. avatar will be addchilded in _holder.
// _holder must have a specific width and height so we create a new Shape() in the _holder
var _holder:Sprite = new Sprite();
var rect:Shape = new Shape();
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 address to the avatar graphic you'd like to use
_avatar.voiceUrl = "test.MP3"; // set the address to the mp3 file which you like to use for lip-syncing
// call this method and load the avatar graphic begins
_avatar.loadAvatar();
private function onLoadedAvatar(e:AvatarEvent):void
{
// call this method and load the mp3 file begins
_avatar.loadVoice();
}
private function onLoadedVoice(e:AvatarEvent):void
{
trace("sound length: ", e.param); // mp3 length is based on miliseconds
// use this listener to be notified when the mp3 playback is finished.
_avatar.addEventListener(AvatarEvent.SOUND_PLAY_FINISHED, onPlayComplete);
// call this method and the mp3 file starts playing
_avatar.play();
}
private function onPlayComplete(e:AvatarEvent):void
{
trace("onPlayComplete");
}
// call this method to pause the mp3 file while playing and it returns the millisecond position of the sound.
// you can use this position to play the mp3 again and start from where it was paused.
// var position:Number = _avatar.pause();
// _avatar.play(position);
//
// call this method to stop the sound.
// _avatar.stop();
// When you're done with this class, call this method to clean up the memory.
// _avatar.dispose();
we used the DMT library for dynamically generating textures to be used in Starling: https://github.com/XTDStudios/DMT
| Author | tahadaf |
|---|---|
| Category | Mobile |
| Price | $18 |
| Sales | 0 |
| Published | Mar 19, 2014 |
| Last Update | Mar 19, 2014 |
| Compatible Software | iOS 7.0.x, iOS 6.0, iOS 5.1, iOS 5.0, iOS 4.3, iOS 4.2, Android 4.4.x, Android 4.3.x, Android 4.0, Android 3.1, Android 2.3.3 |
| Mobile Files Included | .apk |
External listing. code.market does not sell this product and does not process payment for it. Pricing, payment, delivery, licensing, refunds, and support are handled by the third-party merchant on its own website. We may earn an affiliate commission from a referral. Details.
Products of the Week.
Submit🥇
Free LinkedIn Likes From Real Members | LinkedInLikes
Get free LinkedIn likes on your posts from real members who react by hand. No password needed: you only share a link.
Website · 12,847 views · 46 clicksWebsite · Week 49 · 12,847 views · 46 clicks
🥈
Free Medium Claps From Real Writers | MediumPlace
Free Medium claps on your stories from verified accounts of real writers, each given by hand. No bots, no Medium password, nothing to pay. Paste a link.
Website · 7,964 views · 10 clicksWebsite · Week 49 · 7,964 views · 10 clicks
🥉
Free GitHub Stars From Real Developers | GitWow
Get free GitHub stars on your repository from real developers who star by hand. No token or password, and it's free.
Website · 15,624 views · 28 clicksWebsite · Week 49 · 15,624 views · 28 clicks
#4
Free Substack Likes From Real Writers | StackRooms
Free Substack likes on your posts and Notes from verified accounts of real writers, given by hand. Free to ask, free to receive. Just share a link.
Website · 7,784 views · 2 clicksWebsite · Week 49 · 7,784 views · 2 clicks
#5
Free Twitter Likes From Real People | SupaTwitter
Free Twitter likes on your tweets from verified accounts of real people, each given by hand. No bots, no Twitter password, nothing to pay. Paste a link.
Website · 7,679 views · 4 clicksWebsite · Week 49 · 7,679 views · 4 clicks
#6
Free X Likes From Real People, Given by Hand | XFast
Free X likes on your posts from verified accounts of real people, each one given by hand. No bots, no X password, no conditions. Paste a link to start.
Website · 7,591 views · 0 clicksWebsite · Week 49 · 7,591 views · 0 clicks