flash - Flashvar makes my swf animation bug -
in image gallery i'm using, i'm sending flashvar set "current" image displayed. image gallery similar coverflow effect in itunes , other apple's things.
in action script code, have var var current:number = 1;
when alter set flashvar value this: var current:number = currentpicture;
thing weird work wanted image current, when scroll display next picture, (that don't bug when scroll downwards previous) next image disappears,..
i paste code here (trimmed asked in comment, here have init() , next() , previous() function.. guess problem somewhere in init() function, i'm not sure):
/*/ itunes album fine art viewer /*/ import flash.display.*; import flash.geom.*; import flash.filters.*; //change these values below customize viewer functionality var root:movieclip = this; var mymo:object; var myko:object; var maxslide:number = 100; var current:number = currentpicture; var scrollbarstart:number = 0; var scrollerdelay:number = 150; var scrollbarstop:number = scrollbar.scroller._width + 49; function init(void):void { mymo = {}; myko = {}; mouse.addlistener(mymo); key.addlistener(myko); (var in infostruc) { loader.clear(); loader.gradient_mc.removemovieclip(); loader.attachmovie("default","art",1); loader._width = frontcdwidth; loader._height = frontcdheight; this["_bmd" + i] = new bitmapdata(loader._width, loader._height); this["_ref" + i] = new bitmapdata(loader._width, loader._height); this["_bmd" + i].draw(loader); var mc:movieclip = loader.createemptymovieclip("gradient_mc", loader.getnexthighestdepth()); matrix = new matrix(); matrix.creategradientbox(loader._width,loader._height,reflectionrotation / 180 * math.pi,0,0); mc.begingradientfill(reflectionfilltype,reflectioncolors,reflectionalphas,reflectionratios,matrix,reflectionspreadmethod,reflectioninterpolationmethod,reflectionfocalpointratio); mc.moveto(0,0); mc.lineto(0,loader._height); mc.lineto(loader._width,loader._height); mc.lineto(loader._width,0); mc.lineto(0,0); mc.endfill(); loader.art._alpha = reflectionalpha; loader.beginfill(reflectionbackgroundcolour); loader.moveto(0,0); loader.lineto(0,loader._height); loader.lineto(loader._width,loader._height); loader.lineto(loader._width,0); loader.lineto(0,0); loader.endfill(); this["_ref" + i].draw(loader); } // edit matth, alhadef // "the lift door 2" (var :number; <= infostruc.length;i++){ var cart:movieclip = this.createemptymovieclip("art" + this.getnexthighestdepth(), this.getnexthighestdepth()); var rart:movieclip = this.createemptymovieclip("reflection" + (this.getnexthighestdepth() - 1), this.getnexthighestdepth()); rart.id = cart.id = rart.cid = cart.cid = number(i) + 1; cart.distortimage(this["_bmd" + cart.id]); controltheobject(cart); rart.distortimage(this["_ref" + cart.id]); controltheobject(rart); var tmpfilter:blurfilter = new blurfilter(reflectionblurx, reflectionblury, reflectionquality); rart.filterarray = []; rart.filterarray.push(tmpfilter); rart.filters = rart.filterarray; } mymo.onmousewheel = function(delta:number):void { if (delta > 0) { next(); } else if (delta <= 0) { previous(); } }; myko.onkeydown = function():void { if (selection.getfocus() != "_level0.goto") { if (key.isdown(key.right)) { next(); } else if (key.isdown(key.left)) { previous(); } } }; scrollbar.scroller.onpress = function():void { dist = this._parent._xmouse - this._x; this.onmousemove = function():void { tmp = 1 + math.ceil(((this._parent._xmouse - dist) - scrollbarstart) / (scrollbar._width - scrollbarstop) * (infostruc.length - 1)); if (tmp > infostruc.length) { tmp = infostruc.length; } if (tmp < 1) { tmp = 1; } current = tmp; updateinfo(); }; }; scrollbar.scroller.onrelease = scrollbar.scroller.onreleaseoutside = function ():void { stopdrag(); delete this.onmousemove; }; scrollbar.left.onpress = function():void { previous(); shifter = setinterval(previous, scrollerdelay); }; scrollbar.right.onpress = function():void { next(); shifter = setinterval(next, scrollerdelay); }; scrollbar.onmouseup = function():void { clearinterval(shifter); }; scrollbar.onmousedown = function():void { if (this.hittest(_xmouse, _ymouse, true) && !this.left.hittest(_xmouse, _ymouse, true) && !this.right.hittest(_xmouse, _ymouse, true)) { if (this._xmouse < this.scroller._x) { previous(); shifter = setinterval(previous, clickdelay); } if (this._xmouse > this.scroller._x + this.scroller._width) { next(); shifter = setinterval(next, clickdelay); } } }; goto.onchanged = function():void { if (!isnan(number(this.text) + 1)) { this.text = math.round(number(this.text)); if (this.text > infostruc.length) { this.text = infostruc.length; } if (this.text < 1) { this.text = 1; } current = this.text; } else { this.text = current; } updateinfo(); }; distance = number(i); mask.removemovieclip(); loader.removemovieclip(); scrollbar.swapdepths(1101); loadnext(); updateinfo(); } function next():void { if (current < infostruc.length) { current += 1; } if (current eq infostruc.length) { // set our autodirect switch go now. autodirect = 0; } updateinfo(); } function previous():void { if (current > 1) { current -= 1; } if (current == 1) { // set our autodirect switch go forwards autodirect = 1; } updateinfo(); }
with code, see line var current:number = currentpicture;
makes bug... but, again, bug appears when switch next picture, if go previous, 2 times next, doesn't bug. i'm not familiar as, , can see, i'm not coder of thing, best understand, modified value enlarge image etc., bug, don't understand...
flash actionscript flashvars
No comments:
Post a Comment