PERFEITO! Ficou assim:
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()"> <mx:Script> <![CDATA[ import mx.controls.Alert; private function init():void { cp14.addEventListener(KeyboardEvent.KEY_UP, tecla, true); } private function tecla(e:KeyboardEvent):void { if(e.shiftKey) { if(e.keyCode == Keyboard.ENTER) { cp14.textArea.text += "\n"; focusManager.setFocus(cp14.textArea); cp14.textArea.setSelection(cp14.text.length,cp14.text.length); } } else if(e.keyCode == Keyboard.ENTER) { msgs.text += cp14.text cp14.text = "" } } ]]> </mx:Script> <mx:RichTextEditor title="Title" id="cp14" y="183"> </mx:RichTextEditor> <mx:TextArea x="0" y="0" width="325" height="175" id="msgs"/> </mx:Application> GRATO On 9 mar, 09:59, Erko Bridee de Almeida Cabrera <erko.bri...@gmail.com> wrote: > para definir o cursor na última posição de um TextField eu utilizei: > > focusManager.setFocus(target); > target.setSelection(target.text.length,target.text.length); > > faz um teste com teu objeto ali para ver se esse código funciona o/ > > Em 9 de março de 2010 09:04, Vinicius <vinu...@gmail.com> escreveu: > > > > > > > Pessoal, > > > Estou montando um chat e gostaria de fazer as funções q normalmente > > tem em IMs, como: > > > Enter: envia mensagem > > > Shift+Enter: quebra de linha > > > Até agora fiz o seguinte: > > > <?xml version="1.0" encoding="utf-8"?> > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > > layout="absolute" creationComplete="init()"> > > <mx:Script> > > <![CDATA[ > > import mx.controls.Alert; > > > private function init():void > > { > > cp14.addEventListener(KeyboardEvent.KEY_UP, tecla, > > true); > > } > > private function tecla(e:KeyboardEvent):void > > { > > if(e.shiftKey) > > { > > if(e.keyCode == Keyboard.ENTER) > > { > > cp14.text += "\n"; > > } > > } else if(e.keyCode == Keyboard.ENTER) > > { > > msgs.text += cp14.text > > cp14.text = "" > > > } > > } > > ]]> > > </mx:Script> > > > <mx:RichTextEditor title="Title" id="cp14" y="183"> > > </mx:RichTextEditor> > > <mx:TextArea x="0" y="0" width="325" height="175" id="msgs"/> > > </mx:Application> > > > Quando a mensagem chega no textarea o \n foi colocado, mas em tempo de > > edição da mensagem antes de enviar no RichTextEditor não. > > > Alguém pode me ajudar? > > > -- > > Você recebeu esta mensagem porque está inscrito na lista "flexdev" > > Para enviar uma mensagem, envie um e-mail para flexdev@googlegroups.com > > Para sair da lista, envie um email em branco para > > flexdev-unsubscr...@googlegroups.com > > Mais opções estão disponíveis emhttp://groups.google.com/group/flexdev > > -- > Att, > Erko Bridee de Almeida > Cabrerahttp://erkobridee.com/http://gospel.erkobridee.com/http://www.cwbfx.com/http://twitter.com/ErkoBridee > Currículo:http://netcarreiras.com/prof.html?uid=11410 > ICQ: 578334347 -- Você recebeu esta mensagem porque está inscrito na lista "flexdev" Para enviar uma mensagem, envie um e-mail para flexdev@googlegroups.com Para sair da lista, envie um email em branco para flexdev-unsubscr...@googlegroups.com Mais opções estão disponíveis em http://groups.google.com/group/flexdev