[flexcoders] Re: Flex2 Tree Bug crashes browser

2006-02-27 Thread sufibaba
Hi Matt,

The node has not been added anywhere else.  I've modified the Tree
example from the Flex Sample Explorer to duplicate the problem I am
having in my App and it is exhibiting the same behavior.

- tree.mxml 

?xml version=1.0 encoding=utf-8?

mx:Application xmlns:mx=http://www.macromedia.com/2005/mxml;
creationComplete=srv.send()

mx:Script
![CDATA[

[Bindable]
public var selectedNode:Object;

[Bindable]
public var XLC:XML;

public function initList(event:Event)
{
XLC = event.target.result;
}

public function treeChanged(event:Event) {
selectedNode=Tree(event.target).selectedNode;
}

public function  addNewNode() // 
{
//var myXML:XML = model.templateLayout.treeData;


var newItem:XML = node label=new node/

var newNodeAdded:XML = selectedNode.appendChild(newItem);
//Alert.show (Tree changeEvt :  + newNodeAdded.toXMLString());
selectedNode = newNodeAdded;

myTree.selectedNode = selectedNode;
}



 ]]
/mx:Script

mx:HTTPService id=srv url=../assets/tree.xml resultFormat=e4x
result=initList(event)/

mx:Button label=addnewnode id=newadd click=addNewNode() /

mx:HDividedBox width=100% height=100%
mx:Tree id=myTree width=50% height=100% labelField=@label
rootVisible=false dataProvider={XLC}
change=treeChanged(event)/
mx:TextArea height=100% width=50%
text=Selected Item: [EMAIL PROTECTED]/
/mx:HDividedBox

/mx:Application


 assets/tree.xml 

?xml version=1.0 encoding=utf-8?
node

node label=Mail Box
node label=Inbox
node label=Marketing/
node label=Product Management/
node label=Personal/
/node
node label=Outbox
node label=Professional/
node label=Personal/
/node
node label=Spam/
node label=Sent/
/node

/node

-

I tried both IE and Firefox on winXP and this bug crashes both
browsers when a new node is appended to a leaf node.

Is there a possible work around for this bug do you think?

Cheers,

Tim





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 




[flexcoders] Re: Flex2 Tree Bug crashes browser

2006-02-27 Thread Michael Montagna
There's certainly a bug in here, but you can try replacing the
appendChild call:

  var newNodeAdded:XML = selectedNode.appendChild(newItem);

with:

 selectedNode.insertChildBefore(null, newItem);

Also, I changed selectedNode to type XML from Object.

This works for me, the Tree see's the update and converts the leaf to a
closed branch with the new node.

Let me know if you'll still have problems.

-Michael



--- In flexcoders@yahoogroups.com, sufibaba [EMAIL PROTECTED] wrote:

 Hi Matt,

 The node has not been added anywhere else.  I've modified the Tree
 example from the Flex Sample Explorer to duplicate the problem I am
 having in my App and it is exhibiting the same behavior.

 - tree.mxml 

 ?xml version=1.0 encoding=utf-8?

 mx:Application xmlns:mx=http://www.macromedia.com/2005/mxml;
 creationComplete=srv.send()

 mx:Script
 ![CDATA[

  [Bindable]
  public var selectedNode:Object;

 [Bindable]
  public var XLC:XML;

  public function initList(event:Event)
  {
  XLC = event.target.result;
  }

  public function treeChanged(event:Event) {
  selectedNode=Tree(event.target).selectedNode;
  }

 public function  addNewNode() //
 {
  //var myXML:XML = model.templateLayout.treeData;


   var newItem:XML = node label=new node/

   var newNodeAdded:XML = selectedNode.appendChild(newItem);
   //Alert.show (Tree changeEvt :  + newNodeAdded.toXMLString());
   selectedNode = newNodeAdded;

   myTree.selectedNode = selectedNode;
 }



  ]]
 /mx:Script

 mx:HTTPService id=srv url=../assets/tree.xml resultFormat=e4x
 result=initList(event)/

 mx:Button label=addnewnode id=newadd click=addNewNode() /

 mx:HDividedBox width=100% height=100%
 mx:Tree id=myTree width=50% height=100% labelField=@label
 rootVisible=false dataProvider={XLC}
 change=treeChanged(event)/
 mx:TextArea height=100% width=50%
 text=Selected Item: [EMAIL PROTECTED]/
 /mx:HDividedBox

 /mx:Application


  assets/tree.xml 

 ?xml version=1.0 encoding=utf-8?
 node

 node label=Mail Box
 node label=Inbox
 node label=Marketing/
 node label=Product Management/
 node label=Personal/
 /node
 node label=Outbox
 node label=Professional/
 node label=Personal/
 /node
 node label=Spam/
 node label=Sent/
  /node

 /node

 -

 I tried both IE and Firefox on winXP and this bug crashes both
 browsers when a new node is appended to a leaf node.

 Is there a possible work around for this bug do you think?

 Cheers,

 Tim








--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 




[flexcoders] Re: Flex2 Tree Bug crashes browser

2006-02-27 Thread sufibaba
Michael,

Your Antibug spray did the trick.

Thanks for the tip.

Tim


--- In flexcoders@yahoogroups.com, Michael Montagna [EMAIL PROTECTED]
wrote:

 There's certainly a bug in here, but you can try replacing the
 appendChild call:

   var newNodeAdded:XML = selectedNode.appendChild(newItem);

 with:

  selectedNode.insertChildBefore(null, newItem);

 Also, I changed selectedNode to type XML from Object.

 This works for me, the Tree see's the update and converts the leaf to
a
 closed branch with the new node.

 Let me know if you'll still have problems.

 -Michael



 --- In flexcoders@yahoogroups.com, sufibaba sufibaba@ wrote:
 
  Hi Matt,
 
  The node has not been added anywhere else.  I've modified the Tree
  example from the Flex Sample Explorer to duplicate the problem I am
  having in my App and it is exhibiting the same behavior.
 
  - tree.mxml 
 
  ?xml version=1.0 encoding=utf-8?
 
  mx:Application xmlns:mx=http://www.macromedia.com/2005/mxml;
  creationComplete=srv.send()
 
  mx:Script
  ![CDATA[
 
   [Bindable]
   public var selectedNode:Object;
 
  [Bindable]
   public var XLC:XML;
 
   public function initList(event:Event)
   {
   XLC = event.target.result;
   }
 
   public function treeChanged(event:Event) {
   selectedNode=Tree(event.target).selectedNode;
   }
 
  public function  addNewNode() //
  {
   //var myXML:XML = model.templateLayout.treeData;
 
 
var newItem:XML = node label=new node/
 
var newNodeAdded:XML = selectedNode.appendChild(newItem);
//Alert.show (Tree changeEvt :  + newNodeAdded.toXMLString());
selectedNode = newNodeAdded;
 
myTree.selectedNode = selectedNode;
  }
 
 
 
   ]]
  /mx:Script
 
  mx:HTTPService id=srv url=../assets/tree.xml resultFormat=e4x
  result=initList(event)/
 
  mx:Button label=addnewnode id=newadd click=addNewNode() /
 
  mx:HDividedBox width=100% height=100%
  mx:Tree id=myTree width=50% height=100%
labelField=@label
  rootVisible=false dataProvider={XLC}
  change=treeChanged(event)/
  mx:TextArea height=100% width=50%
  text=Selected Item: [EMAIL PROTECTED]/
  /mx:HDividedBox
 
  /mx:Application
 
 
   assets/tree.xml 
 
  ?xml version=1.0 encoding=utf-8?
  node
 
  node label=Mail Box
  node label=Inbox
  node label=Marketing/
  node label=Product Management/
  node label=Personal/
  /node
  node label=Outbox
  node label=Professional/
  node label=Personal/
  /node
  node label=Spam/
  node label=Sent/
   /node
 
  /node
 
  -
 
  I tried both IE and Firefox on winXP and this bug crashes both
  browsers when a new node is appended to a leaf node.
 
  Is there a possible work around for this bug do you think?
 
  Cheers,
 
  Tim
 








--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 




[flexcoders] Re: Flex2 Tree

2006-02-09 Thread Michael Montagna
What you're doing is correct, so this is probably a bug.  If we find a
workaround I'll post it. 

Thanks,

-Michael


--- In flexcoders@yahoogroups.com, Teoti Graphix [EMAIL PROTECTED]
wrote:

 Hello,
 
 I am writting this more as a comment then question.
 
 I have spent 2 days experimenting with the mx.collections classes
and it has
 been fun. Now, I have a project where I need the tree's root to be;
 
 ClassPaths
-  c:/classes
  -  dir structure
-  c:/mm/classes ...
  -  dir structure..
 
 I am loading all the xml tree structure form php fine. What is the
method
 for creating the root now ClassPaths ONCE, then on each new
'loadCLassPath()
 call, add the new xml to the CLassPaths root node.
 
 I have almost got it but, the tree gives me node opne errors after I
get 2
 nodes inserted.
 
 Am I doing something wrong?
 
 
 protected function loadDir(evt:ResultEvent):void
 {
 
 var newList:XMLList = new XMLList(evt.result);
 
 if (dataProvider == null) {
 
 dataProvider = classpaths label=Class
 Paths/classpaths;
 }
 
 dataProvider.source[0].appendChild(newList);
   }
 
 Peace, Mike
 
 PS the error when click to open the root node is...
 
 TypeError: Error #1010: undefined has no properties.
 at mx.controls::Tree/setIsOpen()
 at mx.controls.treeclasses::TreeCellRenderer/disclosurePress()
 






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/