Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
// XML-File
var xmlfilename:String = new String("files.xml");
// Standard values
var Path:String = new String("");
var fadeInTime:Number = new Number(1);
var nextPicTime:Number = new Number(2);
// Deklare the variables
var Pictures:Array = new Array();
var Active:Number = new Number(0);
var Act_MC:Boolean = new Boolean(false);
var systemDaten:XML = new XML();
// Ignore whitespace in XML
systemDaten.ignoreWhite = true;
// Function to load the XML data
systemDaten.onLoad = function(success) {
var data_first = systemDaten.firstChild;
// Getting the attributes of the Slider
if(data_first.attributes.folder) Path = data_first.attributes.folder;
if(data_first.attributes.fadeInTime) fadeInTime = data_first.attributes.fadeInTime;
if(data_first.attributes.nextPicTime) fadeInTime = data_first.attributes.nextPicTime;
// Getting the pictures in the XML
for(i1=0; i1<data_first.childNodes.length; i1++){
Pictures.push(data_first.childNodes[i1].attributes.name);
}
// Start the Slider
startIt();
}
// Start the XML-Data-Loading
systemDaten.load(xmlfilename);
// Starting the Slideshow
function startIt(){
// Create the IMG-MC
_root.createEmptyMovieClip("mc_0", 20);
mc_0._alpha = 100;
mc_0.loadMovie(Path + "/" + Pictures[Active]);
// Create the empty Second-IMG-MC
_root.createEmptyMovieClip("mc_1", 10);
mc_1.alpha = 0;
// Start the interval
setInterval(switching, nextPicTime*1000);
}
// Switch the Picture
function switching(){
// Setting the active MC
Act_MC=Act_MC==true?false:true;
// Setting the Key of the new Picture
Active = Active >= Pictures.length-1 ? 0 : Active+1;
// Loading the new Picture
actMC = _root["mc_"+(Act_MC==true?1:0)]; // Setting the relation-variable
actMC.alpha = 0; // Blending-Out
actMC.swapDepths(actMC.getDepth()+20); // Swapping over the past picture
actMC.loadMovie(Path + "/" + Pictures[Active]); // Loading
// Fading the new Picture in
fadePic(actMC);
}
// Fading-IN a picture
function fadePic(pic){
FadeIn = new mx.transitions.Tween(pic, "_alpha", mx.transitions.easing.Regular.easeInOut , 0, 100, fadeInTime, true);
}
<pictures folder="bilder" fadeInTime="1" nextPicTime="2">
<pic name="pic0.jpg" />
<pic name="pic1.jpg" />
<pic name="2.jpg" />
<pic name="3.jpg" />
<pic name="4.jpg" />
<pic name="5.jpg" />
<pic name="6.jpg" />
<pic name="7.jpg" />
<pic name="8.jpg" />
</pictures>
// XML-File
var xmlfilename:String = new String("images/stories/flash/files.xml");
// Standard values
var Path:String = new String("");
var fadeInTime:Number = new Number(1);
var nextPicTime:Number = new Number(2);
// Deklare the variables
var Pictures:Array = new Array();
var Active:Number = new Number(0);
var Act_MC:Boolean = new Boolean(false);
var systemDaten:XML = new XML();
// Ignore whitespace in XML
systemDaten.ignoreWhite = true;
// Function to load the XML data
systemDaten.onLoad = function(success) {
var data_first = systemDaten.firstChild;
// Getting the attributes of the Slider
if(data_first.attributes.folder) Path = data_first.attributes.folder;
if(data_first.attributes.fadeInTime) fadeInTime = data_first.attributes.fadeInTime;
if(data_first.attributes.nextPicTime) fadeInTime = data_first.attributes.nextPicTime;
// Getting the pictures in the XML
for(i1=0; i1<data_first.childNodes.length; i1++){
Pictures.push(data_first.childNodes[i1].attributes.name);
}
// Start the Slider
startIt();
}
// Start the XML-Data-Loading
systemDaten.load(xmlfilename);
// Starting the Slideshow
function startIt(){
// Create the IMG-MC
_root.createEmptyMovieClip("mc_0", 20);
mc_0._alpha = 100;
mc_0.loadMovie(Path + "/" + Pictures[Active]);
// Create the empty Second-IMG-MC
_root.createEmptyMovieClip("mc_1", 10);
mc_1.alpha = 0;
// Start the interval
setInterval(switching, nextPicTime*1000);
}
// Switch the Picture
function switching(){
// Setting the active MC
Act_MC=Act_MC==true?false:true;
// Setting the Key of the new Picture
Active = Active >= Pictures.length-1 ? 0 : Active+1;
// Loading the new Picture
actMC = _root["mc_"+(Act_MC==true?1:0)]; // Setting the relation-variable
actMC.alpha = 0; // Blending-Out
actMC.swapDepths(actMC.getDepth()+20); // Swapping over the past picture
actMC.loadMovie(Path + "/" + Pictures[Active]); // Loading
// Fading the new Picture in
fadePic(actMC);
}
// Fading-IN a picture
function fadePic(pic){
FadeIn = new mx.transitions.Tween(pic, "_alpha", mx.transitions.easing.Regular.easeInOut , 0, 100, fadeInTime, true);
}
<pictures folder="images/stories/flash/bilder" fadeInTime="1" nextPicTime="2">
<pic name="pic0.jpg" />
<pic name="pic1.jpg" />
<pic name="2.jpg" />
<pic name="3.jpg" />
<pic name="4.jpg" />
<pic name="5.jpg" />
<pic name="6.jpg" />
<pic name="7.jpg" />
<pic name="8.jpg" />
</pictures>