views:

33

answers:

1

import flash.net.URLLoader; import fl.video.*; import flash.utils.getTimer;

fk.autoPlay = false;

// Parametreleri yüklüyoruz. var myLoaderInfo=new Object();

//Parametrelerin yuklendigine emin olmak için false yapıldı.bunun daha sonra true olması gerekiyor. myLoaderInfo.myParamsLoaded = false;

// Event.complete i cagırmak için kullanılır. myLoaderInfo.loaderComplete = loaderComplete;

//video yuklendiginde myLoaderInfo.loaderComplete i cagırır. this.loaderInfo.addEventListener(Event.COMPLETE, myLoaderInfo.loaderComplete);

// Degiskenler yüklendiginde fonksiyon cagrılır. myLoaderInfo.useParams = useParams;

function loaderComplete(myEvent:Event) { this.myParams = this.loaderInfo.parameters; this.myParamsLoaded = true;//Parametrelerin yuklendigine emin olduk.

this.useParams();

//Başlangıç zamanından 1 saniye sonrasına kadar video yuklendi.
//fk.bufferTime = startTime+1;
//Video oynatılıyor.
fk.play(src);

}

//degiskenler tanımlandı. var src:String; var startTime:Number; var stopTime:Number;

//Parametreleri aldık. function useParams() { var obj:Object = new Object();

var j;
for (j in this.myParams)
{
    if (j == "url")
    {
        src = this.myParams[j];
    }
    else if (j=="bas")
    {
        startTime = int(this.myParams[j]);
    }
    else
    {
        stopTime = int(this.myParams[j]);
    }
}

}

fk.addEventListener(VideoEvent.READY, bitti); function bitti(eventObject:VideoEvent):void { //Videonun başlangıcını başlangıç zamanına getirdik. fk.seekSeconds(startTime);

}

// Her karede kontrol edecegizki, durma zamanını geçirmeyelim addEventListener(Event.ENTER_FRAME,myFunction); function myFunction(event:Event) { if (fk.playheadTime > stopTime) { fk.pause(); } }

hi; i have a video.First it loads.Then it starts from time that i want to.Also it stops from time i want to.But i want to load my video only from starttime to stoptime.How can i do this or which method can i use? thanks for any help.

+1  A: 

To start a video at a specific location, you're probably going to want to use the NetStream object: http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/net/NetStream.html and .seek(seconds) to get to the starting keyframe closest to the number of seconds you pass.

As far as stopping it, you can always setup a timer to fire after so many seconds after playing to stop the video.

There's a good resource for NetStream here: http://plasticsturgeon.com/?p=6

Andir
thanks.but i want to load only between starttime and stoptime.And as you can see i write the code that stops my video in enter frame event so my video stops at stoptime then when i press the play button it doesn't resume.so i want to ask what's the most painless way to dynamically load only the part of video required?
merve_89