Zurück   Flashforum > Flash > ActionScript > ActionScript 2

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 20-04-2006, 13:17   #1 (permalink)
Neuer User
 
Registriert seit: Jun 2005
Beiträge: 67
der flv-player läüft immer weiter... soll aber stoppen!

hallo,
ich habe vor einiger zeit bei der großartigen seite gotoandlearn, dei leider momentan offliner ist, ein tutorial für einen xml flv player gemacht. alles funktioniert soweit auch einwandfrei, allerdings wird das ausgewählte video immer wieder abgespielt, und ich würde dieses gerne am ende stoppen.

hab schon im AS rumprobiert, leider ohen erfolg. vielleicht weiß jeman dvon euch rat...

agedoubleyou hatte mir zwar schon verraten, welcher befehl zum anhalten notwendig ist, sprich ns.pause(true); allerdings bekomm ich es nur hin, dass das video direkt stoppt. das möchte ich aber gar nicht. ich möchte, dass es direkt geladen wird, so wie jetzt auch, allerdings soll der film am ende stehen bleiebn und nicht wie jetzt in einer Schleife durchlaufen!

ich bekomms aber net hin!

so sieht das AS aus:

Code:
var nc:NetConnection = new NetConnection();
nc.connect(null);

var ns:NetStream = new NetStream(nc);

theVideo.attachVideo(ns);


ns.setBufferTime(10);

ns.onStatus = function(info) {
    if(info.code == "NetStream.Buffer.Full") {
        bufferClip._visible = false;
    }
    if(info.code == "NetStream.Buffer.Empty") {
        bufferClip._visible = true;
    }
    if(info.code == "NetStream.Play.Stop") {
        ns.seek(0);
    }
}

playButton.onRelease = function() {
    ns.pause();
}

rewindButton.onRelease = function() {
    ns.seek(0);
}

this.createEmptyMovieClip("vFrame",this.getNextHighestDepth());
vFrame.onEnterFrame = videoStatus;

var amountLoaded:Number;
var duration:Number;

ns["onMetaData"] = function(obj) {
    duration = obj.duration;
}

function videoStatus() {
    amountLoaded = ns.bytesLoaded / ns.bytesTotal;
    loader.loadbar._width = amountLoaded * 208.9;
    loader.scrub._x = ns.time / duration * 208.9;
}

var scrubInterval;

loader.scrub.onPress = function() {
    vFrame.onEnterFrame = scrubit;
    this.startDrag(false,0,this._y,208,this._y);
}

loader.scrub.onRelease = loader.scrub.onReleaseOutside = function() {
    vFrame.onEnterFrame = videoStatus;
    this.stopDrag();
}

function scrubit() {
    ns.seek(Math.floor((loader.scrub._x/208)*duration));
}

var theMenu:ContextMenu = new ContextMenu();
theMenu.hideBuiltInItems();
_root.menu = theMenu;

var item1:ContextMenuItem = new ContextMenuItem("::::: Video Controls :::::",trace);
theMenu.customItems[0] = item1;

var item2:ContextMenuItem = new ContextMenuItem("Play / Pause Video",pauseIt,true);
theMenu.customItems[1] = item2;

var item3:ContextMenuItem = new ContextMenuItem("Replay the Video",restartIt);
theMenu.customItems[2] = item3;

var item4:ContextMenuItem = new ContextMenuItem("© 2005 Lee Brimelow",trace,true);
theMenu.customItems[3] = item4;

function pauseIt() {
    ns.pause();
}

function stopIt() {
    ns.seek(0);
    ns.pause();
}

function restartIt() {
    ns.seek(0);
}

_root.createEmptyMovieClip("vSound",_root.getNextHighestDepth());
vSound.attachAudio(ns);

var so:Sound = new Sound(vSound);

so.setVolume(100);

mute.onRollOver = function() {
    if(so.getVolume()== 100) {
        this.gotoAndStop("onOver");
    }
    else {
        this.gotoAndStop("muteOver");
    }
}

mute.onRollOut = function() {
    if(so.getVolume()== 100) {
        this.gotoAndStop("on");
    }
    else {
        this.gotoAndStop("mute");
    }
}

mute.onRelease = function() {
    if(so.getVolume()== 100) {
        so.setVolume(0);
        this.gotoAndStop("muteOver");
    }
    else {
        so.setVolume(100);
        this.gotoAndStop("onOver");
    }
}

var vlist:XML = new XML();
vlist.ignoreWhite = true;

vlist.onLoad = function() {
    var videos:Array = this.firstChild.childNodes;
    for(i=0;i<videos.length;i++) {
        videoList.addItem(videos[i].attributes.desc,videos[i].attributes.url);
    }
    
    ns.play(videoList.getItemAt(0).data);
    videoList.selectedIndex = 0;
}
    
var vidList:Object = new Object();

vidList.change = function() {
    ns.play(videoList.getItemAt(videoList.selectedIndex).data);
}

videoList.addEventListener("change",vidList);

vlist.load("videos.xml");

videoList.setStyle("selectionColor",0xCCCCCC);
videoList.setStyle("textSelectedColor",0x000000);
videoList.setStyle("rollOverColor",0xCCCCCC);
hat jemand von euch nen tipp? ;-)
dasend ist offline   Mit Zitat antworten
Alt 20-04-2006, 18:28   #2 (permalink)
agedoubleju
Gast
 
Beiträge: n/a
Zitat:
if(info.code == "NetStream.Play.Stop") {
ns.seek(0);
}
Wenn du hier stattdessen ns.pause(true) setzt, stoppt der Film am Ende. Hab allerdings deinProblem nicht verstanden... Willst du doch nicht stoppen?
  Mit Zitat antworten
Alt 21-04-2006, 07:54   #3 (permalink)
Neuer User
 
Registriert seit: Jun 2005
Beiträge: 67
doch danke Dir agedoubleju! das war genau das was ich nicht hinbekommen habe...

jetzt funktionierts endlich wie es soll...
dasend ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 12:31 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele