stop xml gallery running on the next frame
stop xml gallery running on next frame
hi
i need have xml gallery on 1 frame (each frame represents webpage) , when click on frame frames content appears xml gallery still running on top of it, can please me find why how stop xml gallery running before going on page. there stop function ?
the code in as2 used gallery 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()),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,'ease out');
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',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.rando m()),_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("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'+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[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.getbytestotal());
trace(perc);
if(perc == 1){
delete this.onenterframe;
timer = 3*math.random();
this.slideto(_root.padding+math.abs((_root.sw-(_root.paddin g*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 ();
that code not good.
but might able want adding movieclip keyframe want gallery appear , change:
tmc = _root.createemptymovieclip("smoothimageloadtemp"+i, _root.getnexthighestdepth())
to
tmc = yourmovieclipthatonlyappearsintheframewhereyouwantyourgallerytoappear.createemptymoviecli p("smoothimageloadtemp"+i, yourmovieclipthatonlyappearsintheframewhereyouwantyourgallerytoappear.getnexthighestdepth ())
More discussions in ActionScript 1 and 2
adobe
Comments
Post a Comment