[Re: [Flashcoders] DK - redrawing interface elements after destruction]
Anthony Lee wrote: At any rate - when i create my thumbnails, all works fine the first time, but after they have been wiped out, and I recall my method to re-draw the thumbnails, for some reason my buttons are not working. Now I did a bunch of tracing tests to see if: Hi dnk, This may not be a proper answer to your question, but when faced with this kind of headache I stick all the problem buttons, thumbnails etc in a single movieclip, delete that clip to clear them, and redraw the whole thing from scratch. Bad for the processor, good for my sanity. Tony Ok - as an update I realized why this was not working - my buttons were being wiped out and recreated, but the original delegates (onPress) were the issue. When my class was initialized the delegates were calling their respective functions as it should. The issue I had was that when the 2nd page of thumbnails were loaded - the buttons were still listening to hte original delegate functions. I have written those functions to use variables to load the images - but it seems that when the functions used by delegate - had not updated the variables.. it seemed to only want to do that on the initial load. I hope i am explaining this properly. For the way I seem to think about code - it would be nice if there was a way to write dynamic functions. But that is another posting. -- dnk ___ 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
Re: [Flashcoders] DK - redrawing interface elements after destruction
Anthony Lee wrote: At any rate - when i create my thumbnails, all works fine the first time, but after they have been wiped out, and I recall my method to re-draw the thumbnails, for some reason my buttons are not working. Now I did a bunch of tracing tests to see if: Hi dnk, This may not be a proper answer to your question, but when faced with this kind of headache I stick all the problem buttons, thumbnails etc in a single movieclip, delete that clip to clear them, and redraw the whole thing from scratch. Bad for the processor, good for my sanity. Tony Well that is essentially what I am doing. Although my code writes a bunch of empty MC's and then removes them after - and then tries to recreate it. create (simplified): for (var i:Number = 0; i < 35; i++) { //create empty MC's to hold reg. buttons (non components) this._targetMc.slidemenu.createEmptyMovieClip("btn_mc" + i, this._targetMc.slidemenu.getNextHighestDepth()); //create loaders for thumbnails. this._targetMc.slidemenu.createObject("Loader", "theThumb" + i, this._targetMc.slidemenu.getNextHighestDepth()); //create the actual btns from my library into the empty MC's this._targetMc.slidemenu["btn_mc" + i].createObject("HitDk", "theHit" + i, this._targetMc.slidemenu["btn_mc" + i].getNextHighestDepth()); //add content to loaders this._targetMc.slidemenu["theThumb" + i].contentPath = this.baseURL + myThumb; } remove (simplified): for (var i:Number = 0; i < 35; i++) { //remove the loader components this._targetMc.slidemenu.destroyObject("theThumb" + i); //unload the MC's containing my non-component btns this._targetMc.slidemenu["btn_mc" + i].unloadMovie(); } Now like i said - the 2nd time it runs the create portion, everything is messed up - which makes no sense to me. I mean if it worked the first time, why not a second? The only thing I can think of is it by chance the objects are not actually removed (even though a visual test says they are). ideas? Thanks. d ___ 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
Re: [Flashcoders] DK - redrawing interface elements after destruction
At any rate - when i create my thumbnails, all works fine the first time, but after they have been wiped out, and I recall my method to re-draw the thumbnails, for some reason my buttons are not working. Now I did a bunch of tracing tests to see if: Hi dnk, This may not be a proper answer to your question, but when faced with this kind of headache I stick all the problem buttons, thumbnails etc in a single movieclip, delete that clip to clear them, and redraw the whole thing from scratch. Bad for the processor, good for my sanity. Tony ___ 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] DK - redrawing interface elements after destruction
Hi there - I have two methods in a class - one that creates a bunch of thumbnails, and one that wipes them out to be redrawn again at a later time (due to requiring a different number of thumbnails). At any rate - when i create my thumbnails, all works fine the first time, but after they have been wiped out, and I recall my method to re-draw the thumbnails, for some reason my buttons are not working. Now I did a bunch of tracing tests to see if: 1) they were created properly 2) if they were put into the proper x & y locations 3) if the buttons created were actually there by the proper instance names 4) the buttons were actually the proper type (ie instanceof) 5) if the MC's created were actually there by the proper instance names 6) the MC's were actually the proper type (ie instanceof) They all traced back properly. But for some reason the buttons do not work (the cursor does not change into the "hand"). And no onPress events are fired. I loop through a database result to build the buttons within empty MC's also created at runtime. While it loops it is also creating runtime loader components and assigning thumbnails to them. Then when a person clicks for the next page of thumbnails, another function is called which uses destroyObject to remove my loader instances, and then uses unloadMovie to remove MC's which contain my buttons. Then the recordset is incremented and the function is called all over to build the next pages of thumbnails. ideas? ___ 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