I am making a “polaroid gallery” which is draggeable
I have a XML that says :<?xml version=“1.0” encoding= “UTF-8” ?>
<gallery>
<photo name=“Australia”>
<details URL=“Australia 628.jpg” category=“Landscapes”></details>
</photo>
<photo name=“The Blue Sky Above”>
<details URL=“sky.jpg” category=“landscapes”></details>
</photo>
<photo name=“Latop SX 3000”>
<details URL=“laptop.jpg” category=“technology”></details>
</photo>
<photo name=“Router L6 Adv”>
<details URL=“router.jpg” category=“technology”></details>
</photo>
<photo name=“New VW Dashboard”>
<details URL=“dash.jpg” category=“motor vehicles”></details>
</photo>
<photo name=“The Egg”>
<details URL=“egg.jpg” category=“food and bev”></details>
</photo>
<photo name=“Latop SX 3000”>
<details URL=“screen.jpg” category=“technology”></details>
</photo>
<photo name=“Good Year 17s”>
<details URL=“asa.jpg” category=“motor vehicles”></details>
</photo>
<photo name=“The Tranquil View”>
<details URL=“lake.jpg” category=“landscapes”></details>
</photo>
<photo name=“Greener on the Other Side”>
<details URL=“ooo.jpg” category=“landscapes”></details>
</photo>
<photo name=“The Beauty within”>
<details URL=“flower.jpg” category=“nature”></details>
</photo>
<photo name=“The Glorious Rain”>
<details URL=“drops.jpg” category=“nature”></details>
</photo>
</gallery>
Also on a layer i have this: #include “lmc_tween.as”
import flash.filters.DropShadowFilter;
stop();
_global.smoothImageLoad = function(imgURL, targetMovie) {
var i=0
do { i++ } while (eval("_root.smoothImageLoadTemp"+i) != undefined)
tmc = _root.createEmptyMovieClip(“smoothImageLoadTemp”+i, _root.getNextHighestDepth())
tmc.createEmptyMovieClip(“ti”, tmc.getNextHighestDepth())
tmc.tm = targetMovie
with(tmc) {
tmcl = new MovieClipLoader()
tmcl.onLoadComplete = function() {
ti.onEnterFrame = function() {
pixelData = new flash.display.BitmapData(ti._width, ti._height);
pixelData.draw(ti);
tm.attachBitmap(pixelData, 1, true, true);
tm.smoothImageLoadComplete()
removeMovieClip(ti._parent)
}
}
tmcl.loadClip(imgURL, tmc.ti)
}
}
mymc.smoothImageLoadComplete = function() {
trace(“yeah baby yeah!!!”)
}
function init () {
catHeight = 26;
tweenSpeed = 1;
_root.tweenAnim = ‘easeInOut’;
maxHeight = 260;
_root.padding = 60
_root.SW = Stage.width;
_root.SH = Stage.height;
_root.loadbar._xscale = 0;
loadData();
}
function closeImage () {
trace(‘CLOSE’);
mainLoad.tween(['_x','_y'],[_root.SW*20,_root.SH*20],0,'easeout',1);
mainLoad.alphaTo(0,1,'easeout');
}
function openImage (theMC) {
if(_root.selectMC._x == _root.SW/2){
_root.selectMC.slideTo(Math.abs(_root.SW*Math.random()),Math.abs(_root.SH*Math.random()),1,'easeInOut');
_root.selectMC.photoHold.rotateTo(Math.abs(180*Math.random()),1,'easeInOut');
}
theMC.slideTo(_root.SW/2,_root.SH/2,1,'easeInOut');
theMC.photoHold.rotateTo(0,1,'easeInOut');
_root.selectMC = theMC;
var myImage:MovieClipLoader = new MovieClipLoader();
var imgListener:Object = new Object();
_root.loadbar.alphaTo(100,1)
_root.loadbar.onEnterFrame = function () {
perc = (mainLoad.mainImg.getBytesLoaded()/mainLoad.mainImg.getBytesTotal())*100;
_root.loadbar._xscale += (perc - _root.loadbar._xscale)/2;
trace(_root.loadbar._xscale);
}
imgListener.onLoadInit = function(targetMc:MovieClip) {
delete _root.loadbar.onEnterFrame;
_root.loadbar._xscale = 100;
_root.loadbar.alphaTo(0,1)
targetMc._parent.alphaTo(100,1,'easeout',1);
targetMc._parent.mainImg.alphaTo(0,0,'easeout');
targetMc._parent.details.alphaTo(0,0,'easeout');
targetMc._parent.mainLoadBack.tween(['_width','_height'],[76,89],0,'easeout');
targetMc._parent.tween(['_x','_y'],[_root.SW/2,_root.SH/2],0,'easeout');
targetMc._parent.mainLoadBack.tween(['_x','_y'],[0,15],0,'easeout');
targetMc._parent.details.thePhotoName._x = -targetMc._width/2;
targetMc._parent.details.thePhotoName._y = targetMc._height/2 + 10;
targetMc._parent.details.theCatText._x = targetMc._width/2 - 160;
targetMc._parent.details.theCatText._y = targetMc._height/2 + 12;
targetMc._parent.details.photoName = _root.selectMC.theName;
targetMc._parent.details.catText = _root.selectMC.theCategory;
targetMc._parent.mainLoadBack.tween(['_width','_height'],[targetMc._width + 20,targetMc._height + 50],1,'easeout',1);
targetMc.tween(['_x','_y'],[-(targetMc._width/2),-(targetMc._height/2)],0,'easeout');
targetMc._parent.mainImg.alphaTo(100,2,'easeout',1.5);
targetMc._parent.details.alphaTo(100,2,'easeout',1.7);
};
mainLoad.alphaTo(0,1,'easeout');
myImage.addListener(imgListener);
myImage.loadClip('images/'+theMC.imageURL, _root.mainLoad.mainImg);
}
function showDetails (theMC) {
delete _root.details.onEnterFrame;
_root.details.onEnterFrame = function () {
this._x -= (this._x - _root._xmouse)/3;
this._y -= (this._y - _root._ymouse)/3;
}
_root.details.thePhotoName.autoSize = true;
_root.details.thePhotoName.text = theMC.theName;
_root.details.thePhotoName._x = 73 - (_root.details.thePhotoName._width/2);
_root.details.thePhotoName._y = -70 - (_root.details.thePhotoName._height/2);
_root.details.theCat = theMC.theCategory;
_root.details.alphaTo(100,1);
}
function hideDetails (theMC) {
_root.details.alphaTo(0,1);
}
function closeStack () {
if (_root.stackBut._currentframe > 20) {
_root.stackBut.gotoAndPlay(41);
}
for (counter = 0;counter < _root.categories.length; counter++ ) {
_root.photoMC['header'+counter].alphaTo(0,1,'easeOut',counter/10);
}
}
function stack () {
_root.closeImage ()
for (counter = 0;counter < _root.categories.length; counter++ ) {
_root.photoMC.attachMovie('textHeader','header'+counter,1000+counter);
divX = (_root.SW/(_root.categories.length+1))
_root.photoMC['header'+counter]._alpha = 0;
_root.photoMC['header'+counter]._x = divX+(counter*divX);
_root.photoMC['header'+counter]._y = 80;
_root.photoMC['header'+counter].theTitle = _root.categories[counter][0];
_root.photoMC['header'+counter].alphaTo(100,1,'easeOut',counter/10);
for (counter1 = 1;counter1 < _root.categories[counter].length; counter1++ ) {
thePhoto = _root.photoMC['photo'+_root.categories[counter][counter1]];
delete thePhoto.photoHold.onEnterFrame;
thePhoto.slideTo(divX+(counter*divX),20+(counter1*120),1,'easeInOut');
thePhoto.photoHold.rotateTo(0,2,'easeInOut')
}
}
}
function randomize () {
for (counter = 0;counter < _root.categories.length; counter++ ) {
_root.photoMC['header'+counter].alphaTo(0,1,'easeOut',counter/10);
}
for (counter = 0;counter < _root.totPhotos; counter++ ) {
thePhoto = _root.photoMC['photo'+counter];
delete _root.photoMC['photo'+counter].photoHold.onEnterFrame;
thePhoto.slideTo(_root.padding+Math.abs((_root.SW-(_root.padding*2))*Math.random()),_root.padding+Math.abs((_root.SH-(_root.padding*2))*Math.random()),1,'easeInOut')
thePhoto.photoHold.rotateTo( thePhoto.photoHold._rotation + (Math.abs(360*Math.random())-180),2,'easeInOut')
}
}
function loadData() {
menu_xml = new XML();
menu_xml.load("gallery.xml");
menu_xml.ignoreWhite = 1;
menu_xml.onLoad = function(ok) {
if (ok) {
_root.totPhotos = menu_xml.firstChild.childNodes.length;
_root.categories = new Array();
tempCat = '';
_root.shuffleBut.slideTo(44,38,1,_root.tweenAnim,3)
_root.shuffleBut.alphaTo(100,1,_root.tweenAnim,3)
_root.stackBut.slideTo(104,35,1,_root.tweenAnim,3.5)
_root.stackBut.alphaTo(100,1,_root.tweenAnim,3.5)
for (counter = 0;counter < totPhotos; counter++ ) {
node = menu_xml.firstChild.childNodes[counter]
_root.photoMC.attachMovie('photoItem','photo'+counter,counter);
thePhoto = _root.photoMC['photo'+counter];
thePhoto.theName = node.attributes.name;
thePhoto.nodeDetails = new Array();
thePhoto.imageURL = node.childNodes[0].attributes.URL;
tempArr = thePhoto.imageURL.split('.',2);
thePhoto.thumbURL = tempArr[0]+'_small.'+tempArr[1];
thePhoto.theCategory = node.childNodes[0].attributes.category;
found = false;
for(i = 0;i < _root.categories.length;i++){
if(_root.categories*[0] == thePhoto.theCategory){
found = true;
_root.categories*.push(counter);
}
}
if (!found){
_root.categories.push(new Array(thePhoto.theCategory,counter));
}
smoothImageLoad('images/'+thePhoto.thumbURL, thePhoto.photoHold.imgLoad)
thePhoto._x = Math.abs(_root.SW/2);
thePhoto._y = _root.SH + 200;
var dropShadow:DropShadowFilter = new DropShadowFilter(2, 45, 0x000000, 0.3, 5, 5, 2, 3);
thePhoto.filters = [dropShadow];
thePhoto.onEnterFrame = function () {
perc = (this.photoHold.imgLoad.getBytesLoaded()/this.photoHold.imgLoad.getBytesTotal());
trace(perc);
if(perc == 1){
delete this.onEnterFrame;
timer = 3*Math.random();
this.slideTo(_root.padding+Math.abs((_root.SW-(_root.padding*2))*Math.random()),_root.padding+Math.abs((_root.SH-(_root.padding*2))*Math.random()),1,_root.tweenAnim,timer)
this.photoHold.rotateTo(Math.abs(360*Math.random()),2,_root.tweenAnim,timer)
}
}
}
} else {
trace("XML not loaded");
}
}
}
//==========================================
init ();
When i try it it says error on opening and the URL of the photo, this gallery was take from one in ffiles, and i took the code and re- draw it if you want to do see it because it weights too much for me to put it in here the link is: http://www.ffiles.com/flash/photo_galleries/interactive_xml_gallery_with_sorting_1434.html
Thanx