Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 03-19-2008, 10:38 AM   #1
SirDuke
Geek Apprentice
 
SirDuke's Avatar
 
Join Date: Jun 2007
Location: Greece
Posts: 148
Red face [AS3] Yahoo! ASTRA - Tree Component

Has anyone worked with the "Tree Component" by Yahoo! ASTRA here?

I'd like to make 2 minor changes to the TreeCellRenderer class:
- change the font size according to the depth of the node
- make the font bold when the node is mousedOver

I can't seem to find something inside the class though as i think it inherits the styles from the labelButton class. Will i have to modify something else? Has anyone had any experience with customizing that component before?

Thanks
SirDuke is offline   Reply With Quote
Old 03-24-2008, 01:15 PM   #2
SirDuke
Geek Apprentice
 
SirDuke's Avatar
 
Join Date: Jun 2007
Location: Greece
Posts: 148
Default

bump.. and:

if someone knows of any tutorial or anything else on how to change a CellRenderer function i'd really appreciate the insight.

Thanx
SirDuke is offline   Reply With Quote
Old 03-24-2008, 11:23 PM   #3
allenrabinovich
Omniheurist
 
Join Date: Mar 2008
Posts: 35
Talking Customizing Tree Component

The TextField in the TreeCellRenderer is controlled by the textFormat style of the renderer itself.

Try adding the following line in the set listData function in TreeCellRenderer.as (make sure to add the path containing com/yahoo... to your classpath so that the modified TreeCellRenderer overrides the embedded code. Alternatively, you can create a new custom CellRenderer class and use that instead of the TreeCellRenderer):

ActionScript Code:
setStyle("textFormat", new TextFormat("Arial", 8 + 2*data.nodeLevel));

That would make the size of the font bigger the deeper the node is in the hierarchy ("data" is the pointer to the TNode object; it has a nodeLevel property).

You can also add a custom event listener for roll over and roll out to change the style of the text to bold. You don't even need to do that inside the TreeCellRenderer. Say your tree is called "mytree". Then, the following code will do it:

ActionScript Code:
import fl.events.ListEvent; import com.yahoo.astra.fl.controls.treeClasses.*; // Add listener functions for rolling over and out of tree items mytree.addEventListener(ListEvent.ITEM_ROLL_OVER, rollOverItem); mytree.addEventListener(ListEvent.ITEM_ROLL_OUT, rollOutItem); function rollOverItem (evt:ListEvent) { // Get the cell renderer for the item we just rolled over var cr:TreeCellRenderer = mytree.itemToCellRenderer(evt.item) as TreeCellRenderer; // Get the text format for that cell renderer var tf:TextFormat = cr.getStyle("textFormat") as TextFormat; // Set its bold value to true tf.bold = true; } // Same thing as above but set bold to false function rollOutItem (evt:ListEvent) { var cr:TreeCellRenderer = mytree.itemToCellRenderer(evt.item) as TreeCellRenderer; var tf:TextFormat = cr.getStyle("textFormat") as TextFormat;     tf.bold = false; }



Best,
Allen

Last edited by dr_zeus; 03-26-2008 at 05:42 PM. Reason: please use [as][/as] code formatting tags
allenrabinovich is offline   Reply With Quote
Old 03-25-2008, 12:30 PM   #4
SirDuke
Geek Apprentice
 
SirDuke's Avatar
 
Join Date: Jun 2007
Location: Greece
Posts: 148
Default

WOW.

Allen that is the best first post i have ever seen. It all worked fine. Not only that but it also gives me great ideas on how to implement some other things too.

Thanx alot, i was really stuck there
SirDuke is offline   Reply With Quote
Old 03-25-2008, 08:09 PM   #5
allenrabinovich
Omniheurist
 
Join Date: Mar 2008
Posts: 35
Default

Quote:
Originally Posted by SirDuke View Post
WOW.

Allen that is the best first post i have ever seen. It all worked fine. Not only that but it also gives me great ideas on how to implement some other things too.

Thanx alot, i was really stuck there
Well, in the interest of full disclosure, I wrote the Tree component
allenrabinovich is offline   Reply With Quote
Old 03-26-2008, 12:49 PM   #6
SirDuke
Geek Apprentice
 
SirDuke's Avatar
 
Join Date: Jun 2007
Location: Greece
Posts: 148
Default

Well, i kind of imagined that to be honest :P

Good job
SirDuke is offline   Reply With Quote
Old 11-18-2008, 04:24 PM   #7
acy
Registered User
 
Join Date: Nov 2008
Posts: 2
Default width problem

Hi.
I'm using the yahoo Astra tree. this is very interesting, great source in my process of learning AS3.

Now I have a litle problem with the tree window.
when display my xml info the width cut the horizontal text, the first that I do was transform the width in the property inspector, but the text still appears cut.

I know, I need transform this component property scripting, but, i'm not sure.

Pleas any sight i will glad.

acy.
acy is offline   Reply With Quote
Old 11-19-2008, 06:33 PM   #8
acy
Registered User
 
Join Date: Nov 2008
Posts: 2
Default astra tree and AudioPlayback

Hi.
Any one have an idea of how can I comunicate this two components?.

thanks.

acy
acy is offline   Reply With Quote
Old 12-02-2008, 03:32 PM   #9
gargantus
Registered User
 
Join Date: Dec 2008
Posts: 2
Default Adjust Height of Nodes

Hey There,
Lovin this forum loads of top info,
Anyway, I've been using this tree component and was wondering there is a way to adjust the cell heights to display large text i do not seem to be able to make them any bigger so when i increase the text size style in the renderer it hides half of the text.
Any ideas would great cheers guys,
gargantus is offline   Reply With Quote
Old 04-27-2008, 06:03 PM   #10
Heath Carlisle
Registered User
 
Join Date: Apr 2008
Posts: 1
Default Customizing the Astra Field Renderer?

Quote:
Originally Posted by allenrabinovich View Post
The TextField in the TreeCellRenderer is controlled by the textFormat style of the renderer itself... Alternatively, you can create a new custom CellRenderer class and use that instead of the TreeCellRenderer

Best,
Allen

Super! Hey, Any details on building a customized renderer? Specifically, I am trying to allow the text field that contains the "label" text to autoSize and wrap - but these are properties of the TextField class, and, digging all the way down to ICellRenderer, I can't find where the TextFields are instantiated.

I'd like to build a freely collapsible/expandable "Outliner" (1, 1.1, 1.1.1, 2, 2.2, 2.3.4 etc..) whose vertical field sizes will auto adjust to the contained text paragraph, and whose horizontal width is fixed to allow for additional data representation.

thanks, nice work!

-h
Heath Carlisle is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Yahoo Astra Tree Component - text Width Issue hailemalekat Components 1 01-30-2009 09:28 PM
[AS3] Using ASTRA tree component Narendrakumar Components 0 08-20-2008 09:42 AM
[AS3] A question about yahoo astra treeview dub_beat Components 1 08-12-2008 10:06 AM
really weird stuff (Yahoo ASTRA Tree - CellRenderer) SirDuke Components 2 04-25-2008 09:49 AM
Tree Component crashes, Help! rtnews0423 Components 1 12-29-2004 07:10 PM


All times are GMT. The time now is 07:19 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.