آموزش بافرینگ صدا در فلش و اکشن اسکریپت 3

++Hadi++

Active Member
سلام
سمپل رو دانلود کنید ... از کد هاش متوجه می شید ...

PHP:
//Sample By Hadi Abbasi->++Hadi++
//forum.majidonline.com
import flash.media.Sound;
import flash.events.Event;
import flash.net.URLRequest;
import flash.media.SoundLoaderContext;
import flash.media.SoundChannel;
import flash.events.ProgressEvent;
import flash.events.IOErrorEvent;

var sound:Sound=new Sound();
var soundChannle:SoundChannel=new SoundChannel();
sound.addEventListener(Event.COMPLETE,comp);
sound.addEventListener(IOErrorEvent.IO_ERROR,Err);
sound.addEventListener(ProgressEvent.PROGRESS,progresss);
var context:SoundLoaderContext=new SoundLoaderContext(8000,false);
barr.scaleX=0;

sound.load(new URLRequest("http://av.adobe.com/podcast/csbu_dev_podcast_epi_2.mp3"),context);
soundChannle=sound.play();

function Err(evt:IOErrorEvent):void
{
    trace("Error");
}
function progresss(evt:ProgressEvent):void
{
    trace("Loaded-> "+sound.bytesLoaded/sound.bytesTotal);
    barr.scaleX=sound.bytesLoaded/sound.bytesTotal;
}
function comp(evt:Event):void
{
    trace("Complete!");
}
موفق باشید ...
 

پیوست ها

  • Sound Buffer Sample.rar
    184.5 کیلوبایت · بازدیدها: 182

جدیدترین ارسال ها

بالا