[flexcoders] properties in components..

2007-02-08 Thread Paul Andrews
OK, this is driving me nuts. I'm using Flex Builder 2.01 on a PC.

I have a very simple component (say test.mxml), code below, where I set a 
label value on a button using actionscript.

I can get this to compile very simply and we're all happy.

As soon as I edit the main application(main.mxml) to include this component:

comp:test
/comp:test

main.mxml is happy but now I get a compile error (access of undefined 
property) in test.mxml saying that the button id is an undefined property.
When I edit the test.mxml code, flexbuilder will happily give me code hints 
about the properties after I've put in the button id.

What's going on? Maybe I just need more coffee?

Paul

?xml version=1.0 encoding=utf-8?
mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml; width=400 
height=300
mx:Script
 ![CDATA[
  x.label=jim;
 ]]
/mx:Script
 mx:Button id=x label=fred/
/mx:Canvas








Re: [flexcoders] properties in components..

2007-02-08 Thread Rich Tretola

The 1st problem is that you can not name your button id x as it is a
reserved word.


Not sure what you are trying to accomplish. If your goal is to be able to
set the label from the main application, you should do something like this:


?xml version=1.0 encoding=utf-8?
mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml; width=400
height=300
mx:Script
![CDATA[
   [Bindable]
   public var myLabel:String=jim;
]]
/mx:Script
mx:Button id=x1 label={myLabel}/
/mx:Canvas



?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute
xmlns:local=*
   local:Test myLabel=Rich/
/mx:Application

Rich



On 2/8/07, Paul Andrews [EMAIL PROTECTED] wrote:


  OK, this is driving me nuts. I'm using Flex Builder 2.01 on a PC.

I have a very simple component (say test.mxml), code below, where I set a
label value on a button using actionscript.

I can get this to compile very simply and we're all happy.

As soon as I edit the main application(main.mxml) to include this
component:

comp:test
/comp:test

main.mxml is happy but now I get a compile error (access of undefined
property) in test.mxml saying that the button id is an undefined property.
When I edit the test.mxml code, flexbuilder will happily give me code
hints
about the properties after I've put in the button id.

What's going on? Maybe I just need more coffee?

Paul

?xml version=1.0 encoding=utf-8?
mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml; width=400
height=300
mx:Script
![CDATA[
x.label=jim;
]]
/mx:Script
mx:Button id=x label=fred/
/mx:Canvas

 





--
Rich Tretola
mx:EverythingFlex/
http://www.EverythingFlex.com


Re: [flexcoders] properties in components..

2007-02-08 Thread Paul Andrews
Hi Rich,

This is just a test case of mine. I want to set the label of the button using 
script, inside the component. Forget trying to set it in the main application.
There are no compile errors in the component code (make the id of the button 
whatever you wish), until  the component is included in the main application. 
At that time any reference to the button is not recognised as a valid property 
by the compiler, though the code hinting obliges nicely!

Paul
  - Original Message - 
  From: Rich Tretola 
  To: flexcoders@yahoogroups.com 
  Sent: Thursday, February 08, 2007 9:53 AM
  Subject: Re: [flexcoders] properties in components..


  The 1st problem is that you can not name your button id x as it is a reserved 
word.


  Not sure what you are trying to accomplish. If your goal is to be able to set 
the label from the main application, you should do something like this: 


  ?xml version=1.0 encoding=utf-8?
  mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml; width=400
  height=300 
  mx:Script
  ![CDATA[
  [Bindable]
  public var myLabel:String=jim;
  ]]
  /mx:Script
  mx:Button id=x1 label={myLabel}/
  /mx:Canvas 



  ?xml version=1.0 encoding=utf-8?
  mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute 
xmlns:local=* 
  local:Test myLabel=Rich/
  /mx:Application

  Rich




  On 2/8/07, Paul Andrews  [EMAIL PROTECTED] wrote:
OK, this is driving me nuts. I'm using Flex Builder 2.01 on a PC.

I have a very simple component (say test.mxml), code below, where I set a 
label value on a button using actionscript.

I can get this to compile very simply and we're all happy.

As soon as I edit the main application(main.mxml) to include this component:

comp:test
/comp:test

main.mxml is happy but now I get a compile error (access of undefined 
property) in test.mxml saying that the button id is an undefined property.
When I edit the test.mxml code, flexbuilder will happily give me code hints 
about the properties after I've put in the button id.

What's going on? Maybe I just need more coffee?

Paul

?xml version=1.0 encoding=utf-8?
mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml; width=400 
height=300
mx:Script
![CDATA[
x.label=jim;
]]
/mx:Script
mx:Button id=x label=fred/
/mx:Canvas






  -- 
  Rich Tretola
  mx:EverythingFlex/
  http://www.EverythingFlex.com  

Re: [flexcoders] properties in components..

2007-02-08 Thread Igor Costa

In Addition of Rich Tretola solution

here's anothe one.


yours:Component creationComplete=setLabel id=labelfill/

script
public function setLabel():void
{
 labelfill.label = my Label;
}
/script


Best

On 2/8/07, Rich Tretola [EMAIL PROTECTED] wrote:


  The 1st problem is that you can not name your button id x as it is a
reserved word.


Not sure what you are trying to accomplish. If your goal is to be able to
set the label from the main application, you should do something like this:


?xml version=1.0 encoding=utf-8?
mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml; width=400
height=300
mx:Script
![CDATA[
[Bindable]
public var myLabel:String=jim;
]]
/mx:Script
mx:Button id=x1 label={myLabel}/
/mx:Canvas



?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
layout=absolute xmlns:local=*
local:Test myLabel=Rich/
/mx:Application

Rich



On 2/8/07, Paul Andrews  [EMAIL PROTECTED] wrote:

   OK, this is driving me nuts. I'm using Flex Builder 2.01 on a PC.

 I have a very simple component (say test.mxml), code below, where I set
 a
 label value on a button using actionscript.

 I can get this to compile very simply and we're all happy.

 As soon as I edit the main application(main.mxml) to include this
 component:

 comp:test
 /comp:test

 main.mxml is happy but now I get a compile error (access of undefined
 property) in test.mxml saying that the button id is an undefined
 property.
 When I edit the test.mxml code, flexbuilder will happily give me code
 hints
 about the properties after I've put in the button id.

 What's going on? Maybe I just need more coffee?

 Paul

 ?xml version=1.0 encoding=utf-8?
 mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml; width=400
 height=300
 mx:Script
 ![CDATA[
 x.label=jim;
 ]]
 /mx:Script
 mx:Button id=x label=fred/
 /mx:Canvas




--
Rich Tretola
mx:EverythingFlex/
http://www.EverythingFlex.com
 





--

Igor Costa
www.igorcosta.org
www.igorcosta.com
skype: igorpcosta


Re: [flexcoders] properties in components..

2007-02-08 Thread Amol Pandhare
Hey Paul,

Cool down men. See whenever we write a script in an mxml file you need write 
that script in a function.
For example:

Your code was:

mx:Script

 ![CDATA[

  x.label=jim ;

 ]]

/mx:Script

Put the same thing this way:

mx:Script

 ![CDATA[
function init() {
x.label=jim ;
}

 ]]

/mx:Script


and call this function when you load the the mxml on the creationcomplete event 
like this:.



this will solve your purpose.

Amol.


- Original Message 
From: Paul Andrews [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Thursday, February 8, 2007 3:10:27 PM
Subject: [flexcoders] properties in components..









  



OK, this is driving me nuts. I'm using Flex Builder 2.01 on a PC.



I have a very simple component (say test.mxml), code below, where I set a 

label value on a button using actionscript.



I can get this to compile very simply and we're all happy.



As soon as I edit the main application( main.mxml) to include this component:



comp:test

/comp:test



main.mxml is happy but now I get a compile error (access of undefined 

property) in test.mxml saying that the button id is an undefined property.

When I edit the test.mxml code, flexbuilder will happily give me code hints 

about the properties after I've put in the button id.



What's going on? Maybe I just need more coffee?



Paul



?xml version=1.0 encoding=utf- 8?

mx:Canvas xmlns:mx=http://www.adobe. com/2006/ mxml width=400 

height=300 

mx:Script

 ![CDATA[

  x.label=jim ;

 ]]

/mx:Script

 mx:Button id=x label=fred /

/mx:Canvas






  







!--

#ygrp-mlmsg {font-size:13px;font-family:arial,helvetica,clean,sans-serif;}
#ygrp-mlmsg table {font-size:inherit;font:100%;}
#ygrp-mlmsg select, input, textarea {font:99% arial,helvetica,clean,sans-serif;}
#ygrp-mlmsg pre, code {font:115% monospace;}
#ygrp-mlmsg * {line-height:1.22em;}
#ygrp-text{
font-family:Georgia;
}
#ygrp-text p{
margin:0 0 1em 0;
}
#ygrp-tpmsgs{
font-family:Arial;
clear:both;
}
#ygrp-vitnav{
padding-top:10px;
font-family:Verdana;
font-size:77%;
margin:0;
}
#ygrp-vitnav a{
padding:0 1px;
}
#ygrp-actbar{
clear:both;
margin:25px 0;
white-space:nowrap;
color:#666;
text-align:right;
}
#ygrp-actbar .left{
float:left;
white-space:nowrap;
}
.bld{font-weight:bold;}
#ygrp-grft{
font-family:Verdana;
font-size:77%;
padding:15px 0;
}
#ygrp-ft{
font-family:verdana;
font-size:77%;
border-top:1px solid #666;
padding:5px 0;
}
#ygrp-mlmsg #logo{
padding-bottom:10px;
}

#ygrp-vital{
background-color:#e0ecee;
margin-bottom:20px;
padding:2px 0 8px 8px;
}
#ygrp-vital #vithd{
font-size:77%;
font-family:Verdana;
font-weight:bold;
color:#333;
text-transform:uppercase;
}
#ygrp-vital ul{
padding:0;
margin:2px 0;
}
#ygrp-vital ul li{
list-style-type:none;
clear:both;
border:1px solid #e0ecee;
}
#ygrp-vital ul li .ct{
font-weight:bold;
color:#ff7900;
float:right;
width:2em;
text-align:right;
padding-right:.5em;
}
#ygrp-vital ul li .cat{
font-weight:bold;
}
#ygrp-vital a {
text-decoration:none;
}

#ygrp-vital a:hover{
text-decoration:underline;
}

#ygrp-sponsor #hd{
color:#999;
font-size:77%;
}
#ygrp-sponsor #ov{
padding:6px 13px;
background-color:#e0ecee;
margin-bottom:20px;
}
#ygrp-sponsor #ov ul{
padding:0 0 0 8px;
margin:0;
}
#ygrp-sponsor #ov li{
list-style-type:square;
padding:6px 0;
font-size:77%;
}
#ygrp-sponsor #ov li a{
text-decoration:none;
font-size:130%;
}
#ygrp-sponsor #nc {
background-color:#eee;
margin-bottom:20px;
padding:0 8px;
}
#ygrp-sponsor .ad{
padding:8px 0;
}
#ygrp-sponsor .ad #hd1{
font-family:Arial;
font-weight:bold;
color:#628c2a;
font-size:100%;
line-height:122%;
}
#ygrp-sponsor .ad a{
text-decoration:none;
}
#ygrp-sponsor .ad a:hover{
text-decoration:underline;
}
#ygrp-sponsor .ad p{
margin:0;
}
o {font-size:0;}
.MsoNormal {
margin:0 0 0 0;
}
#ygrp-text tt{
font-size:120%;
}
blockquote{margin:0 0 0 4px;}
.replbq {margin:4;}
--








 

8:00? 8:25? 8:40? Find a flick in no time 
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news

Re: [flexcoders] properties in components..

2007-02-08 Thread Rich Tretola

Sorry, I guess I should have read all of the followups before posting the
last code snippet. :)

On 2/8/07, Rich Tretola [EMAIL PROTECTED] wrote:


Well you can do that if you do it within a function like this:


?xml version=1.0 encoding=utf-8?
mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml  width=400
height=300 creationComplete=setLabel()
mx:Script
![CDATA[
private function setLabel():void{
x1.label=jim;
}
]]
/mx:Script
mx:Button id=x1 label=fred/
/mx:Canvas

Rich

On 2/8/07, Paul Andrews [EMAIL PROTECTED] wrote:

Hi Rich,

 This is just a test case of mine. I want to set the label of the button
 using script, inside the component. Forget trying to set it in the main
 application.
 There are no compile errors in the component code (make the id of the
 button whatever you wish), until  the component is included in the main
 application. At that time any reference to the button is not recognised as a
 valid property by the compiler, though the code hinting obliges nicely!

 Paul

 - Original Message -
  *From:* Rich Tretola [EMAIL PROTECTED]
 *To:* flexcoders@yahoogroups.com
 *Sent:* Thursday, February 08, 2007 9:53 AM
 *Subject:* Re: [flexcoders] properties in components..

 The 1st problem is that you can not name your button id x as it is a
 reserved word.


 Not sure what you are trying to accomplish. If your goal is to be able
 to set the label from the main application, you should do something like
 this:


 ?xml version=1.0 encoding=utf-8?
 mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml; width=400
 height=300
 mx:Script
 ![CDATA[
 [Bindable]
 public var myLabel:String=jim;
 ]]
 /mx:Script
 mx:Button id=x1 label={myLabel}/
 /mx:Canvas



 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml 
 layout=absolute xmlns:local=*
 local:Test myLabel=Rich/
 /mx:Application

 Rich



 On 2/8/07, Paul Andrews  [EMAIL PROTECTED] wrote:
 
OK, this is driving me nuts. I'm using Flex Builder 2.01 on a PC.
 
  I have a very simple component (say test.mxml), code below, where I
  set a
  label value on a button using actionscript.
 
  I can get this to compile very simply and we're all happy.
 
  As soon as I edit the main application(main.mxml) to include this
  component:
 
  comp:test
  /comp:test
 
  main.mxml is happy but now I get a compile error (access of undefined
  property) in test.mxml saying that the button id is an undefined
  property.
  When I edit the test.mxml code, flexbuilder will happily give me code
  hints
  about the properties after I've put in the button id.
 
  What's going on? Maybe I just need more coffee?
 
  Paul
 
  ?xml version=1.0 encoding=utf-8?
  mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml; width=400
  height=300
  mx:Script
  ![CDATA[
  x.label=jim;
  ]]
  /mx:Script
  mx:Button id=x label=fred/
  /mx:Canvas
 
 


 --
 Rich Tretola
 mx:EverythingFlex/
 http://www.EverythingFlex.com

  





--
Rich Tretola
mx:EverythingFlex/
http://www.EverythingFlex.com





--
Rich Tretola
mx:EverythingFlex/
http://www.EverythingFlex.com


Re: [flexcoders] properties in components..

2007-02-08 Thread Rich Tretola

Well you can do that if you do it within a function like this:


?xml version=1.0 encoding=utf-8?
mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml; width=400
height=300 creationComplete=setLabel()
mx:Script
![CDATA[
   private function setLabel():void{
   x1.label=jim;
   }
]]
/mx:Script
mx:Button id=x1 label=fred/
/mx:Canvas

Rich

On 2/8/07, Paul Andrews [EMAIL PROTECTED] wrote:


   Hi Rich,

This is just a test case of mine. I want to set the label of the button
using script, inside the component. Forget trying to set it in the main
application.
There are no compile errors in the component code (make the id of the
button whatever you wish), until  the component is included in the main
application. At that time any reference to the button is not recognised as a
valid property by the compiler, though the code hinting obliges nicely!

Paul

- Original Message -
*From:* Rich Tretola [EMAIL PROTECTED]
*To:* flexcoders@yahoogroups.com
*Sent:* Thursday, February 08, 2007 9:53 AM
*Subject:* Re: [flexcoders] properties in components..

The 1st problem is that you can not name your button id x as it is a
reserved word.


Not sure what you are trying to accomplish. If your goal is to be able to
set the label from the main application, you should do something like this:


?xml version=1.0 encoding=utf-8?
mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml; width=400
height=300
mx:Script
![CDATA[
[Bindable]
public var myLabel:String=jim;
]]
/mx:Script
mx:Button id=x1 label={myLabel}/
/mx:Canvas



?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
layout=absolute xmlns:local=*
local:Test myLabel=Rich/
/mx:Application

Rich



On 2/8/07, Paul Andrews  [EMAIL PROTECTED] wrote:

   OK, this is driving me nuts. I'm using Flex Builder 2.01 on a PC.

 I have a very simple component (say test.mxml), code below, where I set
 a
 label value on a button using actionscript.

 I can get this to compile very simply and we're all happy.

 As soon as I edit the main application(main.mxml) to include this
 component:

 comp:test
 /comp:test

 main.mxml is happy but now I get a compile error (access of undefined
 property) in test.mxml saying that the button id is an undefined
 property.
 When I edit the test.mxml code, flexbuilder will happily give me code
 hints
 about the properties after I've put in the button id.

 What's going on? Maybe I just need more coffee?

 Paul

 ?xml version=1.0 encoding=utf-8?
 mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml; width=400
 height=300
 mx:Script
 ![CDATA[
 x.label=jim;
 ]]
 /mx:Script
 mx:Button id=x label=fred/
 /mx:Canvas




--
Rich Tretola
mx:EverythingFlex/
http://www.EverythingFlex.com

 





--
Rich Tretola
mx:EverythingFlex/
http://www.EverythingFlex.com