[flexcoders] Update a label

2005-04-13 Thread Fernando Barros

Hi there!

I would like to know, a better way to update a label after I changed TextInput 
property. What I did:

mx:TextInput id=txtNome keyDown=fAtualizaVar(event.ascii) maxChars=150 
width=200 /
And in my AS I have:
function fAtualizaVar(sNovoChar):Void
{
var sBotaoMsg:String;
if (isNaN(PropostaSelecionada.NCLIENTEID) == false)
sBotaoMsg = 'Update ' + txtNome.text + chr(sNovoChar);
else
sBotaoMsg = 'Insert ' + txtNome.text + chr(sNovoChar);

btnGravar.label = sBotaoMsg;
}

I would like to know if I had a way to set the property to a variable, and 
after that, automatically set the new value to the label of that button!

sLabelBut = 'Update ' + myUser;

Did I make myself clear?

Tank's in advance. As you can see I'm new on that!
 
---
Fernando Barros
Internet Officer
11 5014-7093
www.officer.com.br
---




 
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/
 





Re: [flexcoders] Update a label

2005-04-13 Thread Manish Jethani

On 4/13/05, Fernando Barros [EMAIL PROTECTED] wrote:

 mx:TextInput id=txtNome keyDown=fAtualizaVar(event.ascii) maxChars=150 
 width=200 /
 And in my AS I have:
 function fAtualizaVar(sNovoChar):Void
 {
 var sBotaoMsg:String;
 if (isNaN(PropostaSelecionada.NCLIENTEID) == false)
 sBotaoMsg = 'Update ' + txtNome.text + chr(sNovoChar);
 else
 sBotaoMsg = 'Insert ' + txtNome.text + chr(sNovoChar);
 

Where is btnGravar defined?  You could just use binding instead of doing this.

 mx:Button id=btnGravar
label={(isNaN(PropostaSelecionada.NCLIENTEID) ? 'Insert ' : 'Update
') + txtNome.text} /

-- 
[EMAIL PROTECTED]
http://manish.revise.org/


 
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/
 





RE: [flexcoders] Update a label

2005-04-13 Thread Abdul Qabiz

Hi,

You can use the binding. You can bind a  variable to Button's label
property, so when variable changes button's label would be updated
implicitly..

An example,


##BindingExample.mxml##

mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml;

mx:Script
var sBotaoMsg:String = initial label;

function fAtualizaVar(sNovoChar):Void
{

if (isNaN(PropostaSelecionada.NCLIENTEID) == false)
sBotaoMsg = 'Update ' + txtNome.text +
chr(sNovoChar);
else
sBotaoMsg = 'Insert ' + txtNome.text +
chr(sNovoChar);

btnGravar.label = sBotaoMsg;
}
/mx:Script

mx:TextInput id=txtNome keyDown=fAtualizaVar(event.ascii)
maxChars=150 width=200 /
mx:Button id=btnGravar label={sBotaoMsg}/

/mx:Application 


I just used your code, note those curly-braces, that's how you bind a
property to some variable. Yeah before running this code make sure all
variables are defined. Like PropostaSelecionada is not known above code...

-abdul



-Original Message-
From: Fernando Barros [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 13, 2005 6:40 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Update a label


Hi there!

I would like to know, a better way to update a label after I changed
TextInput property. What I did:

mx:TextInput id=txtNome keyDown=fAtualizaVar(event.ascii)
maxChars=150 width=200 /
And in my AS I have:
function fAtualizaVar(sNovoChar):Void
{
var sBotaoMsg:String;
if (isNaN(PropostaSelecionada.NCLIENTEID) == false)
sBotaoMsg = 'Update ' + txtNome.text + chr(sNovoChar);
else
sBotaoMsg = 'Insert ' + txtNome.text + chr(sNovoChar);

btnGravar.label = sBotaoMsg;
}

I would like to know if I had a way to set the property to a variable, and
after that, automatically set the new value to the label of that button!

sLabelBut = 'Update ' + myUser;

Did I make myself clear?

Tank's in advance. As you can see I'm new on that!
 
---
Fernando Barros
Internet Officer
11 5014-7093
www.officer.com.br
---




 
Yahoo! Groups Links



 





 
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/
 





RES: [flexcoders] Update a label

2005-04-13 Thread Fernando Barros

Ok Thks! Now I see. Sometimes I forget these things because I am used to codify 
in CFMX. Living and Learning!!

Thks again!

---
Fernando Barros
Internet Officer
11 5014-7093
www.officer.com.br
---

De: Manish Jethani [mailto:[EMAIL PROTECTED] 
Enviada em: quarta-feira, 13 de abril de 2005 10:23
Para: flexcoders@yahoogroups.com
Assunto: Re: [flexcoders] Update a label

On 4/13/05, Fernando Barros [EMAIL PROTECTED] wrote:

 mx:TextInput id=txtNome keyDown=fAtualizaVar(event.ascii) maxChars=150 
 width=200 /
 And in my AS I have:
 function fAtualizaVar(sNovoChar):Void
 {
 var sBotaoMsg:String;
 if (isNaN(PropostaSelecionada.NCLIENTEID) == false)
 sBotaoMsg = 'Update ' + txtNome.text + chr(sNovoChar);
 else
 sBotaoMsg = 'Insert ' + txtNome.text + chr(sNovoChar);
 

Where is btnGravar defined?  You could just use binding instead of doing this.

mx:Button id=btnGravar
label={(isNaN(PropostaSelecionada.NCLIENTEID) ? 'Insert ' : 'Update
') + txtNome.text} /

-- 
[EMAIL PROTECTED]
http://manish.revise.org/ 



 
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/