Website templates, flash templates, oscommerce skins, video loops, free stuff !

Create a Flv player without using media components

Posted by admin | Published 2006-07-18 | 44444

First you need to create a new video object,so you need to open your library,left click the uper right icon and select "new video".Now you have a video object in your library,drag it onto the stage.

Give the video object this instance name:my_video

Select the first frame in your timeline(on a new layer),open the action panel and enter the following actionscript:

var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
my_video.attachVideo(stream_ns);
stream_ns.play("Flv_files/"+_root.moviestatus+".flv");
stream_ns.onStatus=function(infoObject){
if(infoObject.code=="NetStream.Play.Stop"){
stream_ns.seek(0);
stream_ns.play();
}
};

this.createTextField("loaded_txt", this.getNextHighestDepth(), 10, 10, 160, 22);
this.createEmptyMovieClip("progressBar_mc", this.getNextHighestDepth());
progressBar_mc.createEmptyMovieClip("bar_mc", progressBar_mc.getNextHighestDepth());
with (progressBar_mc.bar_mc) {
beginFill(0x000000);
moveTo(0, 0);
lineTo(100, 0);
lineTo(100, 10);
lineTo(0, 10);
lineTo(0, 0);
endFill();
_xscale = 0;
}
progressBar_mc.createEmptyMovieClip("stroke_mc", progressBar_mc.getNextHighestDepth());
with (progressBar_mc.stroke_mc) {
lineStyle(0, 0x000000);
moveTo(0, 0);
lineTo(100, 0);
lineTo(100, 10);
lineTo(0, 10);
lineTo(0, 0);
}

var loaded_interval:Number = setInterval(checkBytesLoaded, 500, stream_ns);
function checkBytesLoaded(my_ns:NetStream) {
var pctLoaded:Number = Math.round(my_ns.bytesLoaded/my_ns.bytesTotal*100);
loaded_txt.text = Math.round(my_ns.bytesLoaded/1000)+" of "+Math.round(my_ns.bytesTotal/1000)+" KB loaded ("+pctLoaded+"%)";
progressBar_mc.bar_mc._xscale = pctLoaded;
if (pctLoaded>=100) {
removeMovieClip(progressBar_mc);
removeMovieClip(loaded_txt);
clearInterval(loaded_interval);
}
}

Note:I have used some variables here:

stream_ns.play("Flv_files/"+_root.moviestatus+".flv");

Flv_files=the folder where the flv movies are.
moviestatus=A variable that defines wicth movie will be played(can be changed by a button for example).

That's all Enjoy

Author: Christophe Seynaeve




Poor Excellent
Your Name:
Title:
Comment:
Verification code:
CAPTCHA



play avi files
posted by katazina on 2008-03-09
Hi! I want to ask, that you know how can play avi files with flash without convert it to flv? Thanks!

air compressor
posted by air compressor on 2008-04-28
If you are looking for an air compressor, you have come to the right place. To see all the air compressors Grainger offers, please visit our homepage.Air Compressors Direct Specializes in Air Compressors, air compressor, Portable Air Compressor, Portable Air Compressors ...

Runescape Money
posted by Runescape Money on 2008-04-29
Runescape Money, Buy runescape money. We provide cheap Runescape Gold to reliable customer.Offering runescape gp,runescape gp gold and runescape gp 2 gold are collected...We provide all Runescape Gold services. The professional Runescape Money store.Welcome to buy runescape money.Cheaper price, deliver fast, 24/7 buy runescape gold shop.
 
 
 
Copyright © 2006 Flashtrue Layouts. All Rights Reserved.
Flashtrue Directory - Articles & Tutorials  | Web design News | Terms of use | FAQ
Flash video loops Website Templates Website Templates