stop xml gallery running on the next frame
Hi
I need some help I have a xml gallery on one frame (each frame represents a webpage) and when i click on another frame the frames content appears but the xml gallery is still running on top of it, Can you please help me to find a why how to stop the xml gallery running before going on another page. Is there like a stop function ?
the code in as2 i used for the gallery is as below:
#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()),Mat h.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'],[7 6,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,'e aseout');
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'],[t argetMc._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('imagess/'+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',count er/10);
}
}
function stack () {
_root.closeImage ()
for (counter = 0;counter < _root.categories.length; counter++ ) {
_root.photoMC.attachMovie('textHeader','header'+counter,100 0+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',cou nter/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',count er/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.pa dding*2))*Math.random()),_root.padding+Math.abs((_root.SH-(_root.paddi ng*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("graphicp.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'+cou nter,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[i][0] == thePhoto.theCategory){
found = true;
_root.categories[i].push(counter);
}
}
if (!found){
_root.categories.push(new Array(thePhoto.theCategory,counter));
}
smoothImageLoad('imagess/'+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.getBy tesTotal());
trace(perc);
if(perc == 1){
delete this.onEnterFrame;
timer = 3*Math.random();
this.slideTo(_root.padding+Math.abs((_r oot.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*Ma th.random()),2,_root.tweenAnim,timer)
}
}
}
} else {
trace("XML not loaded");
}
}
}
//==========================================
init ();



