I'm working on a program (my first in as3, flex, or flare) that takes in a given dataset and dynamically displays menus and the data. However, somehow the indented node tree I'm using as a menu for now has begun acting oddly. The leaf nodes for some (but not all) of the unexpanded nodes are registering mouse clicks when I'm attempting to select a sibling node below it in the layout. I'd really appreciate it if someone could help me out with this.
The menu is in the class LayoutMenuSprite in the project I've attached, and I've been using the data from the tutorial to test it with (
http://www.cs.berkeley.edu/~jheer/data/h...es.tab.txt)
Thanks,
John
Hi John,
first of all thanks for sharing your source code, looks like a very nice application about to manifest. Since I was always encouraging people to post source code here I felt now in charge of looking into your problem - and for sure learned by doing it. Unfortunately I didn't succeed in solving it, odd stuff. One minor thing I saw which isn't the problem so is that the ExpandControl does call the update of the visualization anyway, so you better not explicitly specify it as the third argument of the constructor of the ExpandControl class.
Code:
private function createExpandControl():ExpandControl
{
var expand:ExpandControl = new ExpandControl(menuVis, Filters.isNodeSprite); //modified
return expand;
}
I assume the optional third parameter is meant for additional update functionality beyond the visualization update.
One thing I noticed is that the "fieldcounts" value of the three menu items which seem to cause trouble are the lowest of all, so I assume there is a problem around the node scale which in your prog depends on this value. But no idea what it is and no time to look into it further now, sorry
In order that more people find your thread here I would recommend you to also post a quick note in the flare sourceforge forum linking to the thread here. This two forum situation is of course not perfect but at least we have here a possibility to attach files to threads ...
cheers
martin
Thanks for taking a look into it. I've been refactoring the code into MXML components, and was hoping I would find the problem while do so, but no luck so far.
I hadn't realized that about the ExpandControl - thanks for the tip.
I'll try and look into the issue being dependent upon fieldcounts, but the top node (sex for the test data) works and has the fewest field counts, and once you exapnd that node, the 'cause' node beneath it is able to be used, and so on down the line, until you hit url which worked anyways ... very odd. Also, if you notice, the buttonMode hand appears on the empty space to the side where the node labels would appear if they were expanded ... I'm still looking into how/why, and I'll let you know if/when I get it ...
I'll make a note on the other forum in a minute, and I'll post the refactored code here too after I get it all working nicely together again.
Ok, so I've refactored a fair bit, and have things sort of in mxml files (basically a token attempt for now ...), and I sort of 'fixed' the indented node problem. By fixed, I mean I moved where the text was, and now I can click on every node in the tree. However, if you mouse by the sides of the menu, the cursor still changes to the hand where there are no nodes or text, and is clickable. So, the un-expanded children are still accessible to a degree, though again, it is the last child node of the previous menu item that is exposed. This hold true for every collapsed node in the tree, including if you collapse the tree down to the root. It also holds true for the other menu (the left menu is the AggregationMenu, and the right is the NodeTrackingMenu).
If anyone gets a chance and wants to look into this, I think it's a childNode issue, not a my-program-specific issue.
Also, this new version uses a couple of changes that I made to the flare source. I added a a line to the Converters class: (there's probably a better way, but this was easiest)
Code:
private static var _lookup:Object = {
"json":new JSONConverter(),
"tab":new DelimitedTextConverter("\t"),
"comma":new DelimitedTextConverter(","),
"graphml":new GraphMLConverter(),
"atom":new AtomConverter()
};
As well as changing the IndentedTreeLayout to allow for a Right -> Left orientation. The source for both files is included in the zip.
John
Hi Jaggy,
thanks a lot for keep us updated with your interesting project. I am busy right now but hopefully I find some time to have a look later.
cheers
martin
Alright, so the same project's been undergoing a bunch of work, and I've run across a problem that I can't figure out. It seems incredibly simple, which is why it's driving me nuts. I can't set the x/y location of a nodesprite. I have the code that says it should do it, but nothing changes. It's driving me crazy because I can't figure out
why.
Here's the section of code: (copyNode just makes a new node and copies the data and props objects over, and all other variables are set to integer values)
Code:
var ns:NodeSprite = copyNode(node)
vis.data.addNode(ns);
ns.x = cell.width * colIndex + cell.width/2;
ns.y = cell.height * rowIndex + cell.height/2;
vis.update(Transitioner.DEFAULT);
The whole project is attached. The problematic code is in TreeGridDisplayScript.as/createNode. When running, it's on the TreeGrid tab, and data/testData.txt should be used (it's LA Homicide dataset with a made-up assailant column. Set Source to race and Target to assailant, and X-axis to almost anything, but date makes the most sense).
Any hints on why this wouldn't work would be amazing.
Thanks,
John
The problem you described initially is not related to just your project. It also doesn't matter what type of layout is used. The problem with the ExpandControl is that it just makes nodes invisible when collapsed. Even though you can't see them, they still act as if they were there, acting on mouse events. That's why you see the cursor change when over them. It's a pretty serious flaw in the control.
I don't know how to fix it. Just wanted you to know that it's not just you.