sometimes have to refresh cache when no change was made
Dec 10, 2011 8:26 PM
I have a swf that's embedded in thus page http://jimslounge.com/publicDomain/captainVideo/
it can be launched by clicking on the button in the lower left of the page. It's a liquid layout that usually works fine but lately
I've noticed it sometimes goes black and fails to launch a video when clicking on a button in the swf. This can be fixed by reloading cache
bit I don't understand why that would happen when I didn't make any changes.
here's the code:
package {
import flash.display.*;
import flash.display.BitmapData;
import flash.display.IBitmapDrawable;
import flash.media.*;
import flash.events.*;
import fl.video.*;
import flash.filters.*;
public class CVLiquid extends MovieClip {
var com:FLVPlayback;
var bevel:BevelFilter;
var dropShadow:DropShadowFilter;
var nenu:Benu;
var currentSelection:String;
var poster:cVidCropped;
var newRatio:Number;
var ratio:Number;
var rRatio:Number;
var onStage:*;
var i:uint;
var a:Number;
var buttonsArray:Array;
var chapters:Array;
public function CVLiquid() {
this.stage.frameRate=60;
com = new FLVPlayback();
com.skin="SkinOverPlayStopSeekMuteVol.swf";
com.skinBackgroundAlpha=.2;
com.skinBackgroundColor=0x999999;
com.skinAutoHide=false;
com.autoPlay=true;
poster=new cVidCropped();
addChild(poster);
addChild(com);
stage.align=StageAlign.TOP_LEFT;
stage.scaleMode=StageScaleMode.NO_SCALE;
nenu = new Benu();
addChild(nenu);
nenu.up.addEventListener(MouseEvent.MOUSE_DOWN, scrollUp);
nenu.up.addEventListener(MouseEvent.MOUSE_UP, stopUp);
nenu.down.addEventListener(MouseEvent.MOUSE_DOWN, scrollDown);
nenu.down.addEventListener(MouseEvent.MOUSE_UP, stopDown);
nenu.addEventListener(MouseEvent.ROLL_OUT, fadeOut);
nenu.addEventListener(MouseEvent.ROLL_OVER, fadeIn);
stage.addEventListener(Event.RESIZE, fillBG);
fillBG();
makeMenu();
}
function fillBG(evt:Event = null):void {
onStage=com;
ratio=onStage.height/onStage.width;
rRatio=onStage.width/onStage.height;
newRatio=stage.stageHeight/stage.stageWidth;
nenu.height=Math.round(1.045*stage.stageHeight);
nenu.width=Math.round(.1953*stage.stageWidth);
nenu.y=Math.round(.2513*stage.stageHeight);
nenu.x=0;
if (newRatio>ratio) {
onStage.height=stage.stageHeight;
onStage.width=stage.stageHeight*rRatio;
poster.height=stage.stageHeight;
poster.width=stage.stageHeight*rRatio;
} else {
onStage.width=stage.stageWidth;
onStage.height=stage.stageWidth*ratio;
poster.width=stage.stageWidth;
poster.height=stage.stageWidth*ratio;
}
}
function makeMenu():void {
a=nenu.alpha;
bevel = new BevelFilter();
dropShadow = new DropShadowFilter();
nenu.up.buttonMode=true;
nenu.down.buttonMode=true;
buttonsArray = new Array(nenu.btn_list.tv1,nenu.btn_list.tv2,
nenu.btn_list.tv3,nenu.btn_list.tv4,nenu.btn_list.ch1,
nenu.btn_list.ch2,nenu.btn_list.ch3,nenu.btn_list.ch4,
nenu.btn_list.ch5,nenu.btn_list.ch6,nenu.btn_list.ch7,
nenu.btn_list.ch8,nenu.btn_list.ch9,nenu.btn_list.ch10,
nenu.btn_list.ch11,nenu.btn_list.ch12,nenu.btn_list.ch13,
nenu.btn_list.ch14,nenu.btn_list.ch15);
chapters = new Array(
"videos/CaptainVideoTV-01.flv",
"videos/CaptainVideoTV-02.flv",
"videos/CaptainVideoTV-03.flv",
"videos/CaptainVideoTV-04.flv",
"videos/Captain_Video01.flv",
"videos/Captain_Video02.flv",
"videos/Captain_Video03.flv",
"videos/Captain_Video04.flv",
"videos/Captain_Video05.flv",
"videos/Captain_Video06.flv",
"videos/Captain_Video07.flv",
"videos/Captain_Video08.flv",
"videos/Captain_Video09.flv",
"videos/Captain_Video10.flv",
"videos/Captain_Video11.flv",
"videos/Captain_Video12.flv",
"videos/Captain_Video13.flv",
"videos/Captain_Video14.flv",
"videos/Captain_Video15.flv"
);
for (var g:int = 0; g < buttonsArray.length; g++) {
buttonsArray[g].buttonMode=true;
buttonsArray[g].scaleY=.84;
buttonsArray[g].filters=[dropShadow,bevel];
}
for (var h:int=0; h <buttonsArray.length; h++) {
buttonsArray[h].addEventListener(MouseEvent.MOUSE_OVER, brighten);
buttonsArray[h].addEventListener(MouseEvent.MOUSE_OUT, normal);
buttonsArray[h].addEventListener(MouseEvent.CLICK, playChapters);
}
}
///////////////////////////////code for scrolling menu start///////////////////////
function fadeIn(e:MouseEvent):void {
nenu.removeEventListener(Event.ENTER_FRAME, fadeOutAlready);
nenu.addEventListener(Event.ENTER_FRAME, fadeInAlready);
}
function fadeInAlready(e:Event):void {
nenu.alpha+=.05;
if (nenu.alpha>.9) {
nenu.removeEventListener(Event.ENTER_FRAME, fadeInAlready);
nenu.removeEventListener(Event.ENTER_FRAME, fadeOutAlready);
}
}
function fadeOut(e:MouseEvent):void {
nenu.removeEventListener(Event.ENTER_FRAME, fadeInAlready);
nenu.addEventListener(Event.ENTER_FRAME, fadeOutAlready);
}
function fadeOutAlready(e:Event):void {
nenu.alpha-=.05;
if (nenu.alpha<.05) {
nenu.removeEventListener(Event.ENTER_FRAME, fadeOutAlready);
nenu.removeEventListener(Event.ENTER_FRAME, fadeInAlready);
}
}
function scrollUp(e:MouseEvent):void {
nenu.down.addEventListener(MouseEvent.MOUSE_DOWN, scrollDown);
addEventListener(Event.ENTER_FRAME, doScrollUp);
}
function doScrollUp(e:Event):void {
nenu.btn_list.y--;
//if (nenu.btn_list.getChildByName.y < nenu.mask.y+100){nenu.btn_list.child.alpha -= .05;}
removeEventListener(Event.ENTER_FRAME, doScrollDown);
if (nenu.btn_list.y+nenu.btn_list.height<nenu.btn_mask.y+nenu.btn_mask.h eight) {
removeEventListener(Event.ENTER_FRAME, doScrollUp);
nenu.up.removeEventListener(MouseEvent.MOUSE_DOWN, scrollUp);
}
}
function stopUp(e:MouseEvent):void {
removeEventListener(Event.ENTER_FRAME, doScrollUp);
}
function scrollDown(e:Event):void {
nenu.up.addEventListener(MouseEvent.MOUSE_DOWN, scrollUp);
addEventListener(Event.ENTER_FRAME, doScrollDown);
}
function doScrollDown(e:Event):void {
nenu.btn_list.y++;
removeEventListener(Event.ENTER_FRAME, doScrollUp);
if (nenu.btn_list.y>nenu.btn_mask.y) {
removeEventListener(Event.ENTER_FRAME, doScrollDown);
nenu.down.removeEventListener(MouseEvent.MOUSE_DOWN, scrollDown);
}
}
function stopDown(e:MouseEvent):void {
removeEventListener(Event.ENTER_FRAME, doScrollDown);
}
//////////////////////////////////code for scrolling menu end /////////////////////
function brighten(e:Event):void {
e.target.blendMode=BlendMode.ADD;
}
function normal(e:Event):void {
if (e.target.sel==false) {
e.target.blendMode=BlendMode.NORMAL;
}
}
function playChapters(e:MouseEvent):void {
this.poster.alpha=0;
this.com.alpha=1;
for (var i:int = 0; i < buttonsArray.length; i++) {
buttonsArray[i].blendMode=BlendMode.NORMAL;
buttonsArray[i].sel=false;
}
e.target.sel=true;
switch (e.target) {
case nenu.btn_list.tv1 :
nenu.btn_list.ch1.blendMode=BlendMode.ADD;
nenu.btn_list.ch1.sel=true;
this.com.source=chapters[0];
this.com.play();
break;
case nenu.btn_list.tv2 :
nenu.btn_list.ch1.blendMode=BlendMode.ADD;
nenu.btn_list.ch1.sel=true;
this.com.source=chapters[1];
this.com.play();
break;
case nenu.btn_list.tv3 :
nenu.btn_list.ch1.blendMode=BlendMode.ADD;
nenu.btn_list.ch1.sel=true;
this.com.source=chapters[2];
this.com.play();
break;
case nenu.btn_list.tv4 :
nenu.btn_list.ch1.blendMode=BlendMode.ADD;
nenu.btn_list.ch1.sel=true;
this.com.source=chapters[3];
this.com.play();
break;
case nenu.btn_list.ch1 :
nenu.btn_list.ch1.blendMode=BlendMode.ADD;
nenu.btn_list.ch1.sel=true;
this.com.source=chapters[4];
this.com.play();
break;
case nenu.btn_list.ch2 :
nenu.btn_list.ch2.blendMode=BlendMode.ADD;
nenu.btn_list.ch2.sel=true;
this.com.source=chapters[5];
this.com.play();
break;
case nenu.btn_list.ch3 :
nenu.btn_list.ch3.blendMode=BlendMode.ADD;
nenu.btn_list.ch3.sel=true;
this.com.source=chapters[6];
this.com.play();
break;
case nenu.btn_list.ch4 :
nenu.btn_list.ch4.blendMode=BlendMode.ADD;
nenu.btn_list.ch4.sel=true;
this.com.source=chapters[7];
this.com.play();
break;
case nenu.btn_list.ch5 :
nenu.btn_list.ch5.blendMode=BlendMode.ADD;
nenu.btn_list.ch5.sel=true;
this.com.source=chapters[8];
this.com.play();
break;
case nenu.btn_list.ch6 :
nenu.btn_list.ch6.blendMode=BlendMode.ADD;
nenu.btn_list.ch6.sel=true;
this.com.source=chapters[9];
this.com.play();
break;
case nenu.btn_list.ch7 :
nenu.btn_list.ch7.blendMode=BlendMode.ADD;
nenu.btn_list.ch7.sel=true;
this.com.source=chapters[10];
this.com.play();
break;
case nenu.btn_list.ch8 :
nenu.btn_list.ch8.blendMode=BlendMode.ADD;
nenu.btn_list.ch8.sel=true;
this.com.source=chapters[11];
this.com.play();
break;
case nenu.btn_list.ch9 :
nenu.btn_list.ch9.blendMode=BlendMode.ADD;
nenu.btn_list.ch9.sel=true;
this.com.source=chapters[12];
this.com.play();
break;
case nenu.btn_list.ch10 :
nenu.btn_list.ch10.blendMode=BlendMode.ADD;
nenu.btn_list.ch10.sel=true;
this.com.source=chapters[13];
this.com.play();
break;
case nenu.btn_list.ch11 :
nenu.btn_list.ch11.blendMode=BlendMode.ADD;
nenu.btn_list.ch11.sel=true;
this.com.source=chapters[14];
this.com.play();
break;
case nenu.btn_list.ch12 :
nenu.btn_list.ch12.blendMode=BlendMode.ADD;
nenu.btn_list.ch12.sel=true;
this.com.source=chapters[15];
this.com.play();
break;
case nenu.btn_list.ch13 :
nenu.btn_list.ch13.blendMode=BlendMode.ADD;
nenu.btn_list.ch13.sel=true;
this.com.source=chapters[16];
this.com.play();
break;
case nenu.btn_list.ch14 :
nenu.btn_list.ch14.blendMode=BlendMode.ADD;
nenu.btn_list.ch14.sel=true;
this.com.source=chapters[17];
this.com.play();
break;
case nenu.btn_list.ch15 :
nenu.btn_list.ch15.blendMode=BlendMode.ADD;
nenu.btn_list.ch15.sel=true;
this.com.source=chapters[18];
this.com.play();
break;
default :
//trace("not a chapter");
}
}
}
}



