- Home
- Categorie
- Digital Marketing
- Grafica, Visual Design & UX
- Piccolo ma grande problema con pulsante
-
Piccolo ma grande problema con pulsante
Salve a tutti,
il problema che vi sottopongo è questo con questa situazione iniziale:
stage iniziale con varie foto sparse.
sulle foto è possibile cliccare e attivare così una finestra ad ingrandimento dinamico proporzionato alle dimensioni della finestra flash.
il proggetto è dinamico e collegato ad un xml che fa da database.
non è stato creato da me, io l'ho acquistato e sto apportando delle modifiche essenziali...
il problema di creare il pulsante è legato al fatto che non trovo la finestra che appare, fisicamente non esistente l'oggetto nello stage!
Sapete aiutarmi???
Vi scongiuro...!
-
Ciao gandalf84 benvenuto sul Forum Gt, non è mica facile risponderti senza vedere niente, se vuoi creare un pulsante nella finestra dinamica credo lo debba fare dinamicamente, con cosa viene caricata con loadMovie, attachMovie?
-
grazie sia per il benvenuto che per l'interessamento,
ti posto l'as della pagina principale:
//Stage.scaleMode = "noScale" //Stage.align = "TL" //page1._visible = false //_root.By = page1._x //--------------------------------------------------------------------------------LIBRERIE import mx.transitions.Tween; import mx.transitions.easing.*; import flash.display.BitmapData; import flash.geom.Rectangle; import flash.geom.Matrix; import flash.geom.ColorTransform; import flash.net.FileReference; //------------------------------------------------------------------------------- I DICHIARAZIONE VARIABILI var myMatrix:Matrix = new Matrix(); var myColorTransform:ColorTransform = new ColorTransform(); var blendMode:String = "normal"; var smooth:Boolean = true; var fileRef:FileReference = new FileReference(); //-------------------------------------------------------------------------------- II DICHIARAZIONE VARIABILI var imagesData = [] var depser = 16 var home = this var count = 0 var waiter = 10 var breaker = 15 //numero massimo di immagini per pagina var stopper = breaker /*function newWindowHandler() { getURL(_root.tgt, "_blank") } */ //_level0.ppp = _level0.img.split("-")[0] || 1 //_global.vGGG = Number(_level0.img.split("-")[0]) || 1 //-------------------------------------------------------------------------------- VISUALIZZA O NO BARRA //-------------------------------------------------------------------------------- CARICAMENTO INIZIALE loader._visible = false /*onMouseMove = function() { updateAfterEvent() } */ _global.DDDD = [] // ----------------------------------------------------------------------- FUNZIONE DI TRASCINAMENTO E INGRANDIMENTO MovieClip.prototype.addFunc = function() { //----------------------------------------------------------------------------------- this.container.onRollOver = this.div.onRollOver = function() { //this._parent.bg.gotoAndPlay(2) } //----------------------------------------------------------------------------------- this.container.onRollOut = this.div.onRollOut = function() { //this._parent.bg.gotoAndPlay(11) } //----------------------------------------------------------------------------------- TRASCINAMENTO FOTINE this.container.onPress = function() { mx.behaviors.DepthControl.bringToFront(this._parent); // PORTA IN PRIMO PIANO LA FOTO startDrag(this._parent, false, 40, 40, Stage.width-40, Stage.height-40) // MUOVE LA FOTO CON DRAG } //----------------------------------------------------------------------------------- PERMETTE IL RILASCIO this.container.onRelease = function() { stopDrag(); } //----------------------------------------------------------------------------------- this.container.onReleaseOutside = this.div.onReleaseOutside = function() { stopDrag(); } //----------------------------------------------------------------------------------- APRE LA FINESTRA GRANDE this.div.onRelease = function() { _global.Text = this._parent.C // C E' IL TESTO DELLA FOTO NELL'XML CONTRASSEGNATA DAL CAMPO CDATA //this._parent.bg.gotoAndStop(1) _global.toDes.onPress() // CHIUDE LA PRIMA FINESTRA ALL'APERTURA DI UNA SECONDA FINESTRA //this._visible = false _global.cMc = this._parent mx.behaviors.DepthControl.bringToFront(_global.cMc); // CMC VARIABILE PORTA IN PRIMO PIANO CON PRIORITA //stopDrag(); //this._parent.noFade = true; this._parent.mover() //FUNZIONE DI APERTURA //_root.cI = Number(_global.vGGG) + "-" + (Number(this._parent.CCC+1) - breaker * (Number(_global.vGGG)-1)) //fscommand("gotoAnchor", _root.cI) } } MovieClip.prototype.alpher = function() { if (this.container.c._width) { this.myBitmapData = new BitmapData(this.container.c._width, this.container.c._height) this.myRectangle = new Rectangle(0, 0, this.container.c._width, this.container.c._height); this.myBitmapData.draw(this.container.c, myMatrix, null, blendMode, this.myRectangle, smooth); if(this.myBitmapData.getPixel(0,0) != undefined) { delete this.onEnterFrame; this.container.attachBitmap(this.myBitmapData, 1, "auto", true) for (k=0;k<_global.DDDD.length;k++) { this == _global.DDDD[k] ? this.container._alpha = 50 : null } var Y = this this._x = _global.MUSTBEPAGE ? 10000 : this.WW/2 + random(Stage.width - this.WW*1.5) this._y = _global.MUSTBEPAGE ? 10000 : this.HH + random(Stage.height - this.HH*1.8) this._rotation = random(20) - random(30) this.RR = this._rotation this._visible = true this.bg._width = this.container._width+6 this.bg._height = this.container._height+6 this.container._x += this.bg._x - this.container._x - this.container._width/2 this.container._y += this.bg._y - this.container._y - this.container._height/2 this.div._x = this.container._x + this.container._width - 16 this.div._y = this.container._y + this.container._height - 12 this.c = new Tween(this, "_alpha", Strong.easeOut, 0, 100, 5, false) this.a = new Tween(this, "_xscale", Strong.easeOut, 50, this.WW, 12, false) this.b = new Tween(this, "_yscale", Strong.easeOut, 40, this.HH, 12, false) count++ this.addFunc() if(count == stopper || !Boolean(imagesData[count+1].length)){dest(Y)} else{displayClip()} } } } function dest(h) { h._xscale = h.WW h._yscale = h.HH if(!_root.nml) { callSelected(); _root.nml = true } } //------------------------------------------------------------------------------- FUNZIONE CHE EFFETTUA //------------------------------------------------------------------------------- IL MOVIMENTO MovieClip.prototype.mover = function() { _global.toDes = this /*delete this.container.onPress delete this.container.onRollOver delete this.container.onRollOut delete this.container.onRelease delete this.container.onReleaseOutside delete this.div.onPress delete this.div.onRollOver delete this.div.onRollOut delete this.div.onRelease delete this.div.onReleaseOutside */ var hm = this this.tempX = this._x this.tempY = this._y this.tempWsc = this._xscale this.tempHsc = this._yscale this.tempWt = this._width this.tempHt = this._height this.wratio = (Stage.width-100)/this.W this.hratio = (Stage.height-100)/this.H this.ratio = this.W/this.H this.aaM = new Tween(this.container, "_alpha", Strong.easeOut, this.container._alpha, 0, 10, false) this.xM = new Tween(this, "_x", Strong.easeOut, this._x, Stage.width/2, 20, false) this.rM = new Tween(this, "_rotation", Strong.easeOut, this._rotation, 0, 20, false) this.yM = new Tween(this, "_y", Strong.easeOut, this._y, Stage.height/2, 20, false) if(this.W > Stage.width - 100 || this.H > Stage.height - 100) { if(Number(this.W) > Number(this.H)) { if(Stage.height > Stage.width) { this.W *= this.wratio;this.H = (this.W/this.ratio) } else { this.H *= this.hratio;this.W = (this.H*this.ratio) } } else { if(Stage.height > Stage.width) { this.W *= this.wratio;this.H = (this.W/this.ratio) } else { this.H *= this.hratio;this.W = (this.H*this.ratio) } } } this.xS = new Tween(this, "_width", Strong.easeOut, this._width, Number(this.W)+5, 20, false) this.yS = new Tween(this, "_height", Strong.easeOut, this._height, Number(this.H)+4, 20, false) this.xS.onMotionFinished = function() { mx.behaviors.DepthControl.bringToFront(_root.bigI); mx.behaviors.DepthControl.bringToFront(_root.loader); _root.loader._x = Stage.width/2 _root.loader._y = Stage.height/2 _root.bigI.createEmptyMovieClip("cc", 0) _root.bigI.cc.loadMovie(hm.B) _root.tgt = hm.B _root.nm = hm.B.slice(hm.B.lastIndexOf("/")+1, hm.B.length) _root.bigI._visible = false _root.bigI._rotation = 0 var fgh = 15 _root.onEnterFrame = function() { this.ldd = Math.round((_root.bigI.cc.getBytesLoaded()/_root.bigI.cc.getBytesTotal())*100) fgh-- if(fgh <= 0){_root.loader._visible = true;_root.loader.gotoAndStop(ldd)} if(this.ldd > 99) { if(_root.bigI._width > 0) { delete _root.onEnterFrame _root.myBitmapData1 = new BitmapData(_root.bigI.cc._width, _root.bigI.cc._height) var myRectangle1 = new Rectangle(0, 0, _root.bigI.cc._width, _root.bigI.cc._height); _root.myBitmapData1.draw(_root.bigI, myMatrix, null, blendMode, myRectangle1, smooth); _root.bigI.attachBitmap(_root.myBitmapData1, 0, "always", true) _root.loader._visible = false _root.bigI._width = hm._width - 6 _root.bigI._height = hm._height - 5 _root.bigI._x = Stage.width/2 - hm.W/2 + .3 _root.bigI._y = hm._y - hm._height/2+2 _root.bigI._visible = true _root.bigI.menu = imageMenu; if(_global.DDDD.length < imagesData.length) { _global.DDDD.push(hm) } msk2._width = _root.bigI._width msk2._height = _root.bigI._height msk2._x = _root.bigI._x + _root.bigI._width msk2._y = _root.bigI._y + _root.bigI._height msk2._rotation = 180 mx.behaviors.DepthControl.bringToFront(msk2) msk2.tw = new Tween(msk2, "_height", Strong.easeOut, bigI._height, 0, 40, false) msk2.tw.onMotionFinished = function() { comenter._visible = true comenter._x = bigI._x + bigI._width/2 - comenter._width/4 comenter.YY = bigI._y + bigI._height + 14 comenter._y = bigI._y + bigI._height comenter.v = new Tween(comenter, "_y", Strong.easeOut, comenter._y-comenter._height, comenter.YY+1, 15, false) comenter.v.onMotionFinished = function() { mx.behaviors.DepthControl.bringToFront(comenter) } } } } } } this.onPress = function() { delete this.onPress msk2.tw.fforward() killTip() _root.myBitmapData1.dispose() delete _root.myBitmapData1 _root.loader._visible = false; _root.loader.gotoAndStop(1) delete this.xS.onMotionFinished delete _root.onEnterFrame _root.bigI._visible = false _root.bigI._y = 10000 this.container._alpha = 100 var hm = this this.aM = new Tween(this.container, "_alpha", Strong.easeOut, 100, 50, 20, false) this.xM = new Tween(this, "_x", Strong.easeOut, this._x, this.tempX, 20, false) this.yM = new Tween(this, "_y", Strong.easeOut, this._y, this.tempY, 20, false) this.xS = new Tween(this, "_xscale", Strong.easeOut, this._xscale, this.tempWsc, 20, false) this.pR = new Tween(this, "_rotation", Strong.easeOut, this._rotation, this.RR, 20, false) this.yS = new Tween(this, "_yscale", Strong.easeOut, this._yscale, this.tempHsc, 20, false) this.yS.onMotionFinished = function() { //------------- hm.div._visible = true hm.addFunc() //-------------- } } } var xml = new XML() xml.ignoreWhite = true xml.load("images.xml") xml.onLoad = function(ok) { ok ? parseXML() : trace("XML!") }
continua...
-
function parseXML() { _root.onEnterFrame = function() { waiter -- if(waiter < 0) { waiter = 10 delete _root.onEnterFrame; for (i=0 ; i < xml.firstChild.childNodes.length ; i++) { imagesData* = new Array(); imagesData*[0] = xml.firstChild.childNodes*.attributes.width imagesData*[1] = xml.firstChild.childNodes*.attributes.height imagesData*[2] = xml.firstChild.childNodes*.attributes.thmb imagesData*[3] = xml.firstChild.childNodes*.attributes.big imagesData*[4] = xml.firstChild.childNodes*.childNodes[0].nodeValue } displayButtons() } } } function displayButtons() { if(imagesData.length>breaker) { _global.numOfButs = Math.floor((imagesData.length-1)/breaker)+1 for(g=0 ; g < _global.numOfButs ; g++) { _root.attachMovie("bu", "bu" + g, this.getNextHighestDepth(), {_x:190+ 35*g,_y:20,txt:g+1,range:breaker*g}) _root["bu" + g].bb.onRelease = function() { if(page1._visible) { mover2(0, this._parent.range) } else { reload(this._parent.range) } scrollbar._visible = false div2._visible = false killTip() _global.MUSTBEPAGE = false _global.vGGG = this._parent.txt this.enabled = false this._parent.gotoAndStop(18) _global.ghj.enabled = true _global.ghj._parent.play() _global.ghj = this fscommand("gotoAnchor", Number(_global.vGGG)) delete _root.onEnterFrame _root.bigI.unloadMovie() _root.loader._visible = false } _root["bu" + g].bb.onReleaseOutside = function(){this._parent.play()} } if(imagesData.length > breaker) { _root["bu" + (Number(_level0.ppp)-1)].gotoAndStop(18) _root["bu" + (Number(_level0.ppp)-1)].bb.enabled = false _global.ghj = _root["bu" + (Number(_level0.ppp)-1)].bb } _root.img ? reload(_root["bu" + (Number(_level0.ppp)-1)].range) : displayClip() } else { displayClip() } } function reload(nm) { _root.myBitmapData1.dispose() delete _root.myBitmapData1 count = nm _global.cMc = null delete _global.cMc stopper = nm + breaker _root.bigI._visible = false for(h=0;h<imagesData.length;h++) { _root["mc" + h]._visible = false removeMovieClip(_root["mc" + h]) } displayClip() } function displayClip() { msk2.tw.fforward() killTip() _root.attachMovie("mc", "mc" + count, _root.getNextHighestDepth(),{_x:-100,W:imagesData[count][0],H:imagesData[count][1],B:imagesData[count][3],C:imagesData[count][4],CCC:count}) home["mc" + count].WW = home["mc" + count]._xscale home["mc" + count].HH = home["mc" + count]._yscale home["mc" + count].container.createEmptyMovieClip("c", 1) home["mc" + count].container.c.loadMovie(imagesData[count][2]) home["mc" + count]._visible = true _global.cMc.swapDepths(home["mc" + count]) _root.bigI.swapDepths(_global.cMc) _root.loader.swapDepths(_root.bigI) home["mc" + count].onEnterFrame = function() { this.progr = Math.round((this.container.c.getBytesLoaded()/this.container.c.getBytesTotal())*100) this.progr > 99 ? this.alpher(): null } }; function callSelected() { var g = String("bu" + Number(_level0.img.split("-")[0])) _global.jkl = Number((g).slice(g.length-1,g.length))-1 _level0.img ? _root["mc" + ((Number(_level0.img.split("-")[1])-1) + breaker * _global.jkl)].div.onRelease() : null } function showComments(Hide) { comments._visible = true comments.txt.autoSize = true comments.txt._width = bigI._width - 1 comments.txt.htmlText = _global.Text comments.bg._width = comments.txt._width + 100 comments.bg._x = comments.txt._x - 10 masker._width = comments.txt._width +1 comments.bg._height = masker._height = comments.txt._height + 2 comments._x = bigI._x + 29 comments.Y = bigI._y + bigI._height - comments._height + 10 Hide ? comments._y = comments.Y + comments._height : null masker._x = bigI._x masker._y = bigI._y + bigI._height - masker._height mx.behaviors.DepthControl.bringToFront(comments); comments.setMask(masker) Hide ? comments.a = new Tween(comments, "_y", Strong.easeOut, comments._y, comments.Y, 15, false) : comments.b = new Tween(comments, "_y", Strong.easeOut, comments._y, comments._y + comments._height, 15, false) } function killTip() { comments._visible = false comenter.g = false comenter.txt.text = "Show comments" comenter._visible = false } comenter.onRollOver = function(){this.gotoAndStop(2)} comenter.onRollOut = function(){this.play()} comenter.onRelease = function() { if(!this.g) { showComments(true);this.g = true;this.txt.text = "Hide comments"} else { showComments(false);this.g = false;this.txt.text = "Show comments" } } this.onResize = function() { _root.ff._x = Stage.width/2 _root.ff._y = Stage.height/2 player._y = Stage.height -137 } Stage.addListener(this) onResize() function cleaner(page) { var t = count - breaker _global.toDes.onPress() function executor() { _root["mc" + t].clean = new Tween(_root["mc" + t], "_x", Strong.easeIn, _root["mc" + t]._x, _root["mc" + t]._x + Stage.width*1.4, 20, false) t++ if(t > breaker+(count - breaker)){clearInterval(__i);pageMover(page)} } var __i = setInterval(executor, 50) }; b1.bb.onRelease = b2.bb.onRelease = function() { scrollbar._visible = false _global.MUSTBEPAGE = true this.enabled = false this._parent.gotoAndStop(18) _global.ghj.enabled = true _global.ghj._parent.play() _global.ghj = this if(page1._visible){mover2(this._parent.page)}else{cleaner(this._parent.page)} }; function pageMover(p) { page1.gotoAndStop(p) page1._visible = true page1._y = Stage.height/2 page1.mov = new Tween(page1, "_x", Strong.easeInOut, page1._x, Stage.width/2, 30, false) page1.mov.start() }; function mover2(m, m2) { page1.mov = new Tween(page1, "_x", Strong.easeIn, page1._x, Stage.width*1.5, 15, false) page1.mov.onMotionFinished = function() { page1._x = _root.By m == 0 ? f() : pageMover(m) } function f() { page1._visible = false reload(m2) } }
-
Un codicino da niente, quando ho detto vedere non intendevo proprio questo, come si fa a provare, comunque come si chiama la finestra, dimmi almeno se è un movieclip in libreria un swf.
-
la finestra in cui devo mettere il pulsante si dovrebbe chiamare bigI oppure bg...