PDA

View Full Version : [AS3] Dynamically instanciating an Astra Tree Component via AS3


DeJarnett
11-03-2009, 03:35 AM
The Astra Tree Component (from developer.yahoo.com/flash/astra-flash/tree/) works great when I just drop it on the stage and give it an instance name and use it when Flash creates its definition.

Now I would like to be able to conditionally create an instance of the component via AS3, but when I say:

public var newTree:Tree;

I receive the following error:
1046: Type was not found or was not a compile-time constant: Tree.

I am importing com.yahoo.astra.fl.controls.treeClasses.*

If I change the declaration to

public var newTree:List;

Then I can use put the tree component on the stage and populate it, but I don't have access to the Tree methods like openAllNodes.

Would appreciate any suggestions.

Thanks.

camdagr8
11-18-2009, 05:04 PM
you need to import the Tree classes in your AS

import com.yahoo.astra.fl.controls.Tree;
import com.yahoo.astra.fl.controls.treeClasses.*;

And make sure you have the Tree in your Library.

theAgonizer
11-20-2009, 05:07 AM
Here is a quick tutorial on customizing the Astra Tree component. Astra Actionscript 3 Tree Component (http://www.actionscript-flash-guru.com/blog/19-tree-menu-with-actionscript-as3)