Posts by okanyapici

12 posts
  • Has been part of the Envato Community for over 4 years
  • Has collected 10+ items on Envato Market
okanyapici says

yes it works… thanks in advance…

12 posts
  • Has been part of the Envato Community for over 4 years
  • Has collected 10+ items on Envato Market
okanyapici says

Hi Friends,

With the code written below i can not get the flv looped. I would be pleased for your suggestions best wishes… okan

// ########################## // ############# CONSTANTS // ##########################

stop();

// time to buffer for the video in sec. const BUFFER _TIME:Number = 8; // start volume when initializing player const DEFAULT _VOLUME:Number = 0.6; // update delay in milliseconds. const DISPLAY _TIMER_UPDATE_DELAY:int = 10; // smoothing for video. may slow down old computers const SMOOTHING :Boolean = true;

// ########################## // ############# VARIABLES // ##########################

// flag for knowing if flv has been loaded var bolLoaded:Boolean = false; // flag for volume scrubbing var bolVolumeScrub:Boolean = false; // flag for progress scrubbing var bolProgressScrub:Boolean = false; // holds the last used volume, but never 0 var intLastVolume:Number = DEFAULT _VOLUME; // net connection object for net stream var ncConnection:NetConnection; // net stream object var nsStream:NetStream; // object holds all meta data var objInfo:Object; // url to flv file var strSource:String = “http://www.tumlesiktasarim.com/fb_11_1_1.flv”; // timer for updating player (progress, volume…) var tmrDisplay:Timer;

// ########################## // ############# FUNCTIONS // ##########################

// sets up the player function initVideoPlayer():void { // hide buttons mcVideoControls.btnUnmute.visible = false; mcVideoControls.btnPause.visible = false; }

// set the progress/preload fill width to 1
mcVideoControls.mcProgressFill.mcFillRed.width = 1;
mcVideoControls.mcProgressFill.mcFillGrey.width = 1;
// add global event listener when mouse is released
stage.addEventListener( MouseEvent.MOUSE_UP, mouseReleased);
// add event listeners to all buttons
mcVideoControls.btnPause.addEventListener(MouseEvent.CLICK, pauseClicked);
mcVideoControls.btnPlay.addEventListener(MouseEvent.CLICK, playClicked);
mcVideoControls.btnStop.addEventListener(MouseEvent.CLICK, stopClicked);
mcVideoControls.btnMute.addEventListener(MouseEvent.CLICK, muteClicked);
mcVideoControls.btnUnmute.addEventListener(MouseEvent.CLICK, unmuteClicked);
mcVideoControls.mcVolumeScrubber.btnVolumeScrubber.addEventListener(MouseEvent.MOUSE_DOWN, volumeScrubberClicked);
mcVideoControls.mcProgressScrubber.btnProgressScrubber.addEventListener(MouseEvent.MOUSE_DOWN, progressScrubberClicked);
// create timer for updating all visual parts of player and add
// event listener
tmrDisplay = new Timer(DISPLAY_TIMER_UPDATE_DELAY);
tmrDisplay.addEventListener(TimerEvent.TIMER, updateDisplay);
// create a new net connection, add event listener and connect
// to null because we don't have a media server
ncConnection = new NetConnection();
ncConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
ncConnection.connect(null);
// create a new netstream with the net connection, add event
// listener, set client to this for handling meta data and
// set the buffer time to the value from the constant
nsStream = new NetStream(ncConnection);
nsStream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
nsStream.client = this;
nsStream.bufferTime = BUFFER_TIME;
// attach net stream to video object on the stage
vidDisplay.attachNetStream(nsStream);
// set the smoothing value from the constant
vidDisplay.smoothing = SMOOTHING;
// set default volume
mcVideoControls.mcVolumeScrubber.x = (52 * DEFAULT_VOLUME) + 341;
mcVideoControls.mcVolumeFill.mcFillRed.width = mcVideoControls.mcVolumeScrubber.x - 394 + 52;
setVolume(DEFAULT_VOLUME);

function playClicked(e:MouseEvent):void { // check’s, if the flv has already begun // to download. if so, resume playback, else // load the file if(!bolLoaded) { nsStream.play(strSource); bolLoaded = true; } else{ nsStream.resume(); } }

// show video display
vidDisplay.visible                    = true;
// switch play/pause visibility
mcVideoControls.btnPause.visible    = true;
mcVideoControls.btnPlay.visible        = false;

function pauseClicked(e:MouseEvent):void { // pause video nsStream.pause(); }

// switch play/pause visibility
mcVideoControls.btnPause.visible    = false;
mcVideoControls.btnPlay.visible        = true;

function stopClicked(e:MouseEvent):void { // calls stop function stopVideoPlayer(); }

function muteClicked(e:MouseEvent):void { // set volume to 0 setVolume(0); }

// update scrubber and fill position/width
mcVideoControls.mcVolumeScrubber.x                = 341;
mcVideoControls.mcVolumeFill.mcFillRed.width    = 1;

function unmuteClicked(e:MouseEvent):void { // set volume to last used value setVolume(intLastVolume); }

// update scrubber and fill position/width
mcVideoControls.mcVolumeScrubber.x = (53 * intLastVolume) + 341;
mcVideoControls.mcVolumeFill.mcFillRed.width = mcVideoControls.mcVolumeScrubber.x - 394 + 53;

function volumeScrubberClicked(e:MouseEvent):void { // set volume scrub flag to true bolVolumeScrub = true; }

// start drag
mcVideoControls.mcVolumeScrubber.startDrag(false, new Rectangle(341, 19, 53, 0));

function progressScrubberClicked(e:MouseEvent):void { // set progress scrub flag to true bolProgressScrub = true; }

// start drag
mcVideoControls.mcProgressScrubber.startDrag(false, new Rectangle(0, 2, 432, 0));

function mouseReleased(e:MouseEvent):void { // set progress/volume scrub to false bolVolumeScrub = false; bolProgressScrub = false; }

// stop all dragging actions
mcVideoControls.mcProgressScrubber.stopDrag();
mcVideoControls.mcVolumeScrubber.stopDrag();
// update progress/volume fill
mcVideoControls.mcProgressFill.mcFillRed.width    = mcVideoControls.mcProgressScrubber.x + 5;
mcVideoControls.mcVolumeFill.mcFillRed.width    = mcVideoControls.mcVolumeScrubber.x - 394 + 53;
// save the volume if it's greater than zero
if((mcVideoControls.mcVolumeScrubber.x - 341) / 53 > 0)
    intLastVolume = (mcVideoControls.mcVolumeScrubber.x - 341) / 53;

function updateDisplay(e:TimerEvent):void { // checks, if user is scrubbing. if so, seek in the video // if not, just update the position of the scrubber according // to the current time if(bolProgressScrub) nsStream.seek(Math.round(mcVideoControls.mcProgressScrubber.x * objInfo.duration / 432)) else mcVideoControls.mcProgressScrubber.x = nsStream.time * 432 / objInfo.duration; }

// set time and duration label
mcVideoControls.lblTimeDuration.htmlText        = " " + formatTime(nsStream.time) + "  / " + formatTime(objInfo.duration);
// update the width from the progress bar. the grey one displays
// the loading progress
mcVideoControls.mcProgressFill.mcFillRed.width    = mcVideoControls.mcProgressScrubber.x + 5;
mcVideoControls.mcProgressFill.mcFillGrey.width    = nsStream.bytesLoaded * 438 / nsStream.bytesTotal;
// update volume and the red fill width when user is scrubbing
if(bolVolumeScrub) {
    setVolume((mcVideoControls.mcVolumeScrubber.x - 341) / 53);
    mcVideoControls.mcVolumeFill.mcFillRed.width = mcVideoControls.mcVolumeScrubber.x - 394 + 53;
}

function onMetaData(info:Object):void { // stores meta data in a object objInfo = info; }

// now we can start the timer because
// we have all the neccesary data
tmrDisplay.start();

function netStatusHandler(event:NetStatusEvent):void { // handles net status events switch (event.info.code) { // trace a messeage when the stream is not found case “NetStream.Play.StreamNotFound”: trace(“Stream not found: ” + strSource); break; }

// when the video reaches its end, we stop the player
    case "NetStream.Play.Stop":
        stopVideoPlayer();
    break;
}

function stopVideoPlayer():void { // pause netstream, set time position to zero nsStream.pause(); nsStream.seek(0); }

// in order to clear the display, we need to
// set the visibility to false since the clear
// function has a bug
vidDisplay.visible                    = false;
// switch play/pause button visibility
mcVideoControls.btnPause.visible    = false;
mcVideoControls.btnPlay.visible        = true;

function setVolume(intVolume:Number = 0):void { // create soundtransform object with the volume from // the parameter var sndTransform = new SoundTransform(intVolume); // assign object to netstream sound transform object nsStream.soundTransform = sndTransform; }

// hides/shows mute and unmute button according to the
// volume
if(intVolume > 0) {
    mcVideoControls.btnMute.visible        = true;
    mcVideoControls.btnUnmute.visible    = false;
} else {
    mcVideoControls.btnMute.visible        = false;
    mcVideoControls.btnUnmute.visible    = true;
}

function formatTime(t:int):String { // returns the minutes and seconds with leading zeros // for example: 70 returns 01:10 var s:int = Math.round(t); var m:int = 0; if (s > 0) { while (s > 59) { m++; s -= 60; } return String((m < 10 ? “0” : “) + m + + (s < 10 ? “0” : ””) + s); } else { return “00:00”; } }

// ########################## // ############# INIT PLAYER // ########################## initVideoPlayer(); nsStream.play(strSource); bolLoaded = true; }

if(!bolLoaded) {
12 posts
  • Has been part of the Envato Community for over 4 years
  • Has collected 10+ items on Envato Market
okanyapici says

i use flash flv player, i set it up as no scale. But whenever i go fullscreen mode in the browser the flv dominates everything. flv goes on top of everything even if it is at root level and scales so that it fills whole screen…

12 posts
  • Has been part of the Envato Community for over 4 years
  • Has collected 10+ items on Envato Market
okanyapici says

addition : not a aspect ratio like 16:9, but a fixed size…like 640×480

12 posts
  • Has been part of the Envato Community for over 4 years
  • Has collected 10+ items on Envato Market
okanyapici says

Hi All,

I want my flvs be displayed with a fixed size, even no scale in fullscreen preview with browsers. Is there a way to do this ? I am talking about the flvs but not the player which plays it… Best wishes…

12 posts
  • Has been part of the Envato Community for over 4 years
  • Has collected 10+ items on Envato Market
okanyapici says

it does not go to and stop on fame labeled “dene” :(

12 posts
  • Has been part of the Envato Community for over 4 years
  • Has collected 10+ items on Envato Market
okanyapici says

Hi Tean,

my flas are here :

http://rapidshare.com/files/447837703/fb.rar

thank you very much for your interest

okan

12 posts
  • Has been part of the Envato Community for over 4 years
  • Has collected 10+ items on Envato Market
okanyapici says

Tean I tried your way, but no reaction, no errors… any other comments… i can sed the fla if you want… okan

12 posts
  • Has been part of the Envato Community for over 4 years
  • Has collected 10+ items on Envato Market
okanyapici says

Hi Friends,

I am trying to get a simple function. On first frame of the main time line, code below :

stop(); var myLoader:Loader = new Loader(); addChild(myLoader); var url2:URLRequest = new URLRequest(“fb_ALL.swf”); myLoader.load(url2); myLoader.x=0 myLoader.y=0

loads an external swf called “fb_ALL.swf”

than loaded swf plays and when it reaches to its last frame, code below :

MovieClip(root).gotoAndStop(“dene”);

should take the maintimeline to the frame labeled “dene”.

But it does not… :(

“cannot convert flash.display::Loader to flash.display.MovieClip.” is the error message i get.

Any help will be appreciated.

Best wishes

Okan

12 posts
  • Has been part of the Envato Community for over 4 years
  • Has collected 10+ items on Envato Market
okanyapici says

First of all, thousand thanks for your replies. Nevertheless the problem remains : I decided to use the very basic coding at asual which is :

// SWFAddress actions function btnClick(e:MouseEvent) { SWFAddress.setValue(e.target.deepLink); } function btnRollOver(e:MouseEvent) { SWFAddress.setStatus(e.target.deepLink); } function btnRollOut(e:MouseEvent) { SWFAddress.resetStatus(); }

var p:MovieClip = parent as MovieClip;

// SWFAddress handling function handleSWFAddress(e:SWFAddressEvent) { try { if (currentFrame 1 && e.value ’/’) { play(); } else { gotoAndStop(’$’ + e.value); } } catch(err) { gotoAndStop(’$/error/’); } var title:String = ‘SWFAddress Website’; for (var i = 0; i < e.pathNames.length; i++) { title += ’ / ’ + e.pathNames[i].substr(0,1).toUpperCase() + e.pathNames[i].substr(1); } SWFAddress.setTitle(title); } SWFAddress.addEventListener(SWFAddressEvent.CHANGE, handleSWFAddress); stop();

and my scenario which is :

“An external timeline based swf” loaded on every frame label. And these external swfs are have their own frame labels which should also be transmitted to the browsers address bar.

So the statement target in the 2nd line of the coding :

function btnClick(e:MouseEvent) { SWFAddress.setValue(e.target.deepLink);

should have 2 parts :

target1. frame label from the main time line target2. frame label from the loaded sws’s time line which wiil be get after loading

so the target1 should should trigger an action which will form target 2 and at the end these 2 should be written on the address line

and button script example looks like

stop(); this.deepLink = target ; this.buttonMode = true; this.addEventListener(MouseEvent.CLICK, (parent as MovieClip).btnClick); this.addEventListener(MouseEvent.ROLL_OVER, (parent as MovieClip).btnRollOver); this.addEventListener(MouseEvent.ROLL_OUT, (parent as MovieClip).btnRollOut); What i exactly need is this 2 parted targeting code…

guys… i need this coding… best wishes O.

by
by
by
by
by
by