  | |  | Events question, call class method | Events question, call class method 2004-03-11 - By Keith L. Miller
Back Honestly, I'm not sure. I was having the same issues you were, and that is the only way I could get a reference back to myTree from inside the buttons. I wish I had a better answer for you on that. Maybe one of the Flash Gods on this list can explain better.
Regards,
Keith
-- -- Original Message -- -- From: "Christophe Herreman" <christophe_herreman@(protected)> To: <flashcoders@(protected)> Sent: Thursday, March 11, 2004 8:41 AM Subject: Re: [Flashcoders] Events question, call class method
> This works, but isn't that a bad reference to your class? > Like this, I think you can have only 1 instance of your treeclass, that is > "myTree" > > Christophe > -- -- Original Message -- -- > From: "Keith L. Miller" <millerk@(protected)> > To: <flashcoders@(protected)> > Sent: Thursday, March 11, 2004 3:21 PM > Subject: Re: [Flashcoders] Events question, call class method > > > > I do similar things with button for my tree. The first thing I do in the > on > > release function is this: > > > > var tree:mx.controls.Tree = this._parent.myTree; > > > > Then I can reference myTree using the "tree" variable. > > > > Hope this helps. > > > > Keith > > > > -- -- Original Message -- -- > > From: "Christophe Herreman" <christophe_herreman@(protected)> > > To: <flashcoders@(protected)> > > Sent: Thursday, March 11, 2004 8:14 AM > > Subject: [Flashcoders] Events question, call class method > > > > > > > Hello guys, > > > > > > I'm working on a tree which is build from a couple of classes. > > > I tried to separate the data from the ui elements, which resulted in 3 > > > classes > > > > > > 1) CHTree.as > > > 2) CHTreeNode.as > > > 3) CHTreeRenderer.as > > > > > > In the CHTreeRenderer class, I create all the mc's that represent the > > tree. > > > They all get an icon, a label, and an expand/collapse button (don't know > > how > > > to call it). > > > I now want to open a branch when I click on that expand button. > > > My code is as follows. > > > > > > node_mc.nodeState.onRelease = function(){ > > > var b_open = (this._parent.ref.isOpen()) ? false : true; > > > this._parent.ref.setIsOpen(b_open); > > > } > > > > > > This simply flips the open/close state of the node, which works fine. > > > To test if the tree opens, I made a button which calls the render() > > method. > > > All works fine. > > > > > > I now want to call that method each time I press the expand/collapse > > button. > > > The problem is that I do not have access to my TreeRenderer methods in > the > > > button's onRelease code > > > > > > node_mc.nodeState.onRelease = function(){ > > > var b_open = (this._parent.ref.isOpen()) ? false : true; > > > this._parent.ref.setIsOpen(b_open); > > > this.renderNode(this._parent.ref); -> renderNode is a method in > > the > > > TreeRenderer class > > > } > > > > > > So, how can I call that method? > > > Is the onRelease event the best way to do this, or should I use > Listeners > > or > > > AsBroadcaster or something like that? > > > > > > thx in advance > > > Christophe > > > > > > > > > > > > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > > > Supported by Fig Leaf Software > > > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > > > Be sure to check the archives and the wiki: > > > http://chattyfig.figleaf.com/ > > > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > > > http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:106621 > > > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > > > To unsubscribe send a blank e-mail to: > > > Normal Mode: flashcoders-unsubscribe@(protected) > > > Digest Mode: flashcoders-digest-unsubscrive@(protected) > > > > > > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > > Supported by Fig Leaf Software > > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > > Be sure to check the archives and the wiki: > > http://chattyfig.figleaf.com/ > > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > > http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:106623 > > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > > To unsubscribe send a blank e-mail to: > > Normal Mode: flashcoders-unsubscribe@(protected) > > Digest Mode: flashcoders-digest-unsubscrive@(protected) > > > > > > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > Supported by Fig Leaf Software > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > Be sure to check the archives and the wiki: > http://chattyfig.figleaf.com/ > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:106625 > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > To unsubscribe send a blank e-mail to: > Normal Mode: flashcoders-unsubscribe@(protected) > Digest Mode: flashcoders-digest-unsubscrive@(protected)
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- Supported by Fig Leaf Software =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- Be sure to check the archives and the wiki: http://chattyfig.figleaf.com/ =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:106626 =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- To unsubscribe send a blank e-mail to: Normal Mode: flashcoders-unsubscribe@(protected) Digest Mode: flashcoders-digest-unsubscrive@(protected)
Earn $52 per hosting referral at Lunarpages.
|
|
 |