RE: [flexcoders] A very simple component in AS :(

2008-06-30 Thread Stephen Gilson
The doc describes the procedure for creating a component in AS. You can
see it here:
http://livedocs.adobe.com/flex/3/html/Part3_as_components_1.html
<http://livedocs.adobe.com/flex/3/html/Part3_as_components_1.html> 
 
Stephen



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Josh McDonald
Sent: Sunday, June 29, 2008 8:11 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] A very simple component in AS :(



A few things:

You'll need to override measure(), like so:

protected override function measure() : void {
  measuredWidth = _txt.measuredWidth;
  measuredHeight = _txt.measuredHeight;
}

and updateDisplayList(), like so:

protected override function updateDisplayList(w:Number, h:Number) : void
{
  _txt.move(0,0);
  _txt.setActualSize(Math.min(_txt.measuredWidth, w),
Math.min(_txt.measuredHeight, h));
}

That should do it. But this is typed in gmail, not Flex so it's probably
got typos in it :)

-Josh


On Mon, Jun 30, 2008 at 9:50 AM, flexawesome <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:



Hey there,

I was trying to create a very simple component in as, there was
no error
in compiling. However, I was unable to see the text. :( can you
take a
quick look? thank you

=== AS 

package
{
 import mx.controls.Text;
 import mx.core.UIComponent;

 public class Footer extends UIComponent
 {
  public var title:String;
  private var _txt:Text;

  public function Footer()
  {
   super.setActualSize(50 , 20 );

   _txt= new Text();
   _txt.text = title;
   addChild( _txt );
  }
 }
}

 in main.mxml ===







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


   (Yahoo! ID required)

   mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> 








-- 
"Therefore, send not to know For whom the bell tolls. It tolls for
thee."

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>  

 


Re: [flexcoders] A very simple component in AS :(

2008-06-29 Thread Josh McDonald
A few things:

You'll need to override measure(), like so:

protected override function measure() : void {
  measuredWidth = _txt.measuredWidth;
  measuredHeight = _txt.measuredHeight;
}

and updateDisplayList(), like so:

protected override function updateDisplayList(w:Number, h:Number) : void {
  _txt.move(0,0);
  _txt.setActualSize(Math.min(_txt.measuredWidth, w),
Math.min(_txt.measuredHeight, h));
}

That should do it. But this is typed in gmail, not Flex so it's probably got
typos in it :)

-Josh

On Mon, Jun 30, 2008 at 9:50 AM, flexawesome <[EMAIL PROTECTED]> wrote:

>
> Hey there,
>
> I was trying to create a very simple component in as, there was no error
> in compiling. However, I was unable to see the text. :( can you take a
> quick look? thank you
>
> === AS 
>
> package
> {
>  import mx.controls.Text;
>  import mx.core.UIComponent;
>
>  public class Footer extends UIComponent
>  {
>   public var title:String;
>   private var _txt:Text;
>
>   public function Footer()
>   {
>super.setActualSize(50 , 20 );
>
>_txt= new Text();
>_txt.text = title;
>addChild( _txt );
>   }
>  }
> }
>
>  in main.mxml ===
>
> 
>
>
>
> 
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
> Links
>
>
>
>


-- 
"Therefore, send not to know For whom the bell tolls. It tolls for thee."

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]