using "this." within a function construct such as
siguiente_btn.onPress = function (){ if (this.contador<=this.cant) { means you are talking about the variables beloging to siguiente_btn not to its parent. if its located on the root u can do this: siguiente_btn.onPress = function (){ if (_root.contador<=_root.cant) { or if you are within a movie and the button is attached to the movie and you want to get the vaiables of the movie clip rather than the root use: siguiente_btn.onPress = function (){ if (_parent.contador<=_parent.cant) { hope this helps, mike On 07/06/06, jcanistrum <[EMAIL PROTECTED]> wrote:
When you are using siguiente_btn.onPress = function (){ if ( this.contador this in this context is seguiente_btn and not your app I think one solution could be to refer to siguiente_btn attaching from the library, with something like var contador: Number = 0 ; var nextBtn = this.attachMovie( "myButtonLibrary", "siguiente_btn", level) ; nextBtn.onRelease = function() { trace( contador++ ) ; } 2006/6/7, Jorge Antonio Diaz Gutierrez <[EMAIL PROTECTED]>: > > Hi everyone. I have a Problem with this code and I've been testing it > for hours. I don't know much about Flash Develop. It tells everything's > right, but Macromedia Flash Pro 8 traces it Undeffined. Could anyone > tell me wath's the problem. > > Thanks > > > Private var contador:Number; > public function Control (){ > contador=1; > siguiente_btn.onPress = function (){ > if (this.contador<=this.cant) > { > trace("siguiente"); > trace(this.contador); > //this.cont++; > } > > } > atras_btn.onPress = function(){ > if (this.contador!=1) > { > this.cargaImagen(this.contador); > this.cont--; > trace("atras") > } > } > } > > _______________________________________________ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > -- João Carlos _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
_______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com