PDA

View Full Version : tree component bug


ralcus
03-10-2008, 07:41 AM
Hi all, I’m using flash 8 and I’m having a go for the first time with the tree component. I followed lee brimlows tutorial(gotoandlearn.com) and I’m pretty sure I’ve not done anything wrong but I have a strange problem.

It works great but every now an then it seems to break itself, when I click on one of the expand arrows it will either expand the wrong folder or expand it further down from where it should be. The tree component is in an external swf file I’m loading into a movieclip within my main application.

Its hard to recreate the bug seems too happen randomly and infrequently but enough for it to be a problem.

The only thing I’m doing differently then in lee's tutorial is I’m toggling the visibility of the clip I loaded the tree into but that shouldn’t matter, plus I’ve changed some of the properties a little bit:

this.tree_comp.setStyle("fontFamily", "Arial");
this.tree_comp.setStyle("fontSize", 14)
this.tree_comp.setStyle("embedFonts", false)
this.tree_comp.setStyle("fontWeight", "bold")
this.tree_comp.setStyle("backgroundColor",0xFFFFFF)
this.tree_comp.setStyle("borderStyle", "none");
this.tree_comp.setStyle("color",0x000000);
this.tree_comp.setStyle("textIndent",0);
this.tree_comp.setStyle("indentation",10);
this.tree_comp.setStyle("rollOverColor",0x027ACA);
this.tree_comp.setStyle("selectionColor", 0x027ACA);
this.tree_comp.setStyle("textRollOverColor", 0xFFFFFF);
this.tree_comp.setStyle("textSelectedColor",0xFFFFFF);
this.tree_comp.vScrollPolicy = 'off'
import mx.transitions.easing.*;
this.tree_comp.setStyle("openDuration", 800);
this.tree_comp.setStyle("openEasing", Bounce.easeOut);

but I’ve tested turning some of these on and off and it still seems to happen now and again.

Anyone else come across this? Is there a known bug for the tree component? Thanks for any information anyone can give me :confused:

ralcus
03-10-2008, 09:50 AM
not a fault with the tree component, just me being a fool :p i realised the problem only happened after loading in a particular external .swf file into the application, this .swf was mucking around with the .swf that had my tree in it because it has this function laying around in it:

//-------------------------------------
Array.prototype.randomize = function() {
return this.sort(function (a, b) {
return (Math.floor(Math.random()*2) == 0) ? 1 : -1;
});
//------------------------------------------------------

so it was randomising my tree array :)