FBJS image slider - fbjs

Im trying to recreate a slider similar to:
http://www.facebook.com/BacardiLimon?v=app_146177448730789
but apparently there is zero documentation on how to do something like this with FBJS :'(
var eCardPos = 0;
var totalCards = 4;
var animationFadeTime = 300;
var cardUrls = [];
cardUrls[0]= '';
cardUrls[1]= '';
cardUrls[2]= '';
cardUrls[3]= '';
function changeEcardPrev()
{
eCardPos--;
if (eCardPos < 0) {
eCardPos = totalCards-1;
}
showEcard();
}
function changeEcardNext()
{
eCardPos++;
if (eCardPos > totalCards-1) {
eCardPos = 0;
}
showEcard();
}
function changeEcard(pos)
{
eCardPos = pos;
showEcard();
}
function showEcard()
{
var elCard = document.getElementById('cardImage');
var elLink = document.getElementById('cardLink');
var elPreload = document.getElementById('preload_card_'+eCardPos);
for (var i=0;i<totalCards;i++)
{
document.getElementById('cardButton_'+i).removeClassName('active');
}
document.getElementById('cardButton_'+eCardPos).addClassName('active');
elLink.setHref(cardUrls[eCardPos]);
Animation(elCard).to("opacity", 0).duration(animationFadeTime).checkpoint(1, function() {
elCard.setSrc(elPreload.getSrc());
}).to("opacity", 1).duration(animationFadeTime).go();
//Animation(elCard).to("opacity", 1).duration(animationFadeTime).go();
}
I happened to find the src but I dont even know where to start :\
EDIT:
I think I found something that might help but the images slide :\ I just want them to appear when a direction is pressed.
var numslides = 3;
var slidesvisible = 1;
var currentslide = 0;
var slidewidth = 300;
function goright() {
if (currentslide <= (numslides-slidesvisible-1)) {
Animation(document.getElementById('slideshow_inner')).by('right', slidewidth+'px').by('left', '-'+slidewidth+'px').go();
if (currentslide == (numslides-slidesvisible-1)) {
Animation(document.getElementById('right_button')).to('opacity', '0.3').go();
Animation(document.getElementById('left_button')).to('opacity', '1').go();
}
if (currentslide < (numslides-slidesvisible-1)) { Animation(document.getElementById('left_button')).to('opacity', '1').go(); }
currentslide++;
}
}
function goleft() {
if (currentslide > 0) {
Animation(document.getElementById('slideshow_inner')).by('left', slidewidth+'px').by('right', '-'+slidewidth+'px').go();
if (currentslide == 1) {
Animation(document.getElementById('left_button')).to('opacity', '0.3').go();
Animation(document.getElementById('right_button')).to('opacity', '1').go();
}
if (currentslide > 1) { Animation(document.getElementById('right_button')).to('opacity', '1').go(); }
currentslide--;
}
}
How would I get the image to fade in and out rather than slide?

Related

calling a function inside mongoose hook 'post save' returns same doc

In my schema I'm having a post save hook like
DateInfoSchema.post('save', function (doc) {
var newDoc = helper. getListTimeRate(doc);
console.log(newDoc);
});
Then I'm having a helper module in that I'm having a function to calculate date range
lets consider 'doc' startdate and enddate so I want to calculate date range from start date to enddate
module.exports = {
getListTimeRate: function (data, yearEndDate) {
var toDate = new Date(),
weekName = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];
Date.prototype.addDays = function(days) {
var dateAdd = new Date(this.valueOf());
dateAdd.setDate(dateAdd.getDate() + days);
return dateAdd;
};
function getDates(startDate, stopDate) {
var dateArray = [];
var currentDate = startDate;
if (currentDate == undefined){
while (currentDate <= stopDate) {
dateArray.push(currentDate);
currentDate = currentDate.addDays(1);
}
return dateArray;
}else {
var newCurrentDate = new Date(currentDate.toISOString().substr(0,10));
var newStopDate = new Date(stopDate.toISOString().substr(0,10));
while (newCurrentDate <= newStopDate) {
dateArray.push(newCurrentDate);
newCurrentDate = newCurrentDate.addDays(1);
}
return dateArray;
}
}
function calcRange(entry) {
// function get time
var dateList = [],
newList = [];
if (toDate < entry.endDate) {
// calc from endDate
newList = getDates(entry.startDate, entry.endDate);
//status often
selectDateFromOften();
} else {
if (yearEndDate) {
newList = getDates(entry.startDate, entry.endDate);
} else {
newList = getDates(entry.startDate, toDate);
}
// calc from toDate
//status often
selectDateFromOften();
}
function getDateTimeAnother() {
if (entry.hour) {
var setHour = entry.hour.getHours(),
setMin = entry.hour.getMinutes(),
setSecond = entry.hour.getSeconds();
}
dateList.forEach(function(entryDate){
entryDate.setHours(setHour);
entryDate.setMinutes(setMin);
entryDate.setSeconds(setSecond);
});
entry.rangeDate = dateList;
var compareUsedDate = [];
_.forEach(entry.frequencyId, function(value) {
compareUsedDate.push(value.dateRated);
});
entry.rangeDate = _.differenceBy(entry.rangeDate, compareUsedDate,Math.floor);
entry.rangeDate = entry.rangeDate.filter(function( element ) {
return element !== undefined;
});
console.log(dateList);
if (yearEndDate) {
return dateList;
}
}
function selectDateFromOften() {
switch(entry.oftenStatus) {
// Daily
case "0":
for (var i = 0; i< newList.length; i++) {
dateList.push(newList[i]);
}
getDateTimeAnother();
break;
//Weekly
case "1":
for (var i = 0; i< newList.length; i++) {
if (i == 0 || i % 7 == 0) {
dateList.push(newList[i]);
}
}
getDateTimeAnother();
break;
//Bi-Weekly
case "2":
for (var i = 0; i< newList.length; i++) {
if (i == 0 || i % 14 == 0) {
dateList.push(newList[i]);
}
}
getDateTimeAnother();
break;
//Monthly
case "3":
// for (var i = newList.length-1; i >= 0; i--) {
for (var i = 0; i< newList.length; i++) {
if (i == 0 || i % 28 == 0) {
dateList.push(newList[i]);
}
}
getDateTimeAnother();
break;
//Custom Date
case "4":
dateList = newList;
getDateCustom();
break;
default:
}
}
}
if (data.length) {
_.forEach(data, function(entry) {
if(entry.startDate != undefined){
calcRange(entry);
}
});
} else {
if(data.startDate != undefined){
calcRange(data);
}
}
return data;
}
};
But inside the hook 'newDoc' doesn't have 'rangeDate' field in it. Can anyone help me solve this issue? Thank you.

How to get the video ended event in titanium appcelerator

I have load video url at run time using the setInterval() before assign video i am try to clear the setinterval
Also have used onComplete="donextcall" for assingn new video path to videoview but it fire twice so please help me
<VideoPlayer id="videoPlayersinglezone" ns="Ti.Media" autoplay="true" height="100%" width="100%" onComplete="donextcall" url="" backgroundColor="black" />
var f = Ti.Filesystem.getFile(Ti.Filesystem.externalStorageDirectory +'SinglezoneData/', singleimgs[tempcall]);
clearInterval(x)
$.videoPlayersinglezone.url = f.nativePath;
$.videoPlayersinglezone.show();
I have using titanium 3.1.1 and alloy 1.2.2 anything missing please tell me.
Full code example
var common = require('common');
var singleimgs = [];
var fistentry = 0;
doFirstClickSingleZone();
function doFirstClickSingleZone() {
var totalads = Titanium.App.Properties.getString('total_files_on_sdcard');
$.videoPlayersinglezone.mediaControlStyle = Titanium.Media.VIDEO_CONTROL_HIDDEN;
LoadData(totalads);
}
function LoadData(adscount) {
var fistcall = 0;
for (var i = 0; i < adscount; i++) {
singleimgs[i] = Titanium.App.Properties.getString('dwnfname' + i);
}
}
var tempcall=0;
function donextcall() {
/*
fistentry++;
if (fistentry % 2 == 0) {
} else {
tempcall++;
RenderAd(tempcall);
}
*/
tempcall++;
RenderAd(tempcall);
}
function RenderAd(imgid) {
if (imgid == singleimgs.length) {
tempcall = 0;
} else {
tempcall= imgid;
}
var t = Titanium.App.Properties.getString('timeInt');
var x = setInterval(function() {
if (tempcall < singleimgs.length) {
var arry = [];
arry = singleimgs[tempcall].split(".");
var exte;
exte = arry[arry.length - 1];
if (exte == 'png' || exte == 'jpg' || exte == 'gif' || exte == 'jpeg' || exte == 'tif') {
common.getnotification();
$.videoPlayersinglezone.url = "";
$.videoPlayersinglezone.hide();
var f = Ti.Filesystem.getFile(Ti.Filesystem.externalStorageDirectory +'SinglezoneData/', singleimgs[tempcall]);
$.myImg.image = f.nativePath;
$.myImg.show();
tempcall++;
} else {
//if(exte=='mp4' || exte=='avi' || exte=='3gp' || exte=='mov' || exte == 'flv'){
common.getnotification();
var f = Ti.Filesystem.getFile(Ti.Filesystem.externalStorageDirectory +'SinglezoneData/', singleimgs[tempcall]);
//Titanium.App.Properties.setString('videopath', f.nativePath);
//Titanium.App.Properties.setString('imgcount', tempcall++);
$.myImg.image = '';
$.myImg.hide();
clearInterval(x);
$.videoPlayersinglezone.url = f.nativePath;
$.videoPlayersinglezone.show();
}
} else {
common.getnotification();
clearInterval(x);
callAgain();
}
}, 10000);
}
//this callaAgain() I have use to call RenderAd(imgid) to display image or video randomly so u have any solution please help me my application aim to display image or video from sdcard randomly
function callAgain() {
RenderAd(singleimgs.length);
}

How do you stop a swf from going blank after a user clicks print or cancel print using AS2?

I have an embedded swf that contains a print button which allows users to print some or all pages (AS 2.0) of the swf. The browser's print dialog box opens when the user clicks the print button from the swf. However, after the user clicks print, the swf become blank. This only occurs in IE and FF - works fine in Chrome. Here's the AS2.0 code:
print_btn.onPress = function() {
attachMovie("printbg", "printbg", 5000);
printbg._x = 623;
printbg._y = 360;
attachMovie("printall", "printall", 5001);
printall._x = 621;
printall._y = 316;
attachMovie("printun", "printun", 5002);
printun._x = 622;
printun._y = 342;
attachMovie("printcancel", "printcancel", 5003);
printcancel._x = 622;
printcancel._y = 367;
printcancel.onPress = function() {
removeprint();
};
function removeprint() {
removeMovieClip("printbg");
removeMovieClip("printall");
removeMovieClip("printun");
removeMovieClip("printcancel");
}
printall.onPress = function() {
printallterms();
removeprint();
};
printun.onPress = function() {
printunlearnedterms();
removeprint();
};
};
function printallterms() {
pageno = 0;
toptitle = "<b>"+title+"</b>\nALL\n\n";
attachMovie("printpage_mov", "printall"+pageno, 500);
this["printall"+pageno]._x = 1000;
this["printall"+pageno]._y = 0;
this["printall"+pageno].printtxt.htmlText = toptitle;
for (x=1; x<=20; x++) {
if (this["printall"+pageno].printtxt.textHeight+45>680) {
pageno++;
attachMovie("printpage_mov", "printall"+pageno, 501);
this["printall"+pageno]._x = 1000;
this["printall"+pageno]._y = 0;
this["printall"+pageno].printtxt.htmlText = "";
}
this["printall"+pageno].printtxt.htmlText += "<b>"+term_i[x]+"</b>"+"\n";
this["printall"+pageno].printtxt.htmlText += definition_i[x]+"\n\n";
}
printjobs();
}
function printunlearnedterms() {
pageno = 0;
toptitle = "<b>"+title+"</b>\nREMAINING\n\n";
attachMovie("printpage_mov", "printall"+pageno, this.getNextHighestDepth());
this["printall"+pageno]._x = 1000;
this["printall"+pageno]._y = 0;
this["printall"+pageno].printtxt.htmlText = toptitle;
for (x=1; x<=20; x++) {
if (this["printall"+pageno].printtxt.textHeight+45>680) {
pageno++;
attachMovie("printpage_mov", "printall"+pageno, this.getNextHighestDepth());
this["printall"+pageno]._x = 1000;
this["printall"+pageno]._y = 0;
this["printall"+pageno].printtxt.htmlText = "";
}
if (learned[x] == 0) {
this["printall"+pageno].printtxt.htmlText += "<b>"+term_i[x]+"</b>"+"\n";
this["printall"+pageno].printtxt.htmlText += definition_i[x]+"\n\n";
}
}
printjobs();
}
function printjobs() {
var allprintjob:PrintJob = new PrintJob();
allprintjob.start();
pagesToPrint = 0;
while (pagesToPrint<=pageno) {
allprintjob.addPage(this["printall"+pagesToPrint], {xMin:0, xMax:540, yMin:0, yMax:700});
//trace(this["printall"+pagesToPrint]._height);
removeMovieClip(this["printall"+pagesToPrint]);
pagesToPrint++;
}
if (pagesToPrint>0) {
allprintjob.send();
}
delete allprintjob;
}
Please help!

YouTube in UIWebView only plays once

I have a UIWebView with some YouTube Videos embeded via the iframe code:
<iframe width="190" height="102" src="http://www.youtube.com/embed/...?showinfo=0" frameborder="0" allowfullscreen></iframe>
When it first loads it is possible to view each video exactly once. After viewing it the area is just black with white "Youtube" in it.
Any ideas? Of course reloading the UIWebView after watching a video fixes it, but I don't like this...
I did it! The following Javascript did the job:
<script>
VideoIDs = new Array(...some ids here...);
function getFrameID(id){
var elem = document.getElementById(id);
if (elem) {
if(/^iframe$/i.test(elem.tagName))
return id;
var elems = elem.getElementsByTagName("iframe");
if (!elems.length)
return null;
for (var i=0; i<elems.length; i++) {
if (/^https?:\/\/(?:www\.)?youtube(?:-nocookie)?\.com(\/|$)/i.test(elems[i].src))
break;
}
elem = elems[i];
if (elem.id)
return elem.id;
do {
id += "-frame";
} while (document.getElementById(id));
elem.id = id;
return id;
}
return null;
}
var YT_ready = (function(){
var onReady_funcs = [], api_isReady = false;
return function(func, b_before){
if (func === true) {
api_isReady = true;
for (var i=0; i<onReady_funcs.length; i++){
onReady_funcs.shift()();
}
} else if(typeof func == "function") {
if (api_isReady)
func();
else
onReady_funcs[b_before?"unshift":"push"](func);
}
}
})();
function onYouTubePlayerAPIReady() {
YT_ready(true)
}
(function(){
var s = document.createElement("script");
s.src = "http://www.youtube.com/player_api";
var before = document.getElementsByTagName("script")[0];
before.parentNode.insertBefore(s, before);
})();
var players = new Array();
YT_ready(function() {
for(index in VideoIDs) {
var frameID = getFrameID(VideoIDs[index]);
if (frameID) {
players[frameID] = new YT.Player(frameID, {
events: {
"onStateChange": stateChange
}
});
}
}
});
function youtube_parser(url){
var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/;
var match = url.match(regExp);
if (match&&match[7].length==11){
return match[7];
}
}
function stateChange(event) {
if(event.data == YT.PlayerState.ENDED){
document.location = 'callback:finished';
document.getElementById(youtube_parser(event.target.getVideoUrl())).contentWindow.location.reload(true);
}
}
</script>

How to manage depth in AS2

How do I change the movie clip (mainClip) in AS2 code below so that is behind all graphics in the flash file?
Code is below:
import flash.display.BitmapData;
import flash.geom.Matrix;
import flash.geom.Rectangle;
import flash.geom.Point;
var imageBmp:BitmapData;
//setting the width of blind parts.
var widthB:Number = 40;
//setting the speed of blind parts movement;
var speedChart = 5;
//time to wait lo load another image
var nbSpeedPhoto:Number = 3000;
//Setting the minimum and maximum alpha for controls container and updating timer
var nbACMin:Number = 10;
var nbACMax:Number = 65;
var nbACUpd:Number = 40;
//Setting the minimum and maximum alpha for textField Container
var nbATMin:Number = 0;
var nbATMax:Number = 100;
var nbABMin:Number = 0;
var nbABMax:Number = 65;
//Setting the color for textField Container and font title
var nbATBackColor:Number = 0xD0C8CD;
var nbATFontColor:Number = 0x1F0010;
//Setting the right margin and top margin for controls
var nbRightMC:Number = 2;
var nbTopMC:Number = 2;
//Setting the bottom margin for title and its height
var nbBottomMT:Number = 5;
var nbHeightMT:Number = 50;
//Init Slider viewer
var bbPlay:Boolean = true;
//Setting left to right (1), right to left (2), paralell(3), or random(4) transition
var nbForm:Number = 4;
//if you don't choose parallel, setting the time lag.
var nbLag:Number = 1;
//initial state of FullScreen and AutoPlaying buttons
var bbFull:Boolean = false;
var bbAnimating:Boolean = false;
var bbEnableTitle:Boolean = false;
var bbActiveTitle:Boolean = false;
//setting the first image number to load
var imageNum:Number = 0;
var imageLast:Number;
//initial Photo
var nbPhoto:Number = 0;
//timer variables
var nbTimerNow:Number = 0;
var nbTimerNext:Number = nbSpeedPhoto;
/*********Arrays*******************/
//used for load XML values
var arPhotoPath:Array = new Array();
var arPhotoTitle:Array = new Array();
/**Setting listener to load images**********/
var listener:Object = new Object();
listener.onLoadComplete = function(imageClip:MovieClip):Void {
if (imageNum>0) {
imageBmp = new BitmapData(mainClip["image"+imageLast]._width, mainClip["image"+imageLast]._height);
imageBmp.draw(mainClip["image"+imageLast],new Matrix());
var sqBmp:BitmapData;
var x:Number = 0;
var y:Number = 0;
if (nbForm == 1 || nbForm == 2 || nbForm == 3) {
form = nbForm;
} else {
rnd=Math.random()
if (rnd>0.66) {
form = 1;
} else if (rnd>0.33){
form = 2;
}else{
form = 3;
}
}
for (var j:Number = 0; j<cols; j++) {
x = j*widthB;
if (j>=cols-1) {
var ww = Stage.width-j*widthB;
} else {
var ww = widthB;
}
sqBmp = new BitmapData(ww, mcMask._height);
sqBmp.copyPixels(imageBmp,new Rectangle(x, y, ww, mcMask._height),new Point(0, 0));
cloneClip.createEmptyMovieClip("clone"+imageLast,cloneClip.getNextHighestDepth());
makeSq(sqBmp,j,form);
}
}
unloadMovie(mainClip["image"+imageLast]);
bbAnimating = false;
bbEnableTitle = true;
nbTimerNext = getTimer()+nbSpeedPhoto;
nbOK = 0;
mcText.tfToolTip.text = "Photo "+String(nbPhoto+1)+" of "+String(xmlLength)+": "+arPhotoTitle[nbPhoto];
mcText.tfToolTip.setTextFormat(myformat);
imageNum++;
};
var imageLoader:MovieClipLoader = new MovieClipLoader();
imageLoader.addListener(listener);
/***Creating Squares*******/
function makeSq(sqBmp:BitmapData, jValue:Number, fvalue:Number):Void {
var sqClip:MovieClip = cloneClip["clone"+imageLast].createEmptyMovieClip("sq"+jValue, cloneClip["clone"+imageLast].getNextHighestDepth());
sqClip.attachBitmap(sqBmp,1);
sqClip._x = jValue*widthB;
if (fvalue == 1) {
sqClip.lag = jValue;
} else if(fvalue == 2) {
sqClip.lag = cols-jValue;
}else{
sqClip.lag = 0;
}
sqClip.init = 0;
sqClip.onEnterFrame = function() {
if (this.init>this.lag) {
this._xscale = this._xscale-speedChart;
}
this.init += nbLag;
if (this._yscale<0 || this._xscale<0) {
unloadMovie(this);
}
};
}
//setting the main movieclip and its clone.
//the clone will store the parts of the main image.
this.createEmptyMovieClip("mainClip",this.getNextHighestDepth());
this.createEmptyMovieClip("cloneClip",this.getNextHighestDepth());
this.createEmptyMovieClip("mcMask",this.getNextHighestDepth());
this.createEmptyMovieClip("mcMask2",this.getNextHighestDepth());
//Creating the text container and setting its properties
this.createEmptyMovieClip("mcText",this.getNextHighestDepth());
mcText.createEmptyMovieClip("mcBackText",this.getNextHighestDepth());
makeARectangle(mcText.mcBackText,0,Stage.height-nbBottomMT-nbHeightMT,Stage.width,nbHeightMT,nbATBackColor,100);
mcText.mcBackText._alpha = 0;
//Creating the mc text container
mcText.createTextField("tfToolTip",mcText.getNextHighestDepth(),0,Stage.height-nbBottomMT-nbHeightMT,Stage.width,nbHeightMT);
mcText.tfToolTip._alpha = 0;
//Creating the masks
var bmpMask:BitmapData = new BitmapData(Stage.width, Stage.height, false, 0xCCCCCC);
mcMask.attachBitmap(bmpMask,this.getNextHighestDepth());
mcMask2.attachBitmap(bmpMask,this.getNextHighestDepth());
mainClip.createEmptyMovieClip("image"+imageNum,this.getNextHighestDepth());
//setting the number of columns and files
var cols = Math.ceil(mcMask._width/widthB);
//setting the main and clone masks
mainClip.setMask(mcMask2);
cloneClip.setMask(mcMask);
//setting buttons behaviors
if (bbPlay) {
mcControl.mcPausePlay.gotoAndStop("onPlay");
} else {
mcControl.mcPausePlay.gotoAndStop("onPause");
}
mcControl.mcBackControls.onRollOver = mcControl.mcFull.onRollOver=mcControl.mcLast.onRollOver=mcControl.mcFirst.onRollOver=mcControl.mcPrevious.onRollOver=mcControl.mcPausePlay.onRollOver=mcControl.mcNext.onRollOver=function () {
clearInterval(activeID);
activeID = setInterval(activeControl, nbACUpd, true);
};
mcControl.mcBackControls.onRollOut = mcControl.mcFull.onRollOut=mcControl.mcLast.onRollOut=mcControl.mcFirst.onRollOut=mcControl.mcPrevious.onRollOut=mcControl.mcPausePlay.onRollOut=mcControl.mcNext.onRollOut=function () {
clearInterval(activeID);
activeID = setInterval(activeControl, nbACUpd, false);
};
function activeControl(bb:Boolean) {
if (bb) {
if (mcControl._alpha>=nbACMax) {
clearInterval(activeID);
} else {
mcControl._alpha += 4;
}
} else {
if (mcControl._alpha<nbACMin) {
clearInterval(activeID);
} else {
mcControl._alpha -= 4;
}
}
}
mcControl.mcFull.onRelease = function() {
if (bbFull) {
Stage.displayState = "normal";
this.gotoAndStop("onNormal");
bbFull = false;
} else {
Stage.displayState = "fullScreen";
this.gotoAndStop("onFull");
bbFull = true;
}
};
mcControl.mcPausePlay.onRelease = function() {
if (bbPlay) {
this.gotoAndStop("onPause");
bbPlay = false;
clearInterval(initPhoto);
} else {
if (!bbAnimating) {
this.gotoAndStop("onPlay");
bbPlay = true;
clearInterval(initPhoto);
initPhoto = setInterval(initPlay, 200);
}
}
};
mcControl.mcLast.onRelease = mcControl.mcFirst.onRelease=mcControl.mcPrevious.onRelease=mcControl.mcNext.onRelease=function () {
if (bbAnimating == false) {
clearInterval(initPhoto);
mcControl.mcPausePlay.gotoAndStop("onPause");
bbPlay = false;
mcControl.mcPausePlay.onRelease;
switch (this._name) {
case "mcFirst" :
nbPhoto = 0;
break;
case "mcPrevious" :
nbPhoto = (xmlLength+nbPhoto-1)%xmlLength;
break;
case "mcNext" :
nbPhoto = (nbPhoto+1)%xmlLength;
break;
case "mcLast" :
nbPhoto = xmlLength-1;
break;
default :
break;
}
imageLast = imageNum-1;
mainClip.createEmptyMovieClip("image"+imageNum,mainClip.getNextHighestDepth());
imageLoader.loadClip(arPhotoPath[nbPhoto],mainClip["image"+imageNum]);
bbAnimating == true;
}
};
/********************************/
function makeEnabled(bbEnable:Boolean) {
with (mcControl) {
mcPausePlay.enabled = bbEnable;
mcLast.enabled = bbEnable;
mcFirst.enabled = bbEnable;
mcPrevious.enabled = bbEnable;
mcNext.enabled = bbEnable;
}
}
function makeVisible(bbVisible:Boolean) {
with (mcControl) {
mcPausePlay.enabled = bbVisible;
mcLast.enabled = bbVisible;
mcFirst.enabled = bbVisible;
mcPrevious.enabled = bbVisible;
mcNext.enabled = bbVisible;
}
}
function initPlay() {
if (bbAnimating == false) {
if (bbPlay) {
if (getTimer()>=nbTimerNext) {
nbPhoto = (nbPhoto+1)%xmlLength;
imageLast = imageNum-1;
mainClip.createEmptyMovieClip("image"+imageNum,mainClip.getNextHighestDepth());
imageLoader.loadClip(arPhotoPath[nbPhoto],mainClip["image"+imageNum]);
bbAnimating = true;
nbTimerNext += nbSpeedPhoto;
}
}
}
}
var myformat:TextFormat = new TextFormat();
myformat.font = "myFont";
myformat.color = nbATFontColor;
myformat.size = 18;
mcText.tfToolTip.embedFonts = true;
mcText.tfToolTip.wordWrap = true;
mcText.onRollOver = function() {
if (bbEnableTitle && !bbAnimating) {
alphaTitle(nbATMax,nbABMax);
bbActiveTitle = true;
}
};
mcText.onRollOut = function() {
if (bbEnableTitle) {
alphaTitle(nbATMin,nbABMin);
bbActiveTitle = false;
}
};
function alphaTitle(nbTextAlpha:Number, nbBackAlpha) {
mcText.mcBackText._alpha = nbBackAlpha;
mcText.tfToolTip._alpha = nbTextAlpha;
mcText.tfToolTip.setTextFormat(myformat);
}
//drawing a square
function makeARectangle(mc:MovieClip, x:Number, y:Number, w:Number, h:Number, nbColor:Number, nbAlpha:Number) {
mc.lineStyle(1,nbColor,0);
mc.beginFill(nbColor,nbAlpha);
mc.moveTo(x,y);
mc.lineTo(x+w,y);
mc.lineTo(x+w,y+h);
mc.lineTo(x,y+h);
mc.lineTo(x,y);
mc.endFill();
}
//for loading external XML
var xmlPhotos:XML = new XML();
xmlPhotos.onLoad = function() {
xmlLength = this.firstChild.childNodes.length;
for (var i:Number = 0; i<xmlLength; i++) {
arPhotoPath[i] = (this.firstChild.childNodes[i].attributes.path);
arPhotoTitle[i] = (this.firstChild.childNodes[i].childNodes[0].firstChild.nodeValue);
}
imageLoader.loadClip(arPhotoPath[0],mainClip["image"+imageNum]);
bbAnimating = true;
initPhoto = setInterval(initPlay, 200);
};
/****Run XML*****************************************/
xmlPhotos.ignoreWhite = true;
xmlPhotos.load("photos.xml");
mainClip.swapDepths(1);
you need to make sure that all the movieclips are on the same layer on the timeline.