묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
플래쉬동영상 액션입니다. 풀스크린으로 볼때 원본비율되고나오지않아여 ㅜㅜ
2010.08.28 23:51
//
// INITITAL SETTINGS
//
// Set document stage and width here
stageW = 800;
stageH = 600;
// Set default volume here (percentage)
defaultVolume = 100;
// Set default buffer time here (seconds)
defaultBuffer = 3;
//
// ORIGINAL VALUES (FOR FULLSCREEN/NORMAL MODE)
//
// Control clips
controls_mc.originX = controls_mc._x;
controls_mc.originY = controls_mc._y;
controls_mc.bg_mc.originWidth = controls_mc.bg_mc._width;
controls_mc.sound_time_mc.originX = controls_mc.sound_time_mc._x;
// Video holder
video_holder.originX = video_holder._x;
video_holder.originY = video_holder._y;
video_holder.originWidth = video_holder._width;
video_holder.originHeight = video_holder._height;
// Progress bar
controls_mc.progress_mc.originX = controls_mc.progress_mc._x;
controls_mc.progress_mc.originWidth = controls_mc.progress_mc._width;
bg_mc.originHeight = bg_mc._height;
bg_mc.originWidth = bg_mc._width;
bg_mc.originX = bg_mc._x;
bg_mc.originY = bg_mc._y;
//
// STAGE RESIZE (FOR FULLSCREEN/NORMAL MODE)
//
// Normal mode
objectsNormal = function () {
// Show select menu
select_mc._visible = true;
// Control clips
controls_mc._x = controls_mc.originX;
controls_mc._y = controls_mc.originY;
controls_mc.bg_mc._width = controls_mc.bg_mc.originWidth;
controls_mc.sound_time_mc._x = controls_mc.sound_time_mc.originX;
// Progress bar
controls_mc.progress_mc._width = progress_mc.originWidth;
// Video holder
video_holder._x = video_holder.originX;
video_holder._y = video_holder.originY;
video_holder._width = video_holder.originWidth;
video_holder._height = video_holder.originHeight;
// Progress bar
controls_mc.progress_mc._width = controls_mc.progress_mc.originWidth;
bg_mc._height = bg_mc.originHeight;
bg_mc._width = bg_mc.originWidth;
bg_mc._x = bg_mc.originX;
bg_mc._y = bg_mc.originY;
var bg_colour:Color = new Color(bg_mc);
bg_colour.setRGB(0x111111);
txt_mc._visible = true;
};
// Fullscreen mode
objectsFullscreen = function () {
// Hide select menu
select_mc._visible = false;
// Control clips
controls_mc._x = Math.round(-(Stage.width-stageW)/2);
controls_mc._y = Math.round(-(Stage.height-stageH)/2+Stage.height-55);
controls_mc.bg_mc._width = Stage.width;
controls_mc.sound_time_mc._x = controls_mc.bg_mc._width-controls_mc.sound_time_mc._width;
// Video holder
stageRatio = Stage.width/(Stage.height-55);
videoRatio = video_holder.videoClip._width/video_holder.videoClip._height;
if (stageRatio>videoRatio) {
video_holder._height = Stage.height-55;
video_holder._xscale = video_holder._yscale;
} else {
video_holder._width = Stage.width;
video_holder._yscale = video_holder._xscale;
}
video_holder._x = Math.round((Stage.width-video_holder._width)-(Stage.width-stageW))/2;
video_holder._y = Math.round((Stage.height-55-video_holder._height)-(Stage.height-stageH))/2;
bg_mc._height = Stage.height-55;
bg_mc._width = Stage.width;
bg_mc._x = -(Stage.width-stageW)/2;
bg_mc._y = -(Stage.height-stageH)/2;
var bg_colour:Color = new Color(bg_mc);
bg_colour.setRGB(0x000000);
// Progress bar
controls_mc.progress_mc._width = controls_mc.bg_mc._width-10-controls_mc.sound_time_mc._width-controls_mc.progress_mc.originX;
txt_mc._visible = false;
};
//
// FULLSCREEN MODE BUTTON
//
controls_mc.sound_time_mc.bttnFullscreen.bttn.onPress = function() {
if (this._parent.icon_mc._currentframe == 1) {
// Go fullscreen
fullscreenMode = true;
//Stage["displayState"] = "fullScreen";
this._parent.icon_mc.gotoAndStop(2);
objectsFullscreen();
} else {
// Go normal
fullscreenMode = false;
//Stage["displayState"] = "normal";
this._parent.icon_mc.gotoAndStop(1);
objectsNormal();
}
};
_parent.bg_mc.onRollOver = function() {
this.useHandCursor = false;
};
// VIDEO HOLDER BUTTON
video_holder.onRollOver = function() {
Mouse.hide();
hover_mc._x = _xmouse;
hover_mc._y = _ymouse;
hover_mc.onEnterFrame = function() {
this._x += Math.round((_xmouse-this._x)/3);
this._y += Math.round((_ymouse-this._y)/3);
};
hover_mc._visible = true;
};
video_holder.onRollOut = video_holder.onDragOut=function () {
Mouse.show();
delete hover_mc.onEnterFrame;
hover_mc._visible = false;
};
video_holder.useHandCursor = false;
video_holder.onRelease = function() {
Mouse.show();
delete hover_mc.onEnterFrame;
hover_mc._visible = false;
this._parent._parent.playerClose();
this._parent._parent.player_mc._visible = false;
doPause();
controls_mc.sound_time_mc.bttnFullscreen.icon_mc.gotoAndStop(1);
objectsNormal();
};
//
// LOAD VIDEO STREAM
//
// Reset video and controls
resetVideo = function () {
durationDisplay = "0:00";
controls_mc.progress_mc.buffer_mc._xscale = 0;
controls_mc.progress_mc.played_mc._xscale = 0;
videoEnd = false;
doPlay();
};
resetVideo();
// Video stream
var nc:NetConnection = new NetConnection(this);
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.setBufferTime(defaultBuffer);
// Attach video stream
video_holder.videoClip.attachVideo(ns);
// Attach audio stream
video_holder.attachAudio(ns);
video_holder.videoClip.smoothing = true;
loadVideo = function () {
select_mc.selectShow.txt.text = _parent._parent.Title[ID];
videoTitle.text = _parent._parent.Title[ID];
toLoad = _parent._parent.VideoClip[ID];
resetVideo();
ns.play(toLoad);
ns.onStatus = function(obj) {
if (obj.code == "NetStream.Buffer.Full") {
video_holder.preloader_mc._visible = false;
}
if (obj.code == "NetStream.Buffer.Empty") {
video_holder.preloader_mc._visible = true;
}
};
ns.onMetaData = function(obj) {
_global.volPosition = _root.soundControl_mc.volume_mc.scrollBttn._x;
_root.soundControl_mc.volume_mc.scrollBttn._x = -5;
duration = obj["duration"];
var minutes2:Number = Math.round(duration/60);
var seconds2 = Math.round(duration%60);
if (seconds2<10) {
seconds2 = "0"+seconds2;
}
durationDisplay = minutes2+":"+seconds2;
// Show duration time in playlist menu
select_mc.selectBttn_mc["selectBttn"+ID].txt_mc.durationDisplay.text = durationDisplay;
};
};
//
// SOUND CONTROLS
//
controls_mc.sound_time_mc.bttnSound.mc_soundLevel._visible = false;
controls_mc.sound_time_mc.bttnSound.bttn.onRollOver = function() {
this._parent.mc_soundLevel._visible = true;
};
controls_mc.sound_time_mc.bttnSound.bttn.onRollOut = controls_mc.sound_time_mc.bttnSound.bttn.onDragOut=function () {
if (!this._parent.mc_soundLevel.hitTest(_root._xmouse, _root._ymouse, true)) {
this._parent.mc_soundLevel._visible = false;
}
};
controls_mc.sound_time_mc.bttnSound.mc_soundLevel.onRollOut = function() {
this._visible = false;
};
// Adjust volume on slider press
var video_sound:Sound = new Sound(video_holder);
video_sound.setVolume(defaultVolume);
controls_mc.sound_time_mc.bttnSound.mc_soundLevel.mc_bar._yscale = defaultVolume;
controls_mc.sound_time_mc.bttnSound.mc_soundLevel.onPress = function() {
controls_mc.sound_time_mc.bttnSound.mc_soundLevel.onEnterFrame = function() {
if (this._ymouse<0) {
volumeTo = 0;
} else if (this._ymouse>this.bar._height) {
volumeTo = 100;
} else {
volumeTo = (this._ymouse/this.bar._height)*100;
}
this.mc_bar._yscale = 100-volumeTo;
video_sound.setVolume(100-volumeTo);
};
};
// Adjust volume on slider release
controls_mc.sound_time_mc.bttnSound.mc_soundLevel.onRelease = controls_mc.sound_time_mc.bttnSound.mc_soundLevel.onReleaseOutside=function () {
delete controls_mc.sound_time_mc.bttnSound.mc_soundLevel.onEnterFrame;
this._visible = false;
};
//
// PLAY / PAUSE CONTROLS
//
// Button functions
doPlay = function () {
ns.pause(false);
controls_mc.bttnPlay.icon_mc.gotoAndStop(1);
};
doPause = function () {
ns.pause(true);
controls_mc.bttnPlay.icon_mc.gotoAndStop(2);
};
doRestart = function () {
ns.seek(0);
controls_mc.bttnPlay.icon_mc.gotoAndStop(1);
ns.pause(false);
};
// Play button
controls_mc.bttnPlay.bttn.onPress = function() {
if (controls_mc.bttnPlay.icon_mc._currentframe == 1) {
doPause();
} else {
if (ns.time>=duration && duration != undefined) {
doRestart();
} else {
doPlay();
}
}
};
// Rewind button
controls_mc.bttnRewind.bttn.onPress = function() {
doRestart();
};
//
// PROGRESS BAR CONTROLS
//
// Adjust playhead on progress bar press
controls_mc.progress_mc.onPress = function() {
controls_mc.progress_mc.onEnterFrame = function() {
if ((this._xmouse*this._xscale)/100<0) {
this.percentage = 0;
} else if ((this._xmouse*this._xscale)/100>this._width && this.buffer_mc._xscale == 100) {
this.percentage = 100;
} else {
this.percentage = Math.round((this._xmouse*this._xscale)/100/this._width*100);
}
ns.pause(true);
seekTime = this.percentage/100*duration;
seekTime = Math.round(seekTime*100)/100;
ns.seek(seekTime);
};
};
// Adjust playhead on progress bar release
controls_mc.progress_mc.onRelease = controls_mc.progress_mc.onReleaseOutside=function () {
if (this.percentage == 100) {
doPause();
} else {
doPlay();
}
delete controls_mc.progress_mc.onEnterFrame;
};
onEnterFrame = function () {
if (video_holder._width != video_holder.originWidth) {
_root.nav_mc._visible = false;
} else {
_root.nav_mc._visible = true;
}
// Get video stream bytes loaded
percentage = Math.round(ns.bytesLoaded/ns.bytesTotal*100);
controls_mc.progress_mc.buffer_mc._xscale = percentage;
// Get video time
ns_seconds = ns.time;
minutes = Math.floor(ns_seconds/60);
seconds = Math.floor(ns_seconds%60);
if (seconds<10) {
seconds = "0"+seconds;
}
controls_mc.sound_time_mc.time_txt.text = minutes+":"+seconds+" / "+durationDisplay;
// Progress bar position
if (ns.time>=duration && duration != undefined) {
controls_mc.progress_mc.played_mc._xscale = 100;
if (videoEnd == false) {
controls_mc.bttnPlay.icon_mc.gotoAndStop(2);
videoEnd = true;
}
} else {
controls_mc.progress_mc.played_mc._xscale = Math.round(ns.time*100/duration);
videoEnd = false;
}
};
stop();
// INITITAL SETTINGS
//
// Set document stage and width here
stageW = 800;
stageH = 600;
// Set default volume here (percentage)
defaultVolume = 100;
// Set default buffer time here (seconds)
defaultBuffer = 3;
//
// ORIGINAL VALUES (FOR FULLSCREEN/NORMAL MODE)
//
// Control clips
controls_mc.originX = controls_mc._x;
controls_mc.originY = controls_mc._y;
controls_mc.bg_mc.originWidth = controls_mc.bg_mc._width;
controls_mc.sound_time_mc.originX = controls_mc.sound_time_mc._x;
// Video holder
video_holder.originX = video_holder._x;
video_holder.originY = video_holder._y;
video_holder.originWidth = video_holder._width;
video_holder.originHeight = video_holder._height;
// Progress bar
controls_mc.progress_mc.originX = controls_mc.progress_mc._x;
controls_mc.progress_mc.originWidth = controls_mc.progress_mc._width;
bg_mc.originHeight = bg_mc._height;
bg_mc.originWidth = bg_mc._width;
bg_mc.originX = bg_mc._x;
bg_mc.originY = bg_mc._y;
//
// STAGE RESIZE (FOR FULLSCREEN/NORMAL MODE)
//
// Normal mode
objectsNormal = function () {
// Show select menu
select_mc._visible = true;
// Control clips
controls_mc._x = controls_mc.originX;
controls_mc._y = controls_mc.originY;
controls_mc.bg_mc._width = controls_mc.bg_mc.originWidth;
controls_mc.sound_time_mc._x = controls_mc.sound_time_mc.originX;
// Progress bar
controls_mc.progress_mc._width = progress_mc.originWidth;
// Video holder
video_holder._x = video_holder.originX;
video_holder._y = video_holder.originY;
video_holder._width = video_holder.originWidth;
video_holder._height = video_holder.originHeight;
// Progress bar
controls_mc.progress_mc._width = controls_mc.progress_mc.originWidth;
bg_mc._height = bg_mc.originHeight;
bg_mc._width = bg_mc.originWidth;
bg_mc._x = bg_mc.originX;
bg_mc._y = bg_mc.originY;
var bg_colour:Color = new Color(bg_mc);
bg_colour.setRGB(0x111111);
txt_mc._visible = true;
};
// Fullscreen mode
objectsFullscreen = function () {
// Hide select menu
select_mc._visible = false;
// Control clips
controls_mc._x = Math.round(-(Stage.width-stageW)/2);
controls_mc._y = Math.round(-(Stage.height-stageH)/2+Stage.height-55);
controls_mc.bg_mc._width = Stage.width;
controls_mc.sound_time_mc._x = controls_mc.bg_mc._width-controls_mc.sound_time_mc._width;
// Video holder
stageRatio = Stage.width/(Stage.height-55);
videoRatio = video_holder.videoClip._width/video_holder.videoClip._height;
if (stageRatio>videoRatio) {
video_holder._height = Stage.height-55;
video_holder._xscale = video_holder._yscale;
} else {
video_holder._width = Stage.width;
video_holder._yscale = video_holder._xscale;
}
video_holder._x = Math.round((Stage.width-video_holder._width)-(Stage.width-stageW))/2;
video_holder._y = Math.round((Stage.height-55-video_holder._height)-(Stage.height-stageH))/2;
bg_mc._height = Stage.height-55;
bg_mc._width = Stage.width;
bg_mc._x = -(Stage.width-stageW)/2;
bg_mc._y = -(Stage.height-stageH)/2;
var bg_colour:Color = new Color(bg_mc);
bg_colour.setRGB(0x000000);
// Progress bar
controls_mc.progress_mc._width = controls_mc.bg_mc._width-10-controls_mc.sound_time_mc._width-controls_mc.progress_mc.originX;
txt_mc._visible = false;
};
//
// FULLSCREEN MODE BUTTON
//
controls_mc.sound_time_mc.bttnFullscreen.bttn.onPress = function() {
if (this._parent.icon_mc._currentframe == 1) {
// Go fullscreen
fullscreenMode = true;
//Stage["displayState"] = "fullScreen";
this._parent.icon_mc.gotoAndStop(2);
objectsFullscreen();
} else {
// Go normal
fullscreenMode = false;
//Stage["displayState"] = "normal";
this._parent.icon_mc.gotoAndStop(1);
objectsNormal();
}
};
_parent.bg_mc.onRollOver = function() {
this.useHandCursor = false;
};
// VIDEO HOLDER BUTTON
video_holder.onRollOver = function() {
Mouse.hide();
hover_mc._x = _xmouse;
hover_mc._y = _ymouse;
hover_mc.onEnterFrame = function() {
this._x += Math.round((_xmouse-this._x)/3);
this._y += Math.round((_ymouse-this._y)/3);
};
hover_mc._visible = true;
};
video_holder.onRollOut = video_holder.onDragOut=function () {
Mouse.show();
delete hover_mc.onEnterFrame;
hover_mc._visible = false;
};
video_holder.useHandCursor = false;
video_holder.onRelease = function() {
Mouse.show();
delete hover_mc.onEnterFrame;
hover_mc._visible = false;
this._parent._parent.playerClose();
this._parent._parent.player_mc._visible = false;
doPause();
controls_mc.sound_time_mc.bttnFullscreen.icon_mc.gotoAndStop(1);
objectsNormal();
};
//
// LOAD VIDEO STREAM
//
// Reset video and controls
resetVideo = function () {
durationDisplay = "0:00";
controls_mc.progress_mc.buffer_mc._xscale = 0;
controls_mc.progress_mc.played_mc._xscale = 0;
videoEnd = false;
doPlay();
};
resetVideo();
// Video stream
var nc:NetConnection = new NetConnection(this);
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.setBufferTime(defaultBuffer);
// Attach video stream
video_holder.videoClip.attachVideo(ns);
// Attach audio stream
video_holder.attachAudio(ns);
video_holder.videoClip.smoothing = true;
loadVideo = function () {
select_mc.selectShow.txt.text = _parent._parent.Title[ID];
videoTitle.text = _parent._parent.Title[ID];
toLoad = _parent._parent.VideoClip[ID];
resetVideo();
ns.play(toLoad);
ns.onStatus = function(obj) {
if (obj.code == "NetStream.Buffer.Full") {
video_holder.preloader_mc._visible = false;
}
if (obj.code == "NetStream.Buffer.Empty") {
video_holder.preloader_mc._visible = true;
}
};
ns.onMetaData = function(obj) {
_global.volPosition = _root.soundControl_mc.volume_mc.scrollBttn._x;
_root.soundControl_mc.volume_mc.scrollBttn._x = -5;
duration = obj["duration"];
var minutes2:Number = Math.round(duration/60);
var seconds2 = Math.round(duration%60);
if (seconds2<10) {
seconds2 = "0"+seconds2;
}
durationDisplay = minutes2+":"+seconds2;
// Show duration time in playlist menu
select_mc.selectBttn_mc["selectBttn"+ID].txt_mc.durationDisplay.text = durationDisplay;
};
};
//
// SOUND CONTROLS
//
controls_mc.sound_time_mc.bttnSound.mc_soundLevel._visible = false;
controls_mc.sound_time_mc.bttnSound.bttn.onRollOver = function() {
this._parent.mc_soundLevel._visible = true;
};
controls_mc.sound_time_mc.bttnSound.bttn.onRollOut = controls_mc.sound_time_mc.bttnSound.bttn.onDragOut=function () {
if (!this._parent.mc_soundLevel.hitTest(_root._xmouse, _root._ymouse, true)) {
this._parent.mc_soundLevel._visible = false;
}
};
controls_mc.sound_time_mc.bttnSound.mc_soundLevel.onRollOut = function() {
this._visible = false;
};
// Adjust volume on slider press
var video_sound:Sound = new Sound(video_holder);
video_sound.setVolume(defaultVolume);
controls_mc.sound_time_mc.bttnSound.mc_soundLevel.mc_bar._yscale = defaultVolume;
controls_mc.sound_time_mc.bttnSound.mc_soundLevel.onPress = function() {
controls_mc.sound_time_mc.bttnSound.mc_soundLevel.onEnterFrame = function() {
if (this._ymouse<0) {
volumeTo = 0;
} else if (this._ymouse>this.bar._height) {
volumeTo = 100;
} else {
volumeTo = (this._ymouse/this.bar._height)*100;
}
this.mc_bar._yscale = 100-volumeTo;
video_sound.setVolume(100-volumeTo);
};
};
// Adjust volume on slider release
controls_mc.sound_time_mc.bttnSound.mc_soundLevel.onRelease = controls_mc.sound_time_mc.bttnSound.mc_soundLevel.onReleaseOutside=function () {
delete controls_mc.sound_time_mc.bttnSound.mc_soundLevel.onEnterFrame;
this._visible = false;
};
//
// PLAY / PAUSE CONTROLS
//
// Button functions
doPlay = function () {
ns.pause(false);
controls_mc.bttnPlay.icon_mc.gotoAndStop(1);
};
doPause = function () {
ns.pause(true);
controls_mc.bttnPlay.icon_mc.gotoAndStop(2);
};
doRestart = function () {
ns.seek(0);
controls_mc.bttnPlay.icon_mc.gotoAndStop(1);
ns.pause(false);
};
// Play button
controls_mc.bttnPlay.bttn.onPress = function() {
if (controls_mc.bttnPlay.icon_mc._currentframe == 1) {
doPause();
} else {
if (ns.time>=duration && duration != undefined) {
doRestart();
} else {
doPlay();
}
}
};
// Rewind button
controls_mc.bttnRewind.bttn.onPress = function() {
doRestart();
};
//
// PROGRESS BAR CONTROLS
//
// Adjust playhead on progress bar press
controls_mc.progress_mc.onPress = function() {
controls_mc.progress_mc.onEnterFrame = function() {
if ((this._xmouse*this._xscale)/100<0) {
this.percentage = 0;
} else if ((this._xmouse*this._xscale)/100>this._width && this.buffer_mc._xscale == 100) {
this.percentage = 100;
} else {
this.percentage = Math.round((this._xmouse*this._xscale)/100/this._width*100);
}
ns.pause(true);
seekTime = this.percentage/100*duration;
seekTime = Math.round(seekTime*100)/100;
ns.seek(seekTime);
};
};
// Adjust playhead on progress bar release
controls_mc.progress_mc.onRelease = controls_mc.progress_mc.onReleaseOutside=function () {
if (this.percentage == 100) {
doPause();
} else {
doPlay();
}
delete controls_mc.progress_mc.onEnterFrame;
};
onEnterFrame = function () {
if (video_holder._width != video_holder.originWidth) {
_root.nav_mc._visible = false;
} else {
_root.nav_mc._visible = true;
}
// Get video stream bytes loaded
percentage = Math.round(ns.bytesLoaded/ns.bytesTotal*100);
controls_mc.progress_mc.buffer_mc._xscale = percentage;
// Get video time
ns_seconds = ns.time;
minutes = Math.floor(ns_seconds/60);
seconds = Math.floor(ns_seconds%60);
if (seconds<10) {
seconds = "0"+seconds;
}
controls_mc.sound_time_mc.time_txt.text = minutes+":"+seconds+" / "+durationDisplay;
// Progress bar position
if (ns.time>=duration && duration != undefined) {
controls_mc.progress_mc.played_mc._xscale = 100;
if (videoEnd == false) {
controls_mc.bttnPlay.icon_mc.gotoAndStop(2);
videoEnd = true;
}
} else {
controls_mc.progress_mc.played_mc._xscale = Math.round(ns.time*100/duration);
videoEnd = false;
}
};
stop();