AS 2.0:Preloader [มี 2 แบบ]
5 posters
หน้า 1 จาก 1
AS 2.0:Preloader [มี 2 แบบ]
แบบแรก คงคุ้นกันแล้ว
อีกแบบ พึ่งไปเจอมาสดๆ
- Spoiler:
- ลักษณะจะเ็นแบบนี้
- Code:
function preload()
{
ploader.T.text = Math.round(_root.getBytesLoaded() / _root.getBytesTotal() * 100) + "% loaded";
if (ploader.T.text == "100% loaded")
{
ploader.T.text = "Click anywhere to play";
clearInterval(Int);
Loaded = true;
} // end if
} // End of the function
function onMouseDown()
{
if (Loaded)
{
_root.play();
unloadMovie(ploader);
delete preload;
delete Loaded;
delete Int;
delete onMouseDown;
} // end if
} // End of the function
stop ();
createEmptyMovieClip("ploader", -1);
ploader._x = 0;
ploader._y = 0;
ploader.createTextField("T", 1, 2, 2, Stage.width, Stage.height);
ploader.T.selectable = false;
ploader.T.setTextFormat(fmt);
ploader.blendMode = "invert";
var Loaded = false;
var Int = setInterval(preload, 100);
อีกแบบ พึ่งไปเจอมาสดๆ
- Spoiler:
อีกแบบของ preloader ลักษณะจะเป็นแบบนี้- Code:
import flash.display.BitmapData;
import flash.filters.BlurFilter;
import flash.geom.Matrix;
stop();
blurData = new BitmapData(Stage.width+20, Stage.height+20);
blurData.draw(_root, new Matrix(1,0,0,1,10,10));
this.createEmptyMovieClip("pre_bgmc",this.getNextHighestDepth());
pre_bgmc._x = -10;
pre_bgmc._y = -10;
pre_bgmc.attachBitmap(blurData,1);
pre_bgmc.filters = [new BlurFilter(10,10,2)];
this.createEmptyMovieClip("ploader",this.getNextHighestDepth());
ploader._x = 0;
ploader._y = Stage.height-150;
// Create Gradient MC
ploader.createEmptyMovieClip("bgGrad",ploader.getNextHighestDepth());
ploader.bgGrad.cacheAsBitmap = true;
ploader.bgGrad._x = -ploader._x;
ploader.bgGrad._y = Stage.height-ploader._y;
// Draw Gradient
with(ploader.bgGrad) {
fillType = "linear";
colors = [0x666666, 0x000000];
alphas = [0, 75];
ratios = [0, 255];
matrix = {matrixType:"box", x:0, y:-200, w:200, h:200, r:90/180*Math.PI};
lineStyle(1, 0x000000, 0);
beginGradientFill(fillType, colors, alphas, ratios, matrix);
moveTo(0, 0);
lineTo(Stage.width, 0);
lineTo(Stage.width, -200);
lineTo(0, -200);
lineTo(0, 0);
endFill();
}
// Create Diagonal Lines MC
ploader.createEmptyMovieClip("lines",ploader.getNextHighestDepth());
ploader.lines.cacheAsBitmap = true;
ploader.lines._x = Stage.width;
ploader.lines._y = 80;
// Create Lines
ploader.lines.lineStyle(1, 0xFFFFFF);
for (var i=0;i<75;i++) {
ploader.lines.moveTo(i*-5, 0);
ploader.lines.lineTo((i*-5)+50, 50);
}
// Create Diagonal Lines Mask
ploader.createEmptyMovieClip("linesMask",ploader.getNextHighestDepth());
ploader.linesMask.cacheAsBitmap = true;
// Draw Gradient in Lines Mask
with(ploader.linesMask) {
// Top
fillType = "linear";
colors = [0x000000, 0x000000];
alphas = [0, 80];
ratios = [0, 255];
matrix = {matrixType:"box", x:Stage.width-(65*5), y:0, w:200, h:15, r:0/180*Math.PI};
lineStyle(1, 0x000000, 0);
beginGradientFill(fillType, colors, alphas, ratios, matrix);
moveTo(0, 80);
lineTo(Stage.width, 80);
lineTo(Stage.width, 90);
lineTo(0, 90);
lineTo(0, 80);
endFill();
// Bottom
alphas = [0, 25];
lineStyle(1, 0x000000, 0);
beginGradientFill(fillType, colors, alphas, ratios, matrix);
moveTo(0, 90);
lineTo(Stage.width, 90);
lineTo(Stage.width, 130);
lineTo(0, 130);
lineTo(0, 90);
endFill();
}
// Create Text Container
ploader.createEmptyMovieClip("tcont",ploader.getNextHighestDepth());
ploader.tcont.cacheAsBitmap = true;
ploader.tcont._x = Stage.width-400;
// Create Text
var T = ploader.tcont.createTextField("T",ploader.tcount.getNextHighestDepth(),0,0,400,100);
T.text = "0";
T.selectable = false;
function setTextFormat(textObject) {
var format:TextFormat = new TextFormat();
format.size = 100;
format.letterSpacing = 15;
format.font = "Arial Narrow";
format.color = 0xFFFFFF;
format.align = "right";
textObject.setTextFormat(format);
}
setTextFormat(T);
// Create Text Mask
ploader.createEmptyMovieClip("tmask",ploader.getNextHighestDepth());
ploader.tmask.cacheAsBitmap = true;
ploader.tmask._x = Stage.width-200;
// Draw Gradient in Text Mask
with(ploader.tmask) {
fillType = "linear";
colors = [0x000000, 0x000000];
alphas = [0, 50];
ratios = [0, 255];
matrix = {matrixType:"box", x:0, y:68, w:200, h:15, r:-90/180*Math.PI};
lineStyle(1, 0x000000, 0);
beginGradientFill(fillType, colors, alphas, ratios, matrix);
moveTo(0, 0);
lineTo(200, 0);
lineTo(200, 80);
lineTo(0, 80);
lineTo(0, 0);
endFill();
}
// Create Info Text Container
ploader.createEmptyMovieClip("infoText",ploader.getNextHighestDepth());
ploader.infoText.cacheAsBitmap = true;
ploader.infoText._x = Stage.width-415;
ploader.infoText._y = 95;
// Create Info Text
var iT = ploader.infoText.createTextField("iT",ploader.infoText.getNextHighestDepth(),0,0,400,100);
iT.text = "Now loading...";
iT.selectable = false;
function setTextFormat2(textObject) {
var format:TextFormat = new TextFormat();
format.size = 18;
format.letterSpacing = 3;
format.font = "Segoe UI Light";
format.color = 0xFFFFFF;
format.align = "right";
textObject.setTextFormat(format);
}
setTextFormat2(iT);
// Create Info Text Mask
ploader.createEmptyMovieClip("iTM",ploader.getNextHighestDepth());
ploader.iTM.cacheAsBitmap = true;
ploader.iTM._x = Stage.width-400;
ploader.iTM._y = 90;
// Draw Gradient in Info Text Mask
with(ploader.iTM) {
fillType = "linear";
colors = [0x000000, 0x000000, 0x000000, 0x000000];
alphas = [0, 100, 100, 0];
ratios = [0, 75, 185, 255];
matrix = {matrixType:"box", x:0, y:0, w:200, h:50, r:-90/180*Math.PI};
lineStyle(1, 0x000000, 0);
beginGradientFill(fillType, colors, alphas, ratios, matrix);
moveTo(0, 0);
lineTo(400, 0);
lineTo(400, 50);
lineTo(0, 50);
lineTo(0, 0);
endFill();
}
function assignMasks() {
// Assign info text Mask
ploader.infoText.setMask(ploader.iTM);
// Assign text Mask
ploader.tcont.setMask(ploader.tmask);
// Assign Lines Mask
ploader.lines.setMask(ploader.linesMask);
}
assignMasks();
function easeInQuad(t, b, c, d) {
return c*(t /= d)*t+b;
}
function preload(){
var loaded = Math.round((_root.getBytesLoaded()/_root.getBytesTotal())*100);
ploader.tcont.T.text = loaded;
setTextFormat(ploader.tcont.T);
if(loaded == 100){
var startPos = ploader.infoText._y;
var timeCount = 0;
ploader.infoText.onEnterFrame = function() {
//this._y = 65 - ( 65 - this._y ) / 1.1;
this._y = easeInQuad(timeCount++, startPos, -55, 10);
if (timeCount >= 10)
{
delete this.onEnterFrame;
isLoaded = true;
this.iT.text = "Click anywhere to play!";
setTextFormat2(this.iT);
this._y = 120;
this.onEnterFrame = function() {
this._y = 93 - ( 93 - this._y ) / 1.1;
if (this._y == 93) {
delete this.onEnterFrame;
}
}
}
}
clearInterval(Int);
}
}
var isLoaded:Boolean = false;
var Int:Number = setInterval(preload,100);
function onMouseDown(){
if(isLoaded){
_root.play();
unloadMovie(bgGrad);
unloadMovie(lines);
unloadMovie(linesMask);
unloadMovie(tcont);
unloadMovie(tmask);
unloadMovie(infoText);
unloadMovie(iT);
unloadMovie(iTM);
unloadMovie(ploader);
unloadMovie(pre_bgmc);
delete preload;
delete easeInQuad;
delete setTextFormat;
delete setTextFormat2;
delete blurData;
delete isLoaded;
delete Int;
delete onMouseDown;
}
}
15942347(first)- nobo
- Status :
Online Offline
จำนวนข้อความ : 168
คำขอบคุณ : 4
Join date : 01/10/2011
: 34
Level :
ABG Character Profile
ABG Name: Nobo
EXP:
(135/2000)
status!?:status!? หน่วย HP
อาต์ร- Moderator Art
- Status :
Online Offline
จำนวนข้อความ : 389
คำขอบคุณ : 23
Join date : 06/06/2011
: 25
Level :
ABG Character Profile
ABG Name: ชาติชัย สุริยัน
EXP:
(401/2000)
status!?:status!? หน่วย HP
Re: AS 2.0:Preloader [มี 2 แบบ]
โอ้ส โห มีแบบนี้ก็เจ๋งเลย thx
kiruru- kiruru
- Status :
Online Offline
จำนวนข้อความ : 232
คำขอบคุณ : 36
Join date : 06/05/2011
Level :
ABG Character Profile
ABG Name:
EXP:
(0/0)
status!?:status!? หน่วย HP
Re: AS 2.0:Preloader [มี 2 แบบ]
ของ Guz หรอคับ << มีแล้ว
jibboombee- Beginner Fighter
- Status :
Online Offline
จำนวนข้อความ : 142
คำขอบคุณ : 5
Join date : 12/08/2011
: 25
ที่อยู่ : Gensokyo
Level :
ABG Character Profile
ABG Name:
EXP:
(57/2000)
status!?:status!? หน่วย HP
Re: AS 2.0:Preloader [มี 2 แบบ]
โห ขอบคุณครับ หาอยู่เลย แล้ว 2อย่างนี้ใช่ยังไงอะ ช่วยลงวิธีใช้ให้หน่อยสิ
fallzeroshana- Beginner Fighter
- Status :
Online Offline
จำนวนข้อความ : 219
คำขอบคุณ : 10
Join date : 08/05/2011
Level :
ABG Character Profile
ABG Name:
EXP:
(434/2000)
status!?:status!? หน่วย HP
หน้า 1 จาก 1
Permissions in this forum:
คุณไม่สามารถพิมพ์ตอบ