Galeria as3
To to jest galeria as3
new galeria(3,3,250,140,"costam.xml"); wywołanie // ilośc kolumn , wierszy , szer , wys miniaturki, plik xml,
to jest plik XML
<?xml version='1.0'encoding='utf-8'?>
<galeria>
<obrazek>
<min>images/budynki/1m.jpg</min>
<big>images/budynki/1d.jpg</big>
<podpis>1</podpis>
</obrazek>
<obrazek>
<min>images/budynki/2m.jpg</min>
<big>images/budynki/2d.jpg</big>
<podpis>2</podpis>
</obrazek>
</galeria>
Listing
package galeria{
import flash.display.MovieClip;
import flash.display.LineScaleMode;
import flash.display.CapsStyle;
import flash.display.Shape;
import flash.display.JointStyle;
import fl.transitions.TweenEvent;
import fl.transitions.Tween;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.net.URLRequest;
import fl.transitions.easing.Strong;
import flash.net.URLLoader;
public class galeria extends MovieClip {
var podklad2:Shape = new Shape();
var myLoader:URLLoader = new URLLoader();
var myXML:XML;
var myXMLList:XMLList;
var strona:int = 1;
var ekran:MovieClip = new MovieClip();
var rzedy:int = 0;
var kolumny:int = 0;
var minwidth:int = 0;
var minheight:int = 0;
var tablica:Array = new Array();
var nast:MovieClip = new MovieClip();
var poprz:MovieClip = new MovieClip();
var snast:Shape = new Shape();
var stnast:Shape = new Shape();
var spoprz:Shape = new Shape();
var stpoprz:Shape = new Shape();
public function galeria(r:int, k:int, minw:int, minh:int, gal:String):void {
trace("dodano");
rzedy = r;
kolumny = k;
minwidth = minw;
minheight = minh;
myLoader.load(new URLRequest(gal));
myLoader.addEventListener(Event.COMPLETE, processXML);
}
function processXML(e:Event):void {
myXML = new XML(e.target.data);
myXMLList = myXML.children();
trace("jest xml");
if ( myXMLList.length() > rzedy*kolumny) {
podklad2.graphics.beginFill(0xAAAAAA, 0.2);
podklad2.graphics.drawRect(-22-10,-4,kolumny*minwidth + kolumny*10 + 4+50,rzedy*minheight + rzedy*10-2);
podklad2.graphics.endFill();
addChild(podklad2);
spoprz.graphics.beginFill(0xAAAAAA, 0.4);
spoprz.graphics.drawRect(0,0,20,podklad2.height);
spoprz.graphics.endFill();
stpoprz.graphics.lineStyle(0.5, 0x000000, 0.3, false, LineScaleMode.VERTICAL,CapsStyle.NONE, JointStyle.MITER, 10);
stpoprz.graphics.moveTo(2,podklad2.height/2);
stpoprz.graphics.lineTo(17,podklad2.height/2 -9);
stpoprz.graphics.lineTo(17,podklad2.height/2 +9);
stpoprz.graphics.lineTo(2,podklad2.height/2);
poprz.addChild(spoprz);
poprz.addChild(stpoprz);
this.addChild(poprz);
poprz.x = -22-10;
poprz.y = -4;
poprz.alpha = 0.6;
poprz.addEventListener(MouseEvent.CLICK, fpoprz);
poprz.addEventListener(MouseEvent.ROLL_OVER, poj);
poprz.addEventListener(MouseEvent.ROLL_OUT, znik);
snast.graphics.beginFill(0xAAAAAA, 0.4);
snast.graphics.drawRect(0,0,20,podklad2.height);
snast.graphics.endFill();
stnast.graphics.lineStyle(0.5, 0x000000, 0.3, true);
stnast.graphics.moveTo(18,podklad2.height/2);
stnast.graphics.lineTo(3,podklad2.height/2 -9);
stnast.graphics.lineTo(3,podklad2.height/2 +9);
stnast.graphics.lineTo(18,podklad2.height/2);
nast.addChild(snast);
nast.addChild(stnast);
this.addChild(nast);
nast.alpha = 0.6;
nast.x = podklad2.width - 52;
nast.y = -4;
nast.addEventListener(MouseEvent.CLICK, fnast);
nast.addEventListener(MouseEvent.ROLL_OVER, poj);
nast.addEventListener(MouseEvent.ROLL_OUT, znik);
} else {
podklad2.graphics.beginFill(0xFFFFFF, 0.1);
podklad2.graphics.drawRect(-4,-4,kolumny*minwidth + kolumny*10 -2,rzedy*minheight + rzedy*10 -2);
podklad2.graphics.endFill();
this.addChild(podklad2);
}
this.addChild(ekran);
wyswietl();
}
public function wyswietl():void {
var miny:int = 0;
var minx:int = 0;
for (var i:int = strona; i < rzedy*kolumny + strona; i++) {
if (i < myXMLList.length()+1) {
var vvv:miniaturka = new miniaturka(minwidth,minheight, myXML.obrazek[i-1].min.*, myXML.obrazek[i-1].big.*, myXML.obrazek[i-1].podpis.*);
vvv.x = minx;
if ((i%kolumny == 0)) {
minx = 0;
} else {
minx += minwidth + 10;
}
vvv.y = miny;
if ((i%kolumny == 0)) {
miny += minheight +10;
}
tablica.push(vvv);
ekran.addChild(vvv);
}
}
nast.addEventListener(MouseEvent.CLICK, fnast);
poprz.addEventListener(MouseEvent.CLICK, fpoprz);
}
public function fpoprz(e:MouseEvent) {
if ( strona!= 1) {
poprz.removeEventListener(MouseEvent.CLICK, fpoprz);
tablica.forEach(znikaniep);
}
}
public function fnast(e:MouseEvent) {
if ((strona + rzedy*kolumny < myXMLList.length()+1)) {
nast.removeEventListener(MouseEvent.CLICK, fnast);
tablica.forEach(znikanien);
}
}
private function znikanien(element:*, index:int, arr:Array):void {
var myTween:Tween = new Tween(element, "alpha", Strong.easeOut, element.alpha, 0, 0.7, true);
myTween.addEventListener(TweenEvent.MOTION_FINISH, usunn);
}
private function znikaniep(element:*, index:int, arr:Array):void {
var myTween:Tween = new Tween(element, "alpha", Strong.easeOut, element.alpha, 0, 0.7, true);
myTween.addEventListener(TweenEvent.MOTION_FINISH, usunp);
}
public function usunn(e:TweenEvent):void {
ekran.removeChild(tablica.shift());
strona++;
if (tablica.length ==0) {
wyswietl();
}
}
public function usunp(e:TweenEvent):void {
ekran.removeChild(tablica.pop());
if (tablica.length ==0) {
strona = strona - rzedy*kolumny;
wyswietl();
}
}
public function poj(e:MouseEvent) {
var myTween:Tween = new Tween(e.target, "alpha", Strong.easeOut, e.target.alpha, 1.0, 0.4, true);
}
public function znik(e:MouseEvent) {
var myTween:Tween = new Tween(e.target, "alpha", Strong.easeOut, e.target.alpha, 0.5, 0.4, true);
}
}
}
import flash.text.*;
import flash.display.*;
import flash.geom.*;
import fl.motion.*;
import fl.transitions.*;
import fl.containers.UILoader;
import flash.events.*;
import fl.events.*;
import flash.net.URLRequest;
import flash.net.navigateToURL;
import fl.controls.SliderDirection;
import fl.transitions.easing.*;
import flash.external.*;
internal class miniaturka extends MovieClip {
var pole:TextField = new TextField();
var gora:Shape = new Shape();
var maska:Shape = new Shape();
var maska2:Shape = new Shape();
var maska3:Shape = new Shape();
var maska4:Shape = new Shape();
var podklad:Shape = new Shape();
var p1:Shape = new Shape();
var p2:Shape = new Shape();
var p3:Shape = new Shape();
var p4:Shape = new Shape();
var animm:Shape = new Shape();
var pp1:MovieClip = new MovieClip();
var pp2:MovieClip = new MovieClip();
var pp3:MovieClip = new MovieClip();
var pp4:MovieClip = new MovieClip();
var pow:MovieClip = new MovieClip();
var anim:MovieClip = new MovieClip();
var ladowanie:Shape = new Shape();
var request1:URLRequest;
var ladowanie2:MovieClip = new MovieClip();
var goora:MovieClip = new MovieClip();
var kontener:UILoader = new UILoader();
var kontenerb:UILoader = new UILoader();
var biig:String = new String();
var poodpis:String = new String();
var pictLdr:Loader = new Loader();
public function miniaturka(w:int, h:int, plik:String, big:String, podpis:String = "adsfa") {
podklad.graphics.beginFill(0xCCCCCC, 0.5);
podklad.graphics.drawRect(-2,-2,w+4,h+4);
podklad.graphics.endFill();
this.addChild(podklad);
podklad.alpha = 0;
var myTween7:Tween = new Tween(podklad, "alpha", Strong.easeOut, podklad.alpha, 1, 0.7, true);
biig = big;
poodpis = podpis;
ladowanie.graphics.beginFill(0xCCCCCC, 0.5);
ladowanie.graphics.drawRect(0,0,1,5);
ladowanie.graphics.endFill();
ladowanie2.addChild(ladowanie);
ladowanie2.x = w/2-25;
ladowanie2.y = h/2 ;
this.addChild(ladowanie2);
kontener.alpha = 0;
kontener.setSize(w,h);
kontener.source = plik;
kontener.load();
kontener.addEventListener(ProgressEvent.PROGRESS, loading);
kontener.addEventListener(Event.COMPLETE, zaladowano);
maska.graphics.beginFill(0xCCCCCC, 0.0);
maska.graphics.drawRect(0,0,w,h);
maska.graphics.endFill();
this.addChild(maska);
maska2.graphics.beginFill(0xCCCCCC, 0.0);
maska2.graphics.drawRect(0,0,w,h);
maska2.graphics.endFill();
this.addChild(maska2);
maska3.graphics.beginFill(0xCCCCCC, 0.0);
maska3.graphics.drawRect(0,0,w,h);
maska3.graphics.endFill();
this.addChild(maska3);
maska4.graphics.beginFill(0xCCCCCC, 0.0);
maska4.graphics.drawRect(0,0,w,h);
maska4.graphics.endFill();
this.addChild(maska4);
animm.graphics.beginFill(0xCCCCCC, 0.0);
animm.graphics.drawRect(0,0,w,h);
animm.graphics.endFill();
anim.addChild(animm);
this.addChild(kontener);
p1.graphics.beginFill(0xAAAAAA, 0.4);
p1.graphics.drawRect(0,0,w,h*0.1);
p1.graphics.endFill();
pp1.addChild(p1);
pp1.x=0;
pp1.y=-h*0.1;
pp1.mask = maska2;
pp1.hitArea = null;
kontener.addChild(pp1);
p2.graphics.beginFill(0xAAAAAA, 0.4);
p2.graphics.drawRect(0,0,w,h*0.1);
p2.graphics.endFill();
pp2.addChild(p2);
pp2.x=0;
pp2.y=h;
pp2.mask = maska;
pp2.hitArea = null;
kontener.addChild(pp2);
p3.graphics.beginFill(0xAAAAAA, 0.4);
p3.graphics.drawRect(0,0,w*0.1,h);
p3.graphics.endFill();
pp3.addChild(p3);
pp3.x=-w*0.1;
pp3.y=0;
pp3.mask = maska3;
pp3.hitArea = null;
kontener.addChild(pp3);
p4.graphics.beginFill(0xAAAAAA, 0.4);
p4.graphics.drawRect(0,0,w*0.1,h);
p4.graphics.endFill();
pp4.addChild(p4);
pp4.x=w;
pp4.y=0;
pp4.mask = maska4;
pp4.hitArea = null;
kontener.addChild(pp4);
this.addChild(anim);
anim.addEventListener(MouseEvent.MOUSE_OVER, ruszaj);
anim.addEventListener(MouseEvent.MOUSE_OUT, ruszaj2);
anim.addEventListener(MouseEvent.CLICK, wyswietl);
}
private function zaladowano(e:Event):void {
kontener.content.width = podklad.width-2;
kontener.content.height = podklad.height-2;
var myTween:Tween = new Tween(kontener, "alpha", Strong.easeOut, kontener.alpha, 1, 0.7, true);
this.removeChild(ladowanie2);
}
private function loading(e:Event):void {
ladowanie2.width = kontener.percentLoaded/2;
}
private function ruszaj(e:MouseEvent):void {
var myTween:Tween = new Tween(pp1, "y", Strong.easeOut, -pp1.height, 0, 0.5, true);
var myTween2:Tween = new Tween(pp2, "y", Strong.easeOut, kontener.height, kontener.height*0.9, 0.5, true);
var myTween3:Tween = new Tween(pp3, "x", Strong.easeOut, -pp3.width, 0, 0.5, true);
var myTween4:Tween = new Tween(pp4, "x", Strong.easeOut, kontener.width, kontener.width*0.9, 0.5, true);
}
private function ruszaj2(e:MouseEvent):void {
var myTween:Tween = new Tween(pp1, "y", Strong.easeOut, pp1.y, -pp1.height, 0.5, true);
var myTween2:Tween = new Tween(pp2, "y", Strong.easeOut, pp2.y, kontener.height, 0.5, true);
var myTween3:Tween = new Tween(pp3, "x", Strong.easeOut, pp3.x, -pp3.width, 0.5, true);
var myTween4:Tween = new Tween(pp4, "x", Strong.easeOut, pp4.x, kontener.width, 0.5, true);
}
private function wyswietl(eventObject:MouseEvent):void {
gora.alpha = 0;
gora.graphics.beginFill(0x000000, 0.8);
gora.graphics.drawRect(-100,-100,stage.stageWidth+100,stage.stageHeight+100);
gora.graphics.endFill();
goora.addChild(gora);
stage.addChild(goora);
var myTween:Tween = new Tween(gora, "alpha", Strong.easeOut, gora.alpha, 0.5, 0.7, true);
myTween.addEventListener(TweenEvent.MOTION_FINISH, ukaz);
}
public function ukaz(e:TweenEvent) {
ladowanie.graphics.beginFill(0x000000, 0.4);
ladowanie.graphics.drawRect(0,0,1,5);
ladowanie.graphics.endFill();
ladowanie2.addChild(ladowanie);
ladowanie2.x = (stage.stageWidth / 2) - (pow.width / 2) - 50;
ladowanie2.y = (stage.stageHeight / 2) - (pow.height / 2);
ladowanie2.addEventListener(MouseEvent.CLICK, znikaj);
stage.addChild(ladowanie2);
var pictURL:String = biig;
var pictURLReq:URLRequest = new URLRequest(pictURL);
pictLdr= new Loader();
pictLdr.load(pictURLReq);
pictLdr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loading2);
pictLdr.contentLoaderInfo.addEventListener(Event.COMPLETE, imgLoaded);
}
private function loading2(e:Event):void {
ladowanie2.width = (pictLdr.contentLoaderInfo.bytesLoaded/pictLdr.contentLoaderInfo.bytesTotal)*100;
}
public function imgLoaded(event:Event):void {
ladowanie2.alpha = 0;
pow.addChild(pictLdr.content);
if (pow.width > stage.stageWidth) {
pow.height = (stage.stageWidth -10)*pow.height/pow.width;
pow.width = stage.stageWidth -10;
}
if (pow.height > stage.stageHeight) {
pow.width = (stage.stageHeight -10)*pow.width/pow.height;
pow.height = stage.stageHeight -10;
}
pow.x = (stage.stageWidth / 2) - (pow.width / 2);
pow.y = (stage.stageHeight / 2) - (pow.height / 2);
pow.alpha = 0;
stage.addChild(pow);
pow.addEventListener(MouseEvent.CLICK, znikaj);
var myTween:Tween = new Tween(pow, "alpha", Strong.easeOut, pow.alpha, 1, 0.5, true);
}
public function znikaj(e:MouseEvent) {
pictLdr.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, loading2);
pictLdr.contentLoaderInfo.removeEventListener(Event.COMPLETE, imgLoaded);
ladowanie2.alpha = 0;
pow.alpha = 0;
pow.alpha = 0;
stage.removeChild(goora);
stage.removeChild(pow);
stage.removeChild(ladowanie2);
var myTween:Tween = new Tween(pow, "alpha", Strong.easeOut, pow.alpha, 0, 0.5, true);
}
}
import flash.display.MovieClip;
import flash.display.LineScaleMode;
import flash.display.CapsStyle;
import flash.display.Shape;
import flash.display.JointStyle;
import fl.transitions.TweenEvent;
import fl.transitions.Tween;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.net.URLRequest;
import fl.transitions.easing.Strong;
import flash.net.URLLoader;
public class galeria extends MovieClip {
var podklad2:Shape = new Shape();
var myLoader:URLLoader = new URLLoader();
var myXML:XML;
var myXMLList:XMLList;
var strona:int = 1;
var ekran:MovieClip = new MovieClip();
var rzedy:int = 0;
var kolumny:int = 0;
var minwidth:int = 0;
var minheight:int = 0;
var tablica:Array = new Array();
var nast:MovieClip = new MovieClip();
var poprz:MovieClip = new MovieClip();
var snast:Shape = new Shape();
var stnast:Shape = new Shape();
var spoprz:Shape = new Shape();
var stpoprz:Shape = new Shape();
public function galeria(r:int, k:int, minw:int, minh:int, gal:String):void {
trace("dodano");
rzedy = r;
kolumny = k;
minwidth = minw;
minheight = minh;
myLoader.load(new URLRequest(gal));
myLoader.addEventListener(Event.COMPLETE, processXML);
}
function processXML(e:Event):void {
myXML = new XML(e.target.data);
myXMLList = myXML.children();
trace("jest xml");
if ( myXMLList.length() > rzedy*kolumny) {
podklad2.graphics.beginFill(0xAAAAAA, 0.2);
podklad2.graphics.drawRect(-22-10,-4,kolumny*minwidth + kolumny*10 + 4+50,rzedy*minheight + rzedy*10-2);
podklad2.graphics.endFill();
addChild(podklad2);
spoprz.graphics.beginFill(0xAAAAAA, 0.4);
spoprz.graphics.drawRect(0,0,20,podklad2.height);
spoprz.graphics.endFill();
stpoprz.graphics.lineStyle(0.5, 0x000000, 0.3, false, LineScaleMode.VERTICAL,CapsStyle.NONE, JointStyle.MITER, 10);
stpoprz.graphics.moveTo(2,podklad2.height/2);
stpoprz.graphics.lineTo(17,podklad2.height/2 -9);
stpoprz.graphics.lineTo(17,podklad2.height/2 +9);
stpoprz.graphics.lineTo(2,podklad2.height/2);
poprz.addChild(spoprz);
poprz.addChild(stpoprz);
this.addChild(poprz);
poprz.x = -22-10;
poprz.y = -4;
poprz.alpha = 0.6;
poprz.addEventListener(MouseEvent.CLICK, fpoprz);
poprz.addEventListener(MouseEvent.ROLL_OVER, poj);
poprz.addEventListener(MouseEvent.ROLL_OUT, znik);
snast.graphics.beginFill(0xAAAAAA, 0.4);
snast.graphics.drawRect(0,0,20,podklad2.height);
snast.graphics.endFill();
stnast.graphics.lineStyle(0.5, 0x000000, 0.3, true);
stnast.graphics.moveTo(18,podklad2.height/2);
stnast.graphics.lineTo(3,podklad2.height/2 -9);
stnast.graphics.lineTo(3,podklad2.height/2 +9);
stnast.graphics.lineTo(18,podklad2.height/2);
nast.addChild(snast);
nast.addChild(stnast);
this.addChild(nast);
nast.alpha = 0.6;
nast.x = podklad2.width - 52;
nast.y = -4;
nast.addEventListener(MouseEvent.CLICK, fnast);
nast.addEventListener(MouseEvent.ROLL_OVER, poj);
nast.addEventListener(MouseEvent.ROLL_OUT, znik);
} else {
podklad2.graphics.beginFill(0xFFFFFF, 0.1);
podklad2.graphics.drawRect(-4,-4,kolumny*minwidth + kolumny*10 -2,rzedy*minheight + rzedy*10 -2);
podklad2.graphics.endFill();
this.addChild(podklad2);
}
this.addChild(ekran);
wyswietl();
}
public function wyswietl():void {
var miny:int = 0;
var minx:int = 0;
for (var i:int = strona; i < rzedy*kolumny + strona; i++) {
if (i < myXMLList.length()+1) {
var vvv:miniaturka = new miniaturka(minwidth,minheight, myXML.obrazek[i-1].min.*, myXML.obrazek[i-1].big.*, myXML.obrazek[i-1].podpis.*);
vvv.x = minx;
if ((i%kolumny == 0)) {
minx = 0;
} else {
minx += minwidth + 10;
}
vvv.y = miny;
if ((i%kolumny == 0)) {
miny += minheight +10;
}
tablica.push(vvv);
ekran.addChild(vvv);
}
}
nast.addEventListener(MouseEvent.CLICK, fnast);
poprz.addEventListener(MouseEvent.CLICK, fpoprz);
}
public function fpoprz(e:MouseEvent) {
if ( strona!= 1) {
poprz.removeEventListener(MouseEvent.CLICK, fpoprz);
tablica.forEach(znikaniep);
}
}
public function fnast(e:MouseEvent) {
if ((strona + rzedy*kolumny < myXMLList.length()+1)) {
nast.removeEventListener(MouseEvent.CLICK, fnast);
tablica.forEach(znikanien);
}
}
private function znikanien(element:*, index:int, arr:Array):void {
var myTween:Tween = new Tween(element, "alpha", Strong.easeOut, element.alpha, 0, 0.7, true);
myTween.addEventListener(TweenEvent.MOTION_FINISH, usunn);
}
private function znikaniep(element:*, index:int, arr:Array):void {
var myTween:Tween = new Tween(element, "alpha", Strong.easeOut, element.alpha, 0, 0.7, true);
myTween.addEventListener(TweenEvent.MOTION_FINISH, usunp);
}
public function usunn(e:TweenEvent):void {
ekran.removeChild(tablica.shift());
strona++;
if (tablica.length ==0) {
wyswietl();
}
}
public function usunp(e:TweenEvent):void {
ekran.removeChild(tablica.pop());
if (tablica.length ==0) {
strona = strona - rzedy*kolumny;
wyswietl();
}
}
public function poj(e:MouseEvent) {
var myTween:Tween = new Tween(e.target, "alpha", Strong.easeOut, e.target.alpha, 1.0, 0.4, true);
}
public function znik(e:MouseEvent) {
var myTween:Tween = new Tween(e.target, "alpha", Strong.easeOut, e.target.alpha, 0.5, 0.4, true);
}
}
}
import flash.text.*;
import flash.display.*;
import flash.geom.*;
import fl.motion.*;
import fl.transitions.*;
import fl.containers.UILoader;
import flash.events.*;
import fl.events.*;
import flash.net.URLRequest;
import flash.net.navigateToURL;
import fl.controls.SliderDirection;
import fl.transitions.easing.*;
import flash.external.*;
internal class miniaturka extends MovieClip {
var pole:TextField = new TextField();
var gora:Shape = new Shape();
var maska:Shape = new Shape();
var maska2:Shape = new Shape();
var maska3:Shape = new Shape();
var maska4:Shape = new Shape();
var podklad:Shape = new Shape();
var p1:Shape = new Shape();
var p2:Shape = new Shape();
var p3:Shape = new Shape();
var p4:Shape = new Shape();
var animm:Shape = new Shape();
var pp1:MovieClip = new MovieClip();
var pp2:MovieClip = new MovieClip();
var pp3:MovieClip = new MovieClip();
var pp4:MovieClip = new MovieClip();
var pow:MovieClip = new MovieClip();
var anim:MovieClip = new MovieClip();
var ladowanie:Shape = new Shape();
var request1:URLRequest;
var ladowanie2:MovieClip = new MovieClip();
var goora:MovieClip = new MovieClip();
var kontener:UILoader = new UILoader();
var kontenerb:UILoader = new UILoader();
var biig:String = new String();
var poodpis:String = new String();
var pictLdr:Loader = new Loader();
public function miniaturka(w:int, h:int, plik:String, big:String, podpis:String = "adsfa") {
podklad.graphics.beginFill(0xCCCCCC, 0.5);
podklad.graphics.drawRect(-2,-2,w+4,h+4);
podklad.graphics.endFill();
this.addChild(podklad);
podklad.alpha = 0;
var myTween7:Tween = new Tween(podklad, "alpha", Strong.easeOut, podklad.alpha, 1, 0.7, true);
biig = big;
poodpis = podpis;
ladowanie.graphics.beginFill(0xCCCCCC, 0.5);
ladowanie.graphics.drawRect(0,0,1,5);
ladowanie.graphics.endFill();
ladowanie2.addChild(ladowanie);
ladowanie2.x = w/2-25;
ladowanie2.y = h/2 ;
this.addChild(ladowanie2);
kontener.alpha = 0;
kontener.setSize(w,h);
kontener.source = plik;
kontener.load();
kontener.addEventListener(ProgressEvent.PROGRESS, loading);
kontener.addEventListener(Event.COMPLETE, zaladowano);
maska.graphics.beginFill(0xCCCCCC, 0.0);
maska.graphics.drawRect(0,0,w,h);
maska.graphics.endFill();
this.addChild(maska);
maska2.graphics.beginFill(0xCCCCCC, 0.0);
maska2.graphics.drawRect(0,0,w,h);
maska2.graphics.endFill();
this.addChild(maska2);
maska3.graphics.beginFill(0xCCCCCC, 0.0);
maska3.graphics.drawRect(0,0,w,h);
maska3.graphics.endFill();
this.addChild(maska3);
maska4.graphics.beginFill(0xCCCCCC, 0.0);
maska4.graphics.drawRect(0,0,w,h);
maska4.graphics.endFill();
this.addChild(maska4);
animm.graphics.beginFill(0xCCCCCC, 0.0);
animm.graphics.drawRect(0,0,w,h);
animm.graphics.endFill();
anim.addChild(animm);
this.addChild(kontener);
p1.graphics.beginFill(0xAAAAAA, 0.4);
p1.graphics.drawRect(0,0,w,h*0.1);
p1.graphics.endFill();
pp1.addChild(p1);
pp1.x=0;
pp1.y=-h*0.1;
pp1.mask = maska2;
pp1.hitArea = null;
kontener.addChild(pp1);
p2.graphics.beginFill(0xAAAAAA, 0.4);
p2.graphics.drawRect(0,0,w,h*0.1);
p2.graphics.endFill();
pp2.addChild(p2);
pp2.x=0;
pp2.y=h;
pp2.mask = maska;
pp2.hitArea = null;
kontener.addChild(pp2);
p3.graphics.beginFill(0xAAAAAA, 0.4);
p3.graphics.drawRect(0,0,w*0.1,h);
p3.graphics.endFill();
pp3.addChild(p3);
pp3.x=-w*0.1;
pp3.y=0;
pp3.mask = maska3;
pp3.hitArea = null;
kontener.addChild(pp3);
p4.graphics.beginFill(0xAAAAAA, 0.4);
p4.graphics.drawRect(0,0,w*0.1,h);
p4.graphics.endFill();
pp4.addChild(p4);
pp4.x=w;
pp4.y=0;
pp4.mask = maska4;
pp4.hitArea = null;
kontener.addChild(pp4);
this.addChild(anim);
anim.addEventListener(MouseEvent.MOUSE_OVER, ruszaj);
anim.addEventListener(MouseEvent.MOUSE_OUT, ruszaj2);
anim.addEventListener(MouseEvent.CLICK, wyswietl);
}
private function zaladowano(e:Event):void {
kontener.content.width = podklad.width-2;
kontener.content.height = podklad.height-2;
var myTween:Tween = new Tween(kontener, "alpha", Strong.easeOut, kontener.alpha, 1, 0.7, true);
this.removeChild(ladowanie2);
}
private function loading(e:Event):void {
ladowanie2.width = kontener.percentLoaded/2;
}
private function ruszaj(e:MouseEvent):void {
var myTween:Tween = new Tween(pp1, "y", Strong.easeOut, -pp1.height, 0, 0.5, true);
var myTween2:Tween = new Tween(pp2, "y", Strong.easeOut, kontener.height, kontener.height*0.9, 0.5, true);
var myTween3:Tween = new Tween(pp3, "x", Strong.easeOut, -pp3.width, 0, 0.5, true);
var myTween4:Tween = new Tween(pp4, "x", Strong.easeOut, kontener.width, kontener.width*0.9, 0.5, true);
}
private function ruszaj2(e:MouseEvent):void {
var myTween:Tween = new Tween(pp1, "y", Strong.easeOut, pp1.y, -pp1.height, 0.5, true);
var myTween2:Tween = new Tween(pp2, "y", Strong.easeOut, pp2.y, kontener.height, 0.5, true);
var myTween3:Tween = new Tween(pp3, "x", Strong.easeOut, pp3.x, -pp3.width, 0.5, true);
var myTween4:Tween = new Tween(pp4, "x", Strong.easeOut, pp4.x, kontener.width, 0.5, true);
}
private function wyswietl(eventObject:MouseEvent):void {
gora.alpha = 0;
gora.graphics.beginFill(0x000000, 0.8);
gora.graphics.drawRect(-100,-100,stage.stageWidth+100,stage.stageHeight+100);
gora.graphics.endFill();
goora.addChild(gora);
stage.addChild(goora);
var myTween:Tween = new Tween(gora, "alpha", Strong.easeOut, gora.alpha, 0.5, 0.7, true);
myTween.addEventListener(TweenEvent.MOTION_FINISH, ukaz);
}
public function ukaz(e:TweenEvent) {
ladowanie.graphics.beginFill(0x000000, 0.4);
ladowanie.graphics.drawRect(0,0,1,5);
ladowanie.graphics.endFill();
ladowanie2.addChild(ladowanie);
ladowanie2.x = (stage.stageWidth / 2) - (pow.width / 2) - 50;
ladowanie2.y = (stage.stageHeight / 2) - (pow.height / 2);
ladowanie2.addEventListener(MouseEvent.CLICK, znikaj);
stage.addChild(ladowanie2);
var pictURL:String = biig;
var pictURLReq:URLRequest = new URLRequest(pictURL);
pictLdr= new Loader();
pictLdr.load(pictURLReq);
pictLdr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loading2);
pictLdr.contentLoaderInfo.addEventListener(Event.COMPLETE, imgLoaded);
}
private function loading2(e:Event):void {
ladowanie2.width = (pictLdr.contentLoaderInfo.bytesLoaded/pictLdr.contentLoaderInfo.bytesTotal)*100;
}
public function imgLoaded(event:Event):void {
ladowanie2.alpha = 0;
pow.addChild(pictLdr.content);
if (pow.width > stage.stageWidth) {
pow.height = (stage.stageWidth -10)*pow.height/pow.width;
pow.width = stage.stageWidth -10;
}
if (pow.height > stage.stageHeight) {
pow.width = (stage.stageHeight -10)*pow.width/pow.height;
pow.height = stage.stageHeight -10;
}
pow.x = (stage.stageWidth / 2) - (pow.width / 2);
pow.y = (stage.stageHeight / 2) - (pow.height / 2);
pow.alpha = 0;
stage.addChild(pow);
pow.addEventListener(MouseEvent.CLICK, znikaj);
var myTween:Tween = new Tween(pow, "alpha", Strong.easeOut, pow.alpha, 1, 0.5, true);
}
public function znikaj(e:MouseEvent) {
pictLdr.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, loading2);
pictLdr.contentLoaderInfo.removeEventListener(Event.COMPLETE, imgLoaded);
ladowanie2.alpha = 0;
pow.alpha = 0;
pow.alpha = 0;
stage.removeChild(goora);
stage.removeChild(pow);
stage.removeChild(ladowanie2);
var myTween:Tween = new Tween(pow, "alpha", Strong.easeOut, pow.alpha, 0, 0.5, true);
}
}
Dodano przez: venon Ranga: 0 Punktów: 0
Komentarze użytkowników
:: Losowe artykuły
:: Wymiana linków
Modowe inspiracje |
Android Gry i Aplikacje |
ZaplanujTransport.pl: Przeprowadzki, transport, aukcje |
Logo dla firmy |
Change Tires - Car Weather Forecast Reminder |
Laminas: MVC Framework for PHP |
IT Books Reviews and Programming: JS, JAVA, PHP, ANDROID, CSS |
Katalog roślin |
Programming articles: JAVA, PHP, C++, Python, JavaScript |
Kancelaria Adwokacka Łukasz Huszno