Antworten auf deine Fragen:
Neues Thema erstellen

Flash Webplayer ohne URL-Streaming

elyion_g2

Ach Jungs!?!

hi leute

hab hier mal ein kleines skript

kann mir jemand sagen wie ichs hindbringe, das er keine URL sondern eine normale datei liesst....also sprich nicht:
"http://......mp4"
sondern
".mp4"


Code:
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;

var nc:NetConnection = new NetConnection();
nc.connect(null);
stage.displayState = StageDisplayState.NORMAL;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
var ns:NetStream = new NetStream(nc);
ns.client = this;
//to be used if movie on some other domain
/*
var domain:String = "http://www.somewebpage.com";
var _vidURL:String = domain + "/video/" + _vidName;
*/
//var _vidName:String = "http://beispiel.ch/video.mp4";
var domain:String ="local";
var _vidURL:String= "http://www.elyion.ch/video.mp4";
var ending:Boolean = false;
var bandwidth = "highest";//low, mid, high or highest for bandwidth speed
var amountLoaded:Number;
var duration:Number;
var testy:Number;
var testy2:Number;
var durNum:uint;
var MathNum:uint;
var loly:Number;
var finy:String;
var sixty:uint;
var minty:uint;
var singy:String = 0;
var norRewindButton:Object = {he:rewindButton.height,we:rewindButton.width,xe:rewindButton.x,ye:rewindButton.y};
var norPlayButton:Object = {he:playButton.height,we:playButton.width,xe:playButton.x,ye:playButton.y};
var norMute:Object = {he:mute.height,we:mute.width,xe:mute.x,ye:mute.y};
var norControlBarInstance:Object = {he:controlBarInstance.height,we:controlBarInstance.width,xe:controlBarInstance.x,ye:controlBarInstance.y};
var norSoundLContainer:Object = {he:soundLContainer.height,we:soundLContainer.width,xe:soundLContainer.x,ye:soundLContainer.y};
var norFullScreenButton:Object = {he:fullScreenButton.height,we:fullScreenButton.width,xe:fullScreenButton.x,ye:fullScreenButton.y};
var norLoader:Object = {he:loader.height,we:loader.width,xe:loader.x,ye:loader.y};
var norTheVideo:Object = {he:theVideo.height,we:theVideo.width,xe:theVideo.x,ye:theVideo.y};
var steadyY:Number = norLoader.ye;
var normalSW:Number = stage.stageWidth;
var normalSH:Number = stage.stageHeight;
var trueSW:Number;
var trueSH:Number;
var onlyOnce:uint = 1;
var fullSH:Number;
var fullSW:Number;
theVideo.smoothing = true;
//theVideo.visible = false;

var playTween:Tween;
var showTween:Tween;
var tweenOnce;
var tryOnce:Number = 2;
var localPoint3:Point = new Point(2,2);

var globalPoint3:Point = new Point(2,2);

var playPause_mc:playPause = new playPause  ;
playPause_mc.x = stage.stageWidth / 2 - (playPause_mc.width / 2);
playPause_mc.y = stage.stageHeight / 2 - playPause_mc.height / 2;


//////////////////////////////

// getting clien resolution using a cookie javascript 
// not Really usable but some people have
//var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
//var userWidth:Number = paramObj["itemID1"];
//var userHeight:Number = paramObj["itemID2"];
// Way better for getting client resolution without cookies
var userWidth:Number = flash.system.Capabilities.screenResolutionX;
var userHeight:Number = flash.system.Capabilities.screenResolutionY;
//
var sWidth:Number;
var sHeight:Number;
var mWidth:Number;
var mHeight:Number;
var stageRel:Number;
var mRel:Number;
var trueRel:Number;
var mRel2:Number;
var trueRel2:Number;
var calcPer:Number;
var calcMPer:Number;
var fullBottomRel:Number;
var fullTopRel:Number;
var fullBottomMRel:Number;
var fullTopMRel:Number;
var fullLeftMRel:Number;
var fullRightMRel:Number;
var hardBottomMRel:Number;
var hardTopMRel:Number;
var hardLeftMRel:Number;
var hardRightMRel:Number;
var getDClickTime:uint = 1;
// checks the video and client screen resolution and ratio and prepares it for outputing on stage
function getMovieSize() {
    if ((!sWidth && !sHeight || stage.displayState == StageDisplayState.NORMAL)) {
        sWidth = stage.stageWidth;
        sHeight = stage.stageHeight;
    }
    else {
        sWidth = trueSW;
        sHeight = trueSH;
    }
    //trace(sWidth + "x" + sHeight);
    normalRel = normalSW / normalSH;
    trueRel = userWidth / userHeight;
    trueRel2 = sHeight / sWidth;
    calcMPer = normalRel * 100 / mRel * sHeight / 100 - sHeight;
    calcMPer2 = trueRel2 * 100 / mRel2 * sWidth / 100 - sWidth;
    calcMPerFull = mRel * 100 / trueRel * mHeight / 100 - mHeight;
    calcMPer2Full = mRel2 * 100 / trueRel2 * mWidth / 100 - mWidth;
    calcMPerFullX = trueRel * 100 / mRel * mWidth / 100 - mWidth;
    calcHDFull = calcMPerFull / 2;
    calcHDFull2 = calcMPer2Full / 2;
    calcHDFullX = calcMPerFullX / 2;

    if (trueRel <= mRel) {
        fullTopMRel =  -  calcMPer / 2;
        fullBottomMRel = sHeight + calcMPer;
        fullRightMRel = sWidth;
        fullLeftMRel = 0;
        /////
        hardLeftMRel = 0;
        hardTopMRel = 0;
        hardBottomMRel = mHeight + calcMPerFull;
        hardRightMRel = mWidth;

    }
    else {
        //new Rectangle(hardLeftMRel,hardTopMRel,hardRightMRel,hardBottomMRel);
        fullTopMRel = 0;
        fullBottomMRel = sHeight;
        fullLeftMRel =  -  calcMPer2 / 2;
        fullRightMRel = sWidth + calcMPer2;
        /////
        hardLeftMRel = 0;
        hardTopMRel = 0;
        hardBottomMRel = mHeight;
        hardRightMRel = mWidth + calcMPerFullX;


    }

    theVideo.width = fullRightMRel;
    theVideo.height = fullBottomMRel;
    theVideo.y = fullTopMRel;
    theVideo.x = fullLeftMRel;

}
///////////////////////////////////////////
//////////////////////////////////////////
// setTimer
var label:TextField;
var format:TextFormat;
label = new TextField();
format = new TextFormat();
addChild(label);
label.cacheAsBitmap = true;

var labelText:String = "--/--";
var labelY:uint = 237;
var labelClr:Number = 62;
var labelSiz:Number = 10;
configureLabel();

label.defaultTextFormat = format;
setLabel(labelText,labelY,labelClr,labelSiz);

///////////////////////////////

/////////////////////////////////

var loaderwidth:Number = loader.loadbar.width;
var timeOffset:Number = 0;
var pixelOffset:Number = 0;
var bt:Number = 2;
var isPaused:Boolean = true;
var stv:Number;
loader.mouseChildren = false;
rewindButton.mouseEnabled = false;
playButton.mouseEnabled = false;
playButton.mouseChildren = false;
var buts = loader.getChildByName("scrub");
var soundLo = soundLContainer.getChildByName("soundL");
var S1 = soundLContainer.getChildByName("soundL").Sone;
var S2 = soundLContainer.getChildByName("soundL").Stwo;
var S3 = soundLContainer.getChildByName("soundL").Sthree;
var S4 = soundLContainer.getChildByName("soundL").Sfour;
var S5 = soundLContainer.getChildByName("soundL").Sfive;
//if using new method without Video container
//var theVideo:Video = new Video(480,229);
//theVideo.x = 0;
//theVideo.y = 0;

var bufferClip:buffer = new buffer();
bufferClip.x = 300;
bufferClip.y = 130;
bufferClip.visible = false;

theVideo.attachNetStream(ns);
///using newest add child///
//theVideo.attachNetStream(ns);
/*videoContainer.x = 0;
videoContainer.y = 0;
videoContainer.height = 229;
videoContainer.width = 480;*/
addChild(bufferClip);


////////

//trace(loader.scrub.x);

switch (bandwidth) {
    case "low" :
        bt = 30;
        break;
    case "mid" :
        bt = 5;
        break;
    case "high" :
        bt = 2;
        break;
    case "highest" :
        bt = 1;
        break;

}
ns.bufferTime = bt;


function netstat(stats:NetStatusEvent) {
    //trace(stats.info.code);
    switch (stats.info.code) {
        case "NetStream.Buffer.Full" :
            bufferClip.visible = false;
            bufferClip.gotoAndStop(1);
            ending = false;
            clearInterval(statusID);
            statusID = setInterval(videoStatus,200);
            loader.mouseChildren = true;
            rewindButton.mouseEnabled = true;
            playButton.mouseChildren = true;
            stage.addChild(fscont);
            fscont.contextMenu = fullscreenCM;
            fscont.addEventListener(MouseEvent.CLICK, fscontClickOR);
            stage.addEventListener(KeyboardEvent.KEY_UP,lapPush);
            break;
        case "NetStream.Buffer.Empty" :
            if (! ending) {
                bufferClip.visible = true;
                bufferClip.gotoAndPlay(1);
            }
            break;
        case "NetStream.Play.Stop" :

            bufferClip.visible = false;
            bufferClip.gotoAndStop(1);
            //ending = true;
            break;
        case "NetStream.Play.Start" :
            bufferClip.visible = true;
            bufferClip.gotoAndPlay(1);
            ending = true;
            break;
        case "NetStream.Buffer.Flush" :
            ending = true;
            break;
    }
}
////////////////////////////////////////////
//gets the video information
function onMetaData(infoObject:Object):void {
    duration = infoObject.duration;
    //trace(duration);
    if (stage.displayState == "normal") {
        labelClr = normalSW / 2 - 35;
    }
    testy = infoObject.width;
    testy2 = infoObject.height;
    mWidth = testy;
    mHeight = testy2;
    mRel = mWidth / mHeight;
    mRel2 = mHeight / mWidth;
    getMovieSize();
    origMovieSize();
}
////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
function setLabel(str:String,alf:Number,clr:String,siz:Number):void {
    label.text = str;
    label.y = alf;
    label.x = clr;
    format.size = siz;
    label.defaultTextFormat = format;
}

function configureLabel():void {

    label.autoSize = TextFieldAutoSize.CENTER;
    label.background = false;
    label.border = false;
    label.x = stage.stageWidth / 2;
    label.y = 255;


    format.font = "Verdana";
    format.color = 0x000000;
    format.underline = false;

}
//////////////////////
//whenthe 1st button "play" is clicked
function playBtnB(e:MouseEvent) {
    play_btn.visible = false;
    restartIt();
    stage.addEventListener(MouseEvent.MOUSE_MOVE, toty3);
    statusID = setInterval(videoStatus,200);
    

}
//pause/resume button on mouseOver
function playButtonORO(e:MouseEvent) {
    if (isPaused) {
        playButton.gotoAndStop("onOver");
    }
    else {
        playButton.gotoAndStop("pauseOver");
    }
}
//pause/resume button on mouseOut
function playButtonOROut(e:MouseEvent) {
    if (isPaused) {
        playButton.gotoAndStop("on");
    }
    else {
        playButton.gotoAndStop("pause");
    }
}
//pause/resume button onClick
function playButtonOR(e:MouseEvent) {

    if (isPaused) {
        ns.togglePause();
        //ns.resume();
        isPaused = false;
        playButton.gotoAndStop("pauseOver");

    }
    else {
        ns.togglePause();
        //ns.pause();
        isPaused = true;
        playButton.gotoAndStop("onOver");
    }

}
//Clicking on the video/stage
function fscontClickOR(e:MouseEvent) {
    if (getDClickTime >= 3) {
        fullScreenButtonOR(void);
        fullScreenButtonOROut(void);
    }
    if (isPaused) {
        ns.togglePause();
        //ns.resume();
        isPaused = false;
        playButton.gotoAndStop("pause");
        playPause_mc.gotoAndPlay(61);
        getDClickTime++;
        getDWaitTime = 2;
    }
    else {
        ns.togglePause();
        //ns.pause();
        isPaused = true;
        playButton.gotoAndStop("on");
        addChild(playPause_mc);
        playPause_mc.gotoAndPlay(1);
        getDClickTime++;
        getDWaitTime = 2;
    }
}

///////////////////////////////////////////////////////
/// keyboard events

function lapPush(e:KeyboardEvent) {
    if (e.keyCode == Keyboard.SPACE) {
        if (isPaused) {
            ns.togglePause();
            //ns.resume();
            isPaused = false;
            playButton.gotoAndStop("pause");
            playPause_mc.gotoAndPlay(61);
        }
        else {
            ns.togglePause();
            //ns.pause();
            isPaused = true;
            playButton.gotoAndStop("on");
            addChild(playPause_mc);
            playPause_mc.gotoAndPlay(1);
        }
    }
    else if (e.keyCode == Keyboard.UP) {
        theVideo.height = theVideo.height + 10;
        theVideo.y = theVideo.y - 5;
        theVideo.smoothing = true;
    }
    else if (e.keyCode == Keyboard.DOWN) {
        theVideo.height = theVideo.height - 10;
        theVideo.y = theVideo.y + 5;
        theVideo.smoothing = true;
    }
    else if (e.keyCode == Keyboard.RIGHT) {
        theVideo.width = theVideo.width + 10;
        theVideo.x = theVideo.x - 5;
        theVideo.smoothing = true;
    }
    else if (e.keyCode == Keyboard.LEFT) {
        theVideo.width = theVideo.width - 10;
        theVideo.x = theVideo.x + 5;
        theVideo.smoothing = true;
    }

}


/////////
//clicking on rewindButton
function rewindButtonB(e:MouseEvent) {
    restartIt();
}
//////////////////////////////////////
//fullScreen/////
/////
///////FullscreenDesign
//////////
//runs when the fullscreen change happens
function fullScreenHandler(e:FullScreenEvent) {

    if (stage.displayState == StageDisplayState.NORMAL) {
        fscont.graphics.clear();
        fscont.graphics.beginFill(0xff0000, 1);
        fscont.graphics.drawRect(0,0,stage.stageWidth,stage.stageHeight - norControlBarInstance.he);
        playPause_mc.x = stage.stageWidth / 2 - (playPause_mc.width / 2);
        playPause_mc.y = stage.stageHeight / 2 - playPause_mc.height / 2;

        theVideo.smoothing = true;
        fullScreenButton.gotoAndStop("normal");
        Mouse.show();
        getMovieSize();

        controlBarInstance.width = norControlBarInstance.we;
        controlBarInstance.height = norControlBarInstance.he;
        controlBarInstance.y = norControlBarInstance.ye;
        controlBarInstance.x = norControlBarInstance.xe;
        rewindButton.width = norRewindButton.we;
        rewindButton.height = norRewindButton.he;
        rewindButton.y = norRewindButton.ye;
        rewindButton.x = norRewindButton.xe;
        playButton.width = norPlayButton.we;
        playButton.height = norPlayButton.he;
        playButton.y = norPlayButton.ye;
        playButton.x = norPlayButton.xe;
        mute.width = norMute.we;
        mute.height = norMute.he;
        mute.y = norMute.ye;
        mute.x = norMute.xe;
        soundLContainer.width = norSoundLContainer.we;
        soundLContainer.height = norSoundLContainer.he;
        soundLContainer.y = norSoundLContainer.ye;
        soundLContainer.x = norSoundLContainer.xe;
        fullScreenButton.width = norFullScreenButton.we;
        fullScreenButton.height = norFullScreenButton.he;
        fullScreenButton.y = norFullScreenButton.ye;
        fullScreenButton.x = norFullScreenButton.xe;
        loader.width = norLoader.we;
        loader.height = norLoader.he;
        loader.y = norLoader.ye;
        steadyY = loader.y;
        loader.x = norLoader.xe;
        loader.gotoAndStop("normalS");

        labelY = 255;
        labelSiz = 10;
        labelClr = sWidth / 2 - 35;
        setLabel(labelText,labelY,labelClr,labelSiz);
        origMovieSize();
    }
    else {

        fullSW = stage.stageWidth;
        fullSH = stage.stageHeight;
        theVideo.smoothing = false;
        play_btn.y = fullSH / 2;
        play_btn.x = fullSW / 2;
        playPause_mc.x = stage.stageWidth / 2 - (playPause_mc.width / 2);
        playPause_mc.y = stage.stageHeight / 2 - playPause_mc.height / 2;
        controlBarInstance.width = fullSW + 100;
        controlBarInstance.height = norControlBarInstance.he - 7;
        controlBarInstance.y = fullSH - controlBarInstance.height;
        //controlBarInstance.y = fullSH - norControlBarInstance.he;
        controlBarInstance.x = norControlBarInstance.xe;
        rewindButton.width = norRewindButton.we;
        rewindButton.height = norRewindButton.he;
        rewindButton.y = fullSH - norRewindButton.he - 13;
        rewindButton.x = norRewindButton.xe;
        playButton.width = norPlayButton.we;
        playButton.height = norPlayButton.he;
        playButton.y = fullSH - playButton.height - 13;
        playButton.x = norPlayButton.xe;
        fullScreenButton.width = norFullScreenButton.we;
        fullScreenButton.height = norFullScreenButton.he;
        fullScreenButton.y = fullSH - norFullScreenButton.he + 13;
        fullScreenButton.x = fullSW - norFullScreenButton.we / 2;
        soundLContainer.width = norSoundLContainer.we;
        soundLContainer.height = norSoundLContainer.he;
        soundLContainer.y = fullSH - norSoundLContainer.he - 7;
        soundLContainer.x = fullScreenButton.x - norSoundLContainer.we - 15;
        mute.width = norMute.we;
        mute.height = norMute.he;
        mute.y = fullSH - mute.height + 5;
        mute.x = soundLContainer.x - 23;
        labelY = fullSH - 25;
        labelSiz = 10;
        labelClr = mute.x - 90;
        setLabel(labelText,labelY,labelClr,labelSiz);
        loader.width = fullSW - norLoader.xe - (fullSW - labelClr);
        loader.height = norLoader.he;
        loader.y = fullSH - norLoader.he - 10;
        steadyY = loader.y;
        loader.x = norLoader.xe;
        loader.gotoAndStop("fullS");


    }

}


//fullScreen button on MouseOver
function fullScreenButtonORO(e:MouseEvent) {
    if (stage.displayState == StageDisplayState.NORMAL) {
        fullScreenButton.gotoAndStop("normalOver");
    }
    else {
        fullScreenButton.gotoAndStop("fullScreenOver");
    }

}

//fullScreen button on MouseOut
function fullScreenButtonOROut(e:MouseEvent) {
    if (stage.displayState == "normal") {
        fullScreenButton.gotoAndStop("normal");
    }
    else {
        fullScreenButton.gotoAndStop("fullScreen");
    }

}

//fullSCreen on Click
function fullScreenButtonOR(stats:Object):void {
    theVideo.x = 0;
    theVideo.y = 0;
    theVideo.width = mWidth;
    theVideo.height = mHeight;

    if (mWidth < 640 || mHeight < 480) {
        var getH:Number = 640 / trueRel;
        var getW:Number = 480 * trueRel;
        var scalingRect1:Rectangle;
        if (trueRel <= mRel) {
            scalingRect1 = new Rectangle(0,0,640,getH);

            fscont.graphics.clear();
            fscont.graphics.beginFill(0xff0000, 1);
            fscont.graphics.drawRect(0,0,640,getH - controlBarInstance.height);

        }
        else {
            scalingRect1 = new Rectangle(0,0,getW,480);

            fscont.graphics.clear();
            fscont.graphics.beginFill(0xff0000, 1);
            fscont.graphics.drawRect(0,0,getW,480 - controlBarInstance.height);

        }
        stage["fullScreenSourceRect"] = scalingRect1;
        if (stage.displayState == StageDisplayState.NORMAL) {
            stage.displayState = StageDisplayState.FULL_SCREEN;
            if (trueRel <= mRel) {
                theVideo.width = mWidth;
                theVideo.height = mHeight;
                inbetween = 640 - theVideo.width;
                inbetween2 = getH - theVideo.height;
                theVideo.x = inbetween / 2;
                theVideo.y = inbetween2 / 2;
            }
            else {
                theVideo.width = 640;
                theVideo.height = 480;
                inbetween = getW - theVideo.width;
                inbetween2 = 480 - theVideo.height;
                theVideo.x = inbetween / 2;
                theVideo.y = inbetween2 / 2;
            }
        }
        else {
            stage.displayState = StageDisplayState.NORMAL;
        }
    }
    else {
        var scalingRect:Rectangle = new Rectangle(hardLeftMRel,hardTopMRel,hardRightMRel,hardBottomMRel);
        fscont.graphics.clear();
        fscont.graphics.beginFill(0xff0000, 1);
        fscont.graphics.drawRect(hardLeftMRel,hardTopMRel,hardRightMRel,hardBottomMRel - controlBarInstance.height);
        stage["fullScreenSourceRect"] = scalingRect;
        if (stage.displayState == StageDisplayState.NORMAL) {
            stage.displayState = StageDisplayState.FULL_SCREEN;
            if (trueRel <= mRel) {
                theVideo.y = calcHDFull;
            }
            else {
                theVideo.x = calcHDFullX;
            }
        }
        else {
            stage.displayState = StageDisplayState.NORMAL;
        }
    }
}
var inty:uint = 1;
var globalPointCountX:Number = 1;
var globalPointCountY:Number = 1;
var tweenLoadbar:Tween;
var tweenScrub:Tween;
var beforetween:Number = 0;
var aftertween:Number = 0;
var beforetweenRed:Number = 0;
var aftertweenRed:Number = 0;
var countSec:uint = 1;
var countNoob:uint = 1;
var getDWaitTime:uint = 1;
//runs every 200ms for scrub and loaded movie
function videoStatus() {
    if (getDClickTime >= 3 && getDWaitTime == 2) {
        getDWaitTime = 1;
    }
    else {
        getDClickTime = 2;
    }
    if (globalPointCountX == globalPoint3.x && globalPointCountY == globalPoint3.y) {
        inty++;

    }
    globalPointCountX = globalPoint3.x;
    globalPointCountY = globalPoint3.y;

    if (inty >= 15) {
        toty2();
    }
    durNum = Math.floor(duration);
    mathNum = Math.floor(ns.time);
    minty = Math.floor(mathNum / 60);
    finty = Math.floor(durNum / 60);
    loly = Math.floor(((ns.time / 60 - minty) / 1.666666666 * 100));
    finy = Math.floor(((durNum / 60 - finty) / 1.666666666 * 100));

    if (finy < 10) {
        finy = "0" + finy;
    }
    if (loly < 10) {
        singy = "0" + loly;
    }
    else {
        singy = loly;
    }
    /////////////////////////////////////////////////////////////////////////////////////////////////////
    labelText = minty + ":" + singy + " / " + finty + ":" + finy;
    ////////////////////////////////////////////////////////////////////////////////////////////////

    if (duration) {
        setLabel(labelText,labelY,labelClr,labelSiz);
    }
    amountLoaded = ns.bytesLoaded / ns.bytesTotal;
    loader.loadbar.x = pixelOffset;
    beforetween = aftertween;
    aftertween = amountLoaded * (loaderwidth - pixelOffset);
    loader.loadbar.width = beforetween;
    tweenLoadbar = new Tween(loader.loadbar,"width",None.easeNone,beforetween,aftertween,0.2,true);

    if (countNoob == 2) {
        ns.resume();
        countNoob = 1;
    }
    if (countSec >= 6) {
        beforetweenRed = aftertweenRed;
        aftertweenRed = timeToPixel(ns.time);
        if (quickly == 2) {
            quickly = 1;
            ns.pause();
            countNoob = 2;
            tweenScrub.stop();
            tweenScrub = new Tween(loader.scrub,"width",None.easeNone,beforetweenRed,aftertweenRed,0.2,true);
            countSec = 5;
        }
        else {

            tweenScrub = new Tween(loader.scrub,"width",None.easeNone,beforetweenRed,aftertweenRed,1,true);
            countSec = 1;
        }
    }
    countSec++;
}
///////////////////////
//time
////////////////////////////////////////////////////////////////
//scrub

function scrubit() {


    var tofind = pixelToTime(loader.scrub.x);
    if (tofind <= 0) {
        restartIt();
        return;
    }
    ns.seek(tofind);
}
//////////////////////////////////////////////////////////////////
function restartIt() {
    pixelOffset = timeOffset = 0;
    ns.play(_vidURL);
    bufferClip.visible = true;
    isPaused = false;
    playButton.gotoAndStop("pause");
}
/////////////////////////////////////////////////////////////////7
// holds sound
/*
@Andrew: Use ns.soundTransform.volume :)

var st:SoundTransform=new SoundTransform();
st.volume = 1;
ns.soundTransform=st;
*/
var st:SoundTransform = new SoundTransform();
//mute button on MouseOver
function muteORO(e:MouseEvent) {
    if (st.volume != 0) {
        mute.gotoAndStop("onOver");
    }
    else {
        mute.gotoAndStop("muteOver");
    }
}
//mute button on MouseOut
function muteOROut(e:MouseEvent) {
    if (st.volume != 0) {
        mute.gotoAndStop("on");
    }
    else {
        mute.gotoAndStop("mute");
    }
}
//mute button on Click
function muteOR(e:MouseEvent) {
    if (st.volume != 0) {
        stv = st.volume;
        st.volume = 0;
        mute.gotoAndStop("muteOver");

    }
    else if (st.volume == 0) {
        if (stv) {
            st.volume = stv;
        }
        else {
            st.volume = 1;
        }
        mute.gotoAndStop("onOver");
    }
    else {

    }
    ns.soundTransform = st;
}
//Volume
function S1C(e:MouseEvent) {
    st.volume = 0.05;
    ns.soundTransform = st;
    mute.gotoAndStop("on");
}
function S2C(e:MouseEvent) {
    st.volume = 0.2;
    ns.soundTransform = st;
    mute.gotoAndStop("on");
}
function S3C(e:MouseEvent) {
    st.volume = 0.4;
    ns.soundTransform = st;
    mute.gotoAndStop("on");
}
function S4C(e:MouseEvent) {
    st.volume = 0.7;
    ns.soundTransform = st;
    mute.gotoAndStop("on");
}
function S5C(e:MouseEvent) {
    st.volume = 1;
    ns.soundTransform = st;
    mute.gotoAndStop("on");
}
function doZero(e:MouseEvent) {
    switch (st.volume) {
        case .05 :
            soundLo.gotoAndStop("levelOne");
            break;
        case .2 :
            soundLo.gotoAndStop("levelTwo");
            break;
        case .4 :
            soundLo.gotoAndStop("levelThree");
            break;
        case .7 :
            soundLo.gotoAndStop("levelFour");
            break;
        case 1 :
            soundLo.gotoAndStop("levelFive");
            break;
    }
}

///////////////////////////////////////////
// calculates where scruber must be 
function pixelToTime(px):Number {
    return Math.floor(px / (loaderwidth) * duration);

}
function timeToPixel(tmm):Number {
    return Math.floor (tmm / duration * (loaderwidth));
}

function resizeListener(e:Event) {
    trueSW = stage.stageWidth;
    trueSH = stage.stageHeight;
}
///////////////////////////////////////////////////////////////////////////////////
//on MouseMove
function toty3(e:MouseEvent) {
    localPoint3 = new Point(e.localX,e.localY);
    globalPoint3 = e.target.localToGlobal(localPoint3);

    if (tryOnce != 1) {
        playButton.visible = true;
        rewindButton.visible = true;
        fullScreenButton.visible = true;
        mute.visible = true;
        buts.visible = true;
        soundLContainer.visible = true;
        loader.visible = true;
        loader.y = steadyY;
        label.visible = true;

        //showTween.rewind();
        playTween = new Tween(controlBarInstance,"alpha",None.easeNone,0,1,0.3,true);
        playTween.addEventListener(TweenEvent.MOTION_CHANGE,motionStart1);
        playTween.addEventListener(TweenEvent.MOTION_FINISH,motionFinish1);
        pTween1 = new Tween(playButton,"alpha",None.easeNone,0,1,0.3,true);
        pTween2 = new Tween(rewindButton,"alpha",None.easeNone,0,1,0.3,true);
        pTween3 = new Tween(fullScreenButton,"alpha",None.easeNone,0,1,0.3,true);
        pTween4 = new Tween(mute,"alpha",None.easeNone,0,1,0.3,true);
        pTween5 = new Tween(buts,"alpha",None.easeNone,0,1,0.3,true);
        pTween6 = new Tween(soundLContainer,"alpha",None.easeNone,0,1,0.3,true);
        pTween7 = new Tween(loader,"alpha",None.easeNone,0,1,0.3,true);
        pTween8 = new Tween(label,"alpha",None.easeNone,0,1,0.3,true);
        Mouse.show();
        tryOnce = 1;
        inty = 1;
    }
}
//onMouseStop after few secs
function toty2():void {
    if (tryOnce == 1) {

        showTween = new Tween(controlBarInstance,"alpha",None.easeNone,1,0,0.5,true);
        showTween.addEventListener(TweenEvent.MOTION_CHANGE,motionStart);

        tTween1 = new Tween(playButton,"alpha",None.easeNone,1,0,0.5,true);
        tTween2 = new Tween(rewindButton,"alpha",None.easeNone,1,0,0.5,true);
        tTween3 = new Tween(fullScreenButton,"alpha",None.easeNone,1,0,0.5,true);
        tTween4 = new Tween(mute,"alpha",None.easeNone,1,0,0.5,true);
        tTween5 = new Tween(buts,"alpha",None.easeNone,1,0,0.5,true);
        tTween6 = new Tween(soundLContainer,"alpha",None.easeNone,1,0,0.5,true);
        //tTween7 = new Tween(loader,"alpha",None.easeNone,1,0,0.5,true);
        loader.alpha = 0;
        loader.y = steadyY - 9999;
        tTween8 = new Tween(label,"alpha",None.easeNone,1,0,0.5,true);

        if (stage.displayState == StageDisplayState.FULL_SCREEN) {
            Mouse.hide();
        }
        else {
            Mouse.show();
        }
        label.visible = false;
        tryOnce = 2;
    }
}
var letsCount:uint = 1;

function motionFinish1(e:TweenEvent):void {
    letsCount = 1;
}
function motionStart1(e:TweenEvent):void {
    letsCount = 2;
}

function motionStart(e:TweenEvent):void {
    if (letsCount == 2) {
        letsCount = 2;
        showTween.stop();
        tTween1.stop();
        tTween2.stop();
        tTween3.stop();
        tTween4.stop();
        tTween5.stop();
        tTween6.stop();
        //tTween7.stop();
        tTween8.stop();
    }
}

var position:Number;
var segments:uint;
var label1:TextField;
var format1:TextFormat;
label1 = new TextField();
format1 = new TextFormat();
label1.cacheAsBitmap = true;
var labelText1:String = "";
var labelY1:uint = 150;
var labelClr1:Number = stage.stageWidth / 2 - 17;
var labelSiz1:Number = 10;
configureLabel1();

label1.defaultTextFormat = format1;
setLabel1(labelText1,labelY1,labelClr1,labelSiz1);
var quickly:uint = 1;

//onClick scruber position and change movie time
function gotoTimeLabel(e:MouseEvent) {
    ns.pause();
    positionLoaded = Math.floor(loader.loadbar.width);
    posLoadedToTime = pixelToTime(positionLoaded);
    if (outputPosition > posLoadedToTime) {

        if (tweenScrub.isPlaying) {
            tweenScrub.stop();
        }
        ns.seek(posLoadedToTime - 5);
        quickly = 2;
    }
    else {
        if (tweenScrub.isPlaying) {
            tweenScrub.stop();
        }
        ns.seek(outputPosition);
        quickly = 2;
    }
    countSec = 6;
}
//hides /shows time label when mouse on loader
function hideTimeLabel(e:MouseEvent) {
    if (label1.parent != null) {
        removeChild(label1);
    }
}

function showTimeLabel(e:MouseEvent) {
    position = Math.floor(loader.mouseX);
    segments = loaderwidth;
    outputPosition = pixelToTime(position);
    if (outputPosition > duration) {
        outputPosition = duration;
    }
    minty1 = Math.floor(outputPosition / 60);
    loly1 = Math.floor(((outputPosition / 60 - minty1) / 1.666666666 * 100));
    if (loly1 < 10) {
        singy = "0" + loly1;
    }
    else {
        singy = loly1;
    }
    /////////////////////////////////////////////////////////////////////////////////////////////////////
    outputTrue = minty1 + ":" + singy;

    setLabel1(outputTrue,loader.y - label1.height,globalPoint3.x,labelSiz1);

    if (label1.parent == null) {
        addChild(label1);
    }




}
function setLabel1(str:String,alf:Number,clr:String,siz:Number):void {
    if (! label1.visible) {
        label1.visible = true;
    }
    label1.text = str;
    label1.y = alf;
    label1.x = clr;
    format1.size = siz;
    label1.defaultTextFormat = format1;
}
function configureLabel1():void {

    label1.autoSize = TextFieldAutoSize.CENTER;
    label1.background = true;
    label1.border = true;
    label1.x = stage.stageWidth / 2;
    label1.y = 255;


    format1.font = "Verdana";
    format1.color = 0x000000;
    format1.underline = false;

}

function origMovieSize():void {
    //uncomment if you want to have scaled movie in normal view(not fullscreen)
    //thou problems can show if the player window in html is not equal to 480/270... my bad xD
    ///*
    theVideo.x = 0;
    theVideo.y = 0;
    theVideo.width = 480;
    theVideo.height = 270;
    //*/
}

// event listeners DOH xD
ns.addEventListener(NetStatusEvent.NET_STATUS, netstat);
play_btn.addEventListener(MouseEvent.CLICK, playBtnB);
playButton.addEventListener(MouseEvent.ROLL_OVER, playButtonORO);
playButton.addEventListener(MouseEvent.ROLL_OUT, playButtonOROut);
playButton.addEventListener(MouseEvent.CLICK, playButtonOR);
rewindButton.addEventListener(MouseEvent.CLICK, rewindButtonB);
fullScreenButton.addEventListener(MouseEvent.ROLL_OVER, fullScreenButtonORO);
fullScreenButton.addEventListener(MouseEvent.ROLL_OUT, fullScreenButtonOROut);
fullScreenButton.addEventListener(MouseEvent.CLICK, fullScreenButtonOR);
mute.addEventListener(MouseEvent.ROLL_OVER, muteORO);
mute.addEventListener(MouseEvent.ROLL_OUT, muteOROut);
mute.addEventListener(MouseEvent.CLICK, muteOR);
//stage.addEventListener(MouseEvent.MOUSE_MOVE, showMenu);
loader.addEventListener(MouseEvent.MOUSE_MOVE, showTimeLabel);
loader.addEventListener(MouseEvent.MOUSE_OUT, hideTimeLabel);
loader.addEventListener(MouseEvent.CLICK, gotoTimeLabel);

S1.addEventListener(MouseEvent.CLICK, S1C);
S2.addEventListener(MouseEvent.CLICK, S2C);
S3.addEventListener(MouseEvent.CLICK, S3C);
S4.addEventListener(MouseEvent.CLICK, S4C);
S5.addEventListener(MouseEvent.CLICK, S5C);
S1.addEventListener(MouseEvent.MOUSE_OUT, doZero);
S2.addEventListener(MouseEvent.MOUSE_OUT, doZero);
S3.addEventListener(MouseEvent.MOUSE_OUT, doZero);
S4.addEventListener(MouseEvent.MOUSE_OUT, doZero);
S5.addEventListener(MouseEvent.MOUSE_OUT, doZero);
stage.addEventListener(FullScreenEvent.FULL_SCREEN, fullScreenHandler);
stage.addEventListener(Event.RESIZE, resizeListener);

//things that mustnt be seen in the beginning before clicking play
playButton.buttonMode = true;
mute.buttonMode = true;
buts.buttonMode = true;
fullScreenButton.buttonMode = true;

playButton.alpha = 0;
rewindButton.alpha = 0;
fullScreenButton.alpha = 0;
mute.alpha = 0;
buts.alpha = 0;
//controlBarInstance.visible = false;
controlBarInstance.alpha = 0;
soundLContainer.alpha = 0;
loader.alpha = 0;
label.visible = false;


playButton.visible = false;
rewindButton.visible = false;
fullScreenButton.visible = false;
mute.visible = false;
buts.visible = false;
//controlBarInstance.visible = false;
controlBarInstance.alpha = 0;
soundLContainer.visible = false;
loader.visible = false;
label.visible = false;
Mouse.show();
mfg
 
Zuletzt bearbeitet:

elyion_g2

Ach Jungs!?!

AW: Flash Webplayer ohne URL-Streaming

ne das funkzt eben nicht... habs schon probiert...
im flash zeigt er das bei der vorschau zwar an
aber wenn ich die .swf datei öffne .. nicht...
 
Bilder bitte hier hochladen und danach über das Bild-Icon (Direktlink vorher kopieren) platzieren.
Antworten auf deine Fragen:
Neues Thema erstellen

Willkommen auf PSD-Tutorials.de

In unseren Foren vernetzt du dich mit anderen Personen, um dich rund um die Themen Fotografie, Grafik, Gestaltung, Bildbearbeitung und 3D auszutauschen. Außerdem schalten wir für dich regelmäßig kostenlose Inhalte frei. Liebe Grüße senden dir die PSD-Gründer Stefan und Matthias Petri aus Waren an der Müritz. Hier erfährst du mehr über uns.

Stefan und Matthias Petri von PSD-Tutorials.de

Nächster neuer Gratisinhalt

03
Stunden
:
:
25
Minuten
:
:
19
Sekunden

Neueste Themen & Antworten

Flatrate für Tutorials, Assets, Vorlagen

Zurzeit aktive Besucher

Statistik des Forums

Themen
118.565
Beiträge
1.538.068
Mitglieder
67.488
Neuestes Mitglied
Andrew56524
Oben