Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 09-20-2002, 07:15 PM   #1
Mathieu_BSL
Senior Member
 
Join Date: Oct 2001
Location: Fiji
Posts: 187
Default [AS1] Tree Component (set 2).

Hi !

I don't know how to use the Tree Component of Macromedia Flash UI component set 2.
I tried some examples in the Help but it do not work...:-(
Can someone post me an example of a complete script that I can use ? (a script using
cool functions!!)

Thank you.

Mathieu

P.S. It's strange that there is no Flash UI Label component in Flash MX (like in Visual Basic)...
Is there such a component somewhere on the web ?
Mathieu_BSL is offline   Reply With Quote
Old 10-28-2002, 10:07 PM   #2
Sameal
Nxovkn
 
Join Date: May 2002
Location: Chattanooga, TN
Posts: 37
Default

There is a label symbol but it is used within the components of the mentioned component set. You can find it in your library in the developer only area. Called FLabelSymbol.

You can alternatively use the TextField component which is built into Flash MX. The FLabelSymbol uses an embedded TextField component. Look up TextField in your actionscript dictionary.

As for how to use the tree, look in your 'References' section, all the methods for the TreeView are there.
Sameal is offline   Reply With Quote
Old 10-29-2002, 02:22 PM   #3
Mathieu_BSL
Senior Member
 
Join Date: Oct 2001
Location: Fiji
Posts: 187
Default

I know about the reference panel, but I can't build the tree. Here is Macromedia code :
(I simply dragged an instance of the Tree component on the stage and called it myTree)


var obj1 = new Object();

obj1["fruitType"] = "banana";

obj1["deliciousness"] = 100;

var obj2 = new Object();

obj2["fruitType"] = "lemon";

obj2["deliciousness"] = 2;

var fruits = new Array();

fruits.push(obj1);

fruits.push(obj2);

myTree.setDataProvider(fruits, "fruitType", "deliciousness");

myTree.setEnabled(true)

myTree.setSize(200,100)

myTree.refresh();
Mathieu_BSL is offline   Reply With Quote
Old 11-05-2002, 05:34 PM   #4
Sameal
Nxovkn
 
Join Date: May 2002
Location: Chattanooga, TN
Posts: 37
Default

var obj1 = new FTreeNode();
obj1.setLabel("banana");
obj1.setData(100);
obj1.fruitType = "banana";
obj1.deliciousness = 100;

var obj2 = new FTreeNode();
obj2.setLabel("lemon");
obj2.setData(2);
obj2.fruitType = "lemon";
obj2.deliciousness = 2;

// NOW Add the nodes manually.

myTree.addNode(myTree.getRootNode(), obj1);
myTree.addNode(myTree.getRootNode(), obj2);

// OR You can use the setDataProvider like this.

var fruits = new Array();
fruits.push(obj1);
fruits.push(obj2);
myTree.setDataProvider(fruits, "fruitType", "deliciousness");

myTree.setSize(200, 100);

// Can place this but I think refresh() is only needed if you
// manipulate the tree after it has been drawn the first time.
// Also enabled defaults to true so don't think you need it either.
myTree.setEnabled(true)
myTree.refresh();

/*
** Personally I have never used the DataProvider method but
** your code you posted looked right for it save for a few missing
** semi-colons. If you create FTreeNode objects rather then
** plain objects then you can add them in directly with
** myTree.addNode(). Also the label and data are set using the
** setter methods setLabel() and setData().
**
** I have used the FTree component successfully with XML
** streams without using the DataProvider route, you just have
** to set up your recursive loops correctly.
*/

Last edited by Sameal; 11-05-2002 at 05:38 PM.
Sameal is offline   Reply With Quote
Old 11-10-2002, 03:52 PM   #5
Mathieu_BSL
Senior Member
 
Join Date: Oct 2001
Location: Fiji
Posts: 187
Default

Thank you, but...I still have a problem...
I dragged an instance of the FTreeSymbol on the stage
and called it "myTree". Then I copied your script on
frame 1... but nothing happened !!!

Is it supposed to be more complex ?!?
I tried a lot of possibilities, using refresh(), setEnabled (true) and so on...

This component is driving me creazy !! Can I have your FLA file please ?!...

Mathieu
Mathieu_BSL is offline   Reply With Quote
Old 11-13-2002, 03:02 PM   #6
Sameal
Nxovkn
 
Join Date: May 2002
Location: Chattanooga, TN
Posts: 37
Default

Ahh okay found out why my code was wrong. You must set a root node before adding nodes. So do this instead.

myTree.setRootNode(new FTreeNode("Fruits"));
myTree.addNode(myTree.getRootNode(), obj1);
myTree.addNode(myTree.getRootNode(), obj2);
Sameal is offline   Reply With Quote
Old 11-13-2002, 03:05 PM   #7
Sameal
Nxovkn
 
Join Date: May 2002
Location: Chattanooga, TN
Posts: 37
Default

Here's the file I made for you...
Attached Files
File Type: zip tree.zip (41.5 KB, 3195 views)
Sameal is offline   Reply With Quote
Old 11-14-2002, 11:40 AM   #8
Mathieu_BSL
Senior Member
 
Join Date: Oct 2001
Location: Fiji
Posts: 187
Default

Wow !

Thank you !

Mathieu
Mathieu_BSL is offline   Reply With Quote
Old 11-26-2004, 04:18 PM   #9
trapman
Registered User
 
Join Date: Nov 2004
Posts: 2
Default

hello ..

I'm trying to do two different Tree Extensions.

the major one is a tree which each node contains a list of checkbox Objects.
The other one, which i think it's easier, it's to select/unselect on click of any element of the node with multiselection feature.

Would like to know if this is possible to do specially the major one.

Thanks a lot ....
trapman is offline   Reply With Quote
Old 06-24-2009, 06:41 AM   #10
ankita.bhavsar
Registered User
 
Join Date: Jun 2009
Posts: 1
Default not able to download zip file

Hello,

I want to look at the source code but not able to download the zip file. Could you please upload it once again?

Thanks in advance,
Ankita
ankita.bhavsar 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


All times are GMT. The time now is 09:52 AM.

///
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.