How to manage depth in AS2 - actionscript-2

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.

Related

How to fetch dynamic table list in MVC and angularJS

I'm getting a list in my angular.js file (EditDeleteItem.js) which I'm making based on the selected table name.
The function to send my list is as below:-
$scope.SaveTblRecord = function (list) {
//alert(JSON.stringify($scope.employeeList));
$scope.FetchTableName();
//var Data = $.param({ TblData: $scope.MyTblDataList });
var itemList = [];
angular.forEach(list, function (value, key) {
if (list[key].selected) {
itemList.push(list[key].selected);
}
});
$scope.ItemsList = [];
$scope.ItemsList = itemList;
$http({
method: "Post",
url: "/Admin/SaveTblData",
data: $scope.ItemsList,
}).success(function (data) {
$scope.GetTblData($scope.TempName);
}).error(function (err) {
alert(err.Message);
})
};//SaveTblRecord
Now in my Controller I want to fetch that list based on the selected table name but I can't do it :-
public JsonResult SaveTblData(List<LocationTbl> NewTblList) //Need To Have TableName here instead of LocationTbl so that selected table name list is fetched.
{
string MyTableName = Convert.ToString(TempData["TableName"]);
try
{
if (NewTblList == null)
{
return new JsonResult { Data = "Empty Selection", JsonRequestBehavior = JsonRequestBehavior.AllowGet };
}
else {
using (EBContext db = new EBContext())
{
bool results = false;
Type tableType = typeof(CourseDesc);
switch (MyTableName)
{
//case "CourseTbl":
// for (int i = 0; i < NewTblList.Count; i++)
// {
// var CtObj = NewTblList[i];
// CourseTbl ct = db.Courses.AsNoTracking().FirstOrDefault(x => x.ID == CtObj.ID);
// results = UtilityMethods<CourseTbl, int>.EditEntity(db, CtObj);
// }
// break;
//case "CourseDescTbl":
// for (int i = 0; i < NewTblList.Count; i++)
// {
// var CdtObj = NewTblList[i];
// CourseDesc cd = db.CourseDesc.AsNoTracking().FirstOrDefault(x => x.ID == CdtObj.ID);
// results = UtilityMethods<CourseDesc, int>.EditEntity(db, CdtObj);
// }
// break;
//case "CourseSubDesc":
// for (int i = 0; i < NewTblList.Count; i++)
// {
// var CsdObj = NewTblList[i];
// CourseSubDesc csd = db.CourseSubDesc.AsNoTracking().FirstOrDefault(x => x.ID == CsdObj.ID);
// results = UtilityMethods<CourseSubDesc, int>.EditEntity(db, CsdObj);
// }
// break;
//case "InternTbl":
// for (int i = 0; i < NewTblList.Count; i++)
// {
// var ItObj = NewTblList[i];
// InternShip It = db.Interns.AsNoTracking().FirstOrDefault(x => x.ID == ItObj.ID);
// results = UtilityMethods<InternShip, int>.EditEntity(db, ItObj);
// }
// break;
case "LocationTbl":
for (int i = 0; i < NewTblList.Count; i++)
{
var LtObj = NewTblList[i];
LocationTbl lt = db.Loc.AsNoTracking().FirstOrDefault(x => x.ID == LtObj.ID);
results = UtilityMethods<LocationTbl, int>.EditEntity(db, LtObj);
}
break;
}
var resultList = new List<object>();
foreach (var item in db.Set(tableType))
{
resultList.Add(item);
}
return new JsonResult { Data = resultList, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
}
}
}
catch (Exception ex)
{
return new JsonResult { Data = ex.Message, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
}
}
I've been searching the internet for a while and found some related links like Link1
and Link2
But I can't find solution to my problem. Please HELP!!

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString objectForKey:]

My XML response:
{
"S:Envelope" = {
"S:Body" = {
"ns2:getMatchListResponse" = {
item = (
{
answerTime = {
text = 30;
};
challengerAppealsGranted = {
text = "0 of 16";
};
challengerHandle = {
text = manish;
};
challengerMatchesPlayed = {
text = 93;
};
challengerPic = {
text = "image.png";
};
challengerScore = {
text = 0;
};
challengerlosses = {
text = 0;
};
challengerwins = {
text = 4;
};
handle1 = {
text = sahni;
};
handle1AppealsGranted = {
text = 5;
};
handle1MatchesPlayed = {
text = 84;
};
handle1Response = {
text = Pending;
};
handle1Score = {
text = 0;
};
handle1losses = {
text = 0;
};
handle1wins = {
text = 1;
};
handle2MatchesPlayed = {
text = 0;
};
handle2Score = {
text = 0;
};
handle2losses = {
text = 0;
};
handle2wins = {
text = 0;
};
handle3MatchesPlayed = {
text = 0;
};
handle3Score = {
text = 0;
};
handle3losses = {
text = 0;
};
handle3wins = {
text = 0;
};
idMatch = {
text = 750;
};
isAppeal = {
text = false;
};
isFreeForm = {
text = false;
};
isMultichoiceQuestion = {
text = false;
};
isPublic = {
text = false;
};
matchName = {
text = ewtwert;
};
matchStartThresholdTime = {
text = "4 days 7 hrs";
};
matchStatus = {
text = wait;
};
matchType = {
text = Private;
};
noOfPlayers = {
text = 2;
};
priorityInList = {
text = 0;
};
scoreToWin = {
text = 5;
};
timeDuration = {
text = "5 days";
};
turnChangesIn = {
text = 0;
};
},
{
answerTime = {
text = 30;
};
challengerAppealsGranted = {
text = "0 of 16";
};
challengerHandle = {
text = manish;
};
challengerMatchesPlayed = {
text = 93;
};
challengerPic = {
text = "image.png";
};
challengerScore = {
text = 0;
};
challengerlosses = {
text = 0;
};
challengerwins = {
text = 4;
};
handle1MatchesPlayed = {
text = 0;
};
handle1Score = {
text = 0;
};
handle1losses = {
text = 0;
};
handle1wins = {
text = 0;
};
handle2MatchesPlayed = {
text = 0;
};
handle2Score = {
text = 0;
};
handle2losses = {
text = 0;
};
handle2wins = {
text = 0;
};
handle3MatchesPlayed = {
text = 0;
};
handle3Score = {
text = 0;
};
handle3losses = {
text = 0;
};
handle3wins = {
text = 0;
};
idMatch = {
text = 749;
};
isAppeal = {
text = false;
};
isFreeForm = {
text = false;
};
isMultichoiceQuestion = {
text = false;
};
isPublic = {
text = false;
};
matchName = {
text = gfhf;
};
matchStartThresholdTime = {
text = "4 days 6 hrs";
};
matchStatus = {
text = wait;
};
matchType = {
text = Public;
};
noOfPlayers = {
text = 2;
};
priorityInList = {
text = 0;
};
scoreToWin = {
text = 5;
};
timeDuration = {
text = "5 days";
};
turnChangesIn = {
text = 0;
};
}
);
"xmlns:ns2" = "http://services.tgs.com/";
};
};
"xmlns:S" = "http://schemas.xmlsoap.org/soap/envelope/";
};
}
I need value of key "matchStartThresholdTime".
I do:
NSDictionary *dictResult = [XMLReader dictionaryForXMLString:responseString error:nil];
NSDictionary *Enveloper = [dictResult objectForKey:#"S:Envelope"];
NSDictionary *Body = [Enveloper objectForKey:#"S:Body"];
NSDictionary *profileDetails = [Body objectForKey:#"ns2:getMatchListResponse"];
NSMutableArray *items = [profileDetails objectForKey:#"item"];
// NSLog(#"items===>%#",items);
NSDictionary *temp1;
for(temp1 in items)
{
thresholdTime = [NSString stringWithFormat:#"%#",[[temp1 objectForKey:#"matchStartThresholdTime"]objectForKey:#"text"]];...thresholdTime is NSString object.......and this line causes exception
//NSLog(#"time is===>%#",[[temp1 objectForKey:#"matchStartThresholdTime"]objectForKey:#"text"]);
}
What is the problem here?
Temp1 contains an NSString Object and not the NSDictionary, that you expect.
When dealing with JSON it is wise always to (double) check if a received object is really of the type that you expect. Always use
if ([temp1 isKindOfClass:[NSDictionary class]]) ...
or so.

how to to process result of google distance matrix api further?

i am new to programming.. i have this code which gives distance between two points but need to further multiply it by an integer say 10.. the project i am working on is abt calculating distance between two points and multiplying it with fare/Km like Rs.10/km (Indian Rupees) for the same. So if the distance is 30 km the fare would be 30*10 = Rs.300
Thanks in advance
following is the code
<script>
var map;
var geocoder;
var bounds = new google.maps.LatLngBounds();
var markersArray = [];
var origin1 = '';
var destinationA = '';
var destinationIcon = 'https://chart.googleapis.com/chart?chst=d_map_pin_letter&chld=D|FF0000|000000';
var originIcon = 'https://chart.googleapis.com/chart?chst=d_map_pin_letter&chld=O|FFFF00|000000';
function initialize() {
var opts = {
center: new google.maps.LatLng(55.53, 9.4),
zoom: 10,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('map'), opts);
var fromText = document.getElementById('FAdd');
var options = {
componentRestrictions: {country: 'in'}
};var fromAuto = new google.maps.places.Autocomplete(fromText, options);
fromAuto.bindTo('bound', map);
var toText = document.getElementById('TAdd');
var toAuto = new google.maps.places.Autocomplete(toText, options);
toAuto.bindTo('bound', map);
geocoder = new google.maps.Geocoder();
}
function calculateDistances() {
var service = new google.maps.DistanceMatrixService();
service.getDistanceMatrix(
{
origins: [document.getElementById("FAdd").value],
destinations: [document.getElementById("TAdd").value],
travelMode: google.maps.TravelMode.DRIVING,
unitSystem: google.maps.UnitSystem.METRIC,
avoidHighways: false,
avoidTolls: false
}, callback);
}
function callback(response, status) {
if (status != google.maps.DistanceMatrixStatus.OK) {
alert('Error was: ' + status);
} else {
var origins = response.originAddresses;
var destinations = response.destinationAddresses;
var outputDiv = document.getElementById('outputDiv');
outputDiv.innerHTML = '';
deleteOverlays();
for (var i = 0; i < origins.length; i++) {
var results = response.rows[i].elements;
addMarker(origins[i], false);
for (var j = 0; j < results.length; j++) {
addMarker(destinations[j], true);
outputDiv.innerHTML += results[j].distance.text + '<br>';
}
}
}
}
function addMarker(location, isDestination) {
var icon;
if (isDestination) {
icon = destinationIcon;
} else {
icon = originIcon;
}
geocoder.geocode({'address': location}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
bounds.extend(results[0].geometry.location);
map.fitBounds(bounds);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location,
icon: icon
});
markersArray.push(marker);
} else {
alert('Geocode was not successful for the following reason: '
+ status);
}
});
}
function deleteOverlays() {
if (markersArray) {
for (i in markersArray) {
markersArray[i].setMap(null);
}
markersArray.length = 0;
}
}
</script>
I use an Ajax call to PHP, and haven't yet used getDistanceMatrix(), but this should be an easy fix.
First, if you know you will always only have one origin and one destination, you don't need the "for" loop in your callback function. Second, you're taking the distance text rather than the distance value.
function callback(response, status) {
if (status != google.maps.DistanceMatrixStatus.OK) {
[...]
} else {
deleteOverlays();
var outputDiv = document.getElementById('outputDiv'),
origin = response.originAddresses[0],
destination = response.destinationAddresses[0],
result = response.rows[0].elements[0],
distance = result.distance.value,
text = result.distance.text,
price = 10 * distance;
outputDiv.innerHTML = '<p>' + text + ': Rs.' + price + '</p>';
addMarker(origin, false);
addMarker(destination, false);
}
}
I haven't tested this, so it probably needs to be tweaked. ( See https://developers.google.com/maps/documentation/distancematrix/#DistanceMatrixResponses )

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!

FBJS image slider

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?