Re: [Flashcoders] Reading properties of a textbox [AS3]

2008-04-15 Thread Stuart (FunkDaWeb)
Hi Cory ive finally got round to adding your code 'embedFonts = true ' but i 
still have the same problem! 

when i use the function it removes the text! then when i click again it 
displays the text again no bold/italic!
  - Original Message - 
  From: Cory Petosky 
  To: Flash Coders List 
  Sent: Thursday, April 03, 2008 8:43 PM
  Subject: Re: [Flashcoders] Reading properties of a textbox [AS3]


  Replace that with:

  formatter.italic = !currentFormat.italic;

  The conditionals aren't necessary in that situation. :)

  On Thu, Apr 3, 2008 at 1:21 PM, Stuart (FunkDaWeb) [EMAIL PROTECTED] wrote:
   YAY! It works! Thank you! :o)
  
Wont work with embedFonts = true thought! :o(
  
Onwards and upwards!
  
Thanks for your help!
  
SM
  
  
 - Original Message -
 From: jonathan howe
 To: Flash Coders List
 Sent: Thursday, April 03, 2008 6:53 PM
 Subject: Re: [Flashcoders] Reading properties of a textbox [AS3]
  
  
 Okay, but in the simple example, you are using it for both:
  
 Okay, but formatter should not be treated as a property of _selectedBox.
 _selectedBox has no property named formatter.
  
 This is the offending line:
  
 if (_selectedBox.formatter.italic == false)
  
 You already have set formatter to the value of 
_selectedBox.getTextFormat();
 Thus your conditional should read:
  
 if (formatter.italic == false)
  
 To simplify it to keeping formatter separate from the current format, 
let's
 rewrite:
  
 var currentFormat:TextFormat = _selectedBox.getTextFormat();
 var formatter:TextFormat = new TextFormat();
  
   if (currentFormat.italic == false)
   {
formatter.italic = true;
   }
   else
   {
formatter.italic = false;
   }
  
  _selectedBox.setTextFormat(formatter);
  
  
 -jonathan
  
  
 On Thu, Apr 3, 2008 at 1:19 PM, Stuart (FunkDaWeb) [EMAIL PROTECTED]
 wrote:
  
  formatter is a blank variable and has nothing to do with reading the 
text
  propperties its used for setting them! I need to figure out how to tell 
if a
  text field is set to italic or not! once i can do this i can fix the if
  statement!
 
  do you have any idea how to do this?
 
 
 
  

 
 
  FUI - New code is this
 
  var formatter:TextFormat = _selectedBox.getTextFormat();
 
 if (_selectedBox.formatter.italic == false)
 {
 formatter.italic = true;
}
else
{
 formatter.italic = false;
}
 
   _selectedBox.setTextFormat(formatter);
- Original Message -
   From: jonathan howe
   To: Flash Coders List
Sent: Thursday, April 03, 2008 5:53 PM
   Subject: Re: [Flashcoders] Reading properties of a textbox [AS3]
 
 
   Hi, Stuart,
 
   Based on the error message sounds like maybe you are trying to access
   _selectedBox.formatter or something else invalid. Can you repaste your
  new
   code after the change?
 
   -jonathan
 
 
   On Thu, Apr 3, 2008 at 11:15 AM, Stuart (FunkDaWeb) [EMAIL PROTECTED]
  
   wrote:
 
thanks Jonathan for some reason i get this error when i change to 
your
code...
   
ReferenceError: Error #1069: Property formatter not found on
flash.text.TextField and there is no default value.
  - Original Message -
 From: jonathan howe
 To: Flash Coders List
 Sent: Thursday, April 03, 2008 4:04 PM
 Subject: Re: [Flashcoders] Reading properties of a textbox [AS3]
   
   
 var formatter:TextFormat = _selectedBox.getTextFormat();
   
 On Thu, Apr 3, 2008 at 10:43 AM, Stuart (FunkDaWeb) 
  [EMAIL PROTECTED]

 wrote:
   
  Hi all im tring to write a button that changes the format of a
  textbox
  from normal to italic and back again. I have written the below 
code
  but
i
  cannot seam to get it to work!
 
  var formatter:TextFormat = new TextFormat();
 
if (formatter.italic == false)
{
 formatter.italic = true;
}
else
{
 formatter.italic = false;
}
 
_selectedBox.setTextFormat(formatter);
 
  So my question is how do i read the properties of a textbox in 
order
  to
  create an if statment to change the properties?
 
  SM
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
   
   
   
 --
 -jonathan howe

Re: [Flashcoders] Reading properties of a textbox [AS3]

2008-04-15 Thread Leandro Ferreira
Window - Other Panels - Strings

On 4/15/08, Stuart (FunkDaWeb) [EMAIL PROTECTED] wrote:

 Hi Cory ive finally got round to adding your code 'embedFonts = true ' but
 i still have the same problem!

 when i use the function it removes the text! then when i click again it
 displays the text again no bold/italic!

   - Original Message -
   From: Cory Petosky

   To: Flash Coders List
   Sent: Thursday, April 03, 2008 8:43 PM
   Subject: Re: [Flashcoders] Reading properties of a textbox [AS3]


   Replace that with:

   formatter.italic = !currentFormat.italic;

   The conditionals aren't necessary in that situation. :)

   On Thu, Apr 3, 2008 at 1:21 PM, Stuart (FunkDaWeb) [EMAIL PROTECTED]
 wrote:
YAY! It works! Thank you! :o)
   
 Wont work with embedFonts = true thought! :o(
   
 Onwards and upwards!
   
 Thanks for your help!
   
 SM
   
   
  - Original Message -
  From: jonathan howe
  To: Flash Coders List
  Sent: Thursday, April 03, 2008 6:53 PM
  Subject: Re: [Flashcoders] Reading properties of a textbox [AS3]
   
   
  Okay, but in the simple example, you are using it for both:
   
  Okay, but formatter should not be treated as a property of
 _selectedBox.
  _selectedBox has no property named formatter.
   
  This is the offending line:
   
  if (_selectedBox.formatter.italic == false)
   
  You already have set formatter to the value of
 _selectedBox.getTextFormat();
  Thus your conditional should read:
   
  if (formatter.italic == false)
   
  To simplify it to keeping formatter separate from the current
 format, let's
  rewrite:
   
  var currentFormat:TextFormat = _selectedBox.getTextFormat();
  var formatter:TextFormat = new TextFormat();
   
if (currentFormat.italic == false)
{
 formatter.italic = true;
}
else
{
 formatter.italic = false;
}
   
   _selectedBox.setTextFormat(formatter);
   
   
  -jonathan
   
   
  On Thu, Apr 3, 2008 at 1:19 PM, Stuart (FunkDaWeb) 
 [EMAIL PROTECTED]
  wrote:
   
   formatter is a blank variable and has nothing to do with reading
 the text
   propperties its used for setting them! I need to figure out how to
 tell if a
   text field is set to italic or not! once i can do this i can fix
 the if
   statement!
  
   do you have any idea how to do this?
  
  
  
  
 
  
  
   FUI - New code is this
  
   var formatter:TextFormat = _selectedBox.getTextFormat();
  
  if (_selectedBox.formatter.italic == false)
  {
  formatter.italic = true;
 }
 else
 {
  formatter.italic = false;
 }
  
_selectedBox.setTextFormat(formatter);
 - Original Message -
From: jonathan howe
To: Flash Coders List
 Sent: Thursday, April 03, 2008 5:53 PM
Subject: Re: [Flashcoders] Reading properties of a textbox [AS3]
  
  
Hi, Stuart,
  
Based on the error message sounds like maybe you are trying to
 access
_selectedBox.formatter or something else invalid. Can you repaste
 your
   new
code after the change?
  
-jonathan
  
  
On Thu, Apr 3, 2008 at 11:15 AM, Stuart (FunkDaWeb) 
 [EMAIL PROTECTED]
   
wrote:
  
 thanks Jonathan for some reason i get this error when i change
 to your
 code...

 ReferenceError: Error #1069: Property formatter not found on
 flash.text.TextField and there is no default value.
   - Original Message -
  From: jonathan howe
  To: Flash Coders List
  Sent: Thursday, April 03, 2008 4:04 PM
  Subject: Re: [Flashcoders] Reading properties of a textbox
 [AS3]


  var formatter:TextFormat = _selectedBox.getTextFormat();

  On Thu, Apr 3, 2008 at 10:43 AM, Stuart (FunkDaWeb) 
   [EMAIL PROTECTED]
 
  wrote:

   Hi all im tring to write a button that changes the format of
 a
   textbox
   from normal to italic and back again. I have written the
 below code
   but
 i
   cannot seam to get it to work!
  
   var formatter:TextFormat = new TextFormat();
  
 if (formatter.italic == false)
 {
  formatter.italic = true;
 }
 else
 {
  formatter.italic = false;
 }
  
 _selectedBox.setTextFormat(formatter);
  
   So my question is how do i read the properties of a textbox
 in order
   to
   create an if statment to change the properties?
  
   SM

Re: [Flashcoders] Reading properties of a textbox [AS3]

2008-04-15 Thread Rich Shupe
Stuart,

I'm not sure I've followed this thread thoroughly, but have you embedded a
font and specified it in a text format you're using?

That is, you can't just say embedFonts = true. To do that, you must embed a
font in the Library, and use that font in the field's text format,
controlling the field and format with AS.

Are you using AS3 or AS2?


Rich
http://www.LearningActionScript3.com


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Reading properties of a textbox [AS3]

2008-04-04 Thread Stuart (FunkDaWeb)
When you say replace do you mean like this?

  var formatter:TextFormat = new TextFormat();
  formatter.italic = !currentFormat.italic;
   _selectedBox.setTextFormat(formatter);

SM


  - Original Message - 
  From: Cory Petosky 
  To: Flash Coders List 
  Sent: Thursday, April 03, 2008 8:43 PM
  Subject: Re: [Flashcoders] Reading properties of a textbox [AS3]


  Replace that with:

  formatter.italic = !currentFormat.italic;

  The conditionals aren't necessary in that situation. :)

  On Thu, Apr 3, 2008 at 1:21 PM, Stuart (FunkDaWeb) [EMAIL PROTECTED] wrote:
   YAY! It works! Thank you! :o)
  
Wont work with embedFonts = true thought! :o(
  
Onwards and upwards!
  
Thanks for your help!
  
SM
  
  
 - Original Message -
 From: jonathan howe
 To: Flash Coders List
 Sent: Thursday, April 03, 2008 6:53 PM
 Subject: Re: [Flashcoders] Reading properties of a textbox [AS3]
  
  
 Okay, but in the simple example, you are using it for both:
  
 Okay, but formatter should not be treated as a property of _selectedBox.
 _selectedBox has no property named formatter.
  
 This is the offending line:
  
 if (_selectedBox.formatter.italic == false)
  
 You already have set formatter to the value of 
_selectedBox.getTextFormat();
 Thus your conditional should read:
  
 if (formatter.italic == false)
  
 To simplify it to keeping formatter separate from the current format, 
let's
 rewrite:
  
 var currentFormat:TextFormat = _selectedBox.getTextFormat();
 var formatter:TextFormat = new TextFormat();
  
   if (currentFormat.italic == false)
   {
formatter.italic = true;
   }
   else
   {
formatter.italic = false;
   }
  
  _selectedBox.setTextFormat(formatter);
  
  
 -jonathan
  
  
 On Thu, Apr 3, 2008 at 1:19 PM, Stuart (FunkDaWeb) [EMAIL PROTECTED]
 wrote:
  
  formatter is a blank variable and has nothing to do with reading the 
text
  propperties its used for setting them! I need to figure out how to tell 
if a
  text field is set to italic or not! once i can do this i can fix the if
  statement!
 
  do you have any idea how to do this?
 
 
 
  

 
 
  FUI - New code is this
 
  var formatter:TextFormat = _selectedBox.getTextFormat();
 
 if (_selectedBox.formatter.italic == false)
 {
 formatter.italic = true;
}
else
{
 formatter.italic = false;
}
 
   _selectedBox.setTextFormat(formatter);
- Original Message -
   From: jonathan howe
   To: Flash Coders List
Sent: Thursday, April 03, 2008 5:53 PM
   Subject: Re: [Flashcoders] Reading properties of a textbox [AS3]
 
 
   Hi, Stuart,
 
   Based on the error message sounds like maybe you are trying to access
   _selectedBox.formatter or something else invalid. Can you repaste your
  new
   code after the change?
 
   -jonathan
 
 
   On Thu, Apr 3, 2008 at 11:15 AM, Stuart (FunkDaWeb) [EMAIL PROTECTED]
  
   wrote:
 
thanks Jonathan for some reason i get this error when i change to 
your
code...
   
ReferenceError: Error #1069: Property formatter not found on
flash.text.TextField and there is no default value.
  - Original Message -
 From: jonathan howe
 To: Flash Coders List
 Sent: Thursday, April 03, 2008 4:04 PM
 Subject: Re: [Flashcoders] Reading properties of a textbox [AS3]
   
   
 var formatter:TextFormat = _selectedBox.getTextFormat();
   
 On Thu, Apr 3, 2008 at 10:43 AM, Stuart (FunkDaWeb) 
  [EMAIL PROTECTED]

 wrote:
   
  Hi all im tring to write a button that changes the format of a
  textbox
  from normal to italic and back again. I have written the below 
code
  but
i
  cannot seam to get it to work!
 
  var formatter:TextFormat = new TextFormat();
 
if (formatter.italic == false)
{
 formatter.italic = true;
}
else
{
 formatter.italic = false;
}
 
_selectedBox.setTextFormat(formatter);
 
  So my question is how do i read the properties of a textbox in 
order
  to
  create an if statment to change the properties?
 
  SM
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
   
   
   
 --
 -jonathan howe :: 404.434.2321 :: 180 High St Apt 26

Re: [Flashcoders] Reading properties of a textbox [AS3]

2008-04-03 Thread jonathan howe
var formatter:TextFormat = _selectedBox.getTextFormat();

On Thu, Apr 3, 2008 at 10:43 AM, Stuart (FunkDaWeb) [EMAIL PROTECTED]
wrote:

 Hi all im tring to write a button that changes the format of a textbox
 from normal to italic and back again. I have written the below code but i
 cannot seam to get it to work!

 var formatter:TextFormat = new TextFormat();

   if (formatter.italic == false)
   {
formatter.italic = true;
   }
   else
   {
formatter.italic = false;
   }

   _selectedBox.setTextFormat(formatter);

 So my question is how do i read the properties of a textbox in order to
 create an if statment to change the properties?

 SM
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




-- 
-jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME 04101
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Reading properties of a textbox [AS3]

2008-04-03 Thread Stuart (FunkDaWeb)
thanks Jonathan for some reason i get this error when i change to your code...

ReferenceError: Error #1069: Property formatter not found on 
flash.text.TextField and there is no default value.
  - Original Message - 
  From: jonathan howe 
  To: Flash Coders List 
  Sent: Thursday, April 03, 2008 4:04 PM
  Subject: Re: [Flashcoders] Reading properties of a textbox [AS3]


  var formatter:TextFormat = _selectedBox.getTextFormat();

  On Thu, Apr 3, 2008 at 10:43 AM, Stuart (FunkDaWeb) [EMAIL PROTECTED]
  wrote:

   Hi all im tring to write a button that changes the format of a textbox
   from normal to italic and back again. I have written the below code but i
   cannot seam to get it to work!
  
   var formatter:TextFormat = new TextFormat();
  
 if (formatter.italic == false)
 {
  formatter.italic = true;
 }
 else
 {
  formatter.italic = false;
 }
  
 _selectedBox.setTextFormat(formatter);
  
   So my question is how do i read the properties of a textbox in order to
   create an if statment to change the properties?
  
   SM
   ___
   Flashcoders mailing list
   Flashcoders@chattyfig.figleaf.com
   http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
  



  -- 
  -jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME 04101
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Reading properties of a textbox [AS3]

2008-04-03 Thread jonathan howe
Hi, Stuart,

Based on the error message sounds like maybe you are trying to access
_selectedBox.formatter or something else invalid. Can you repaste your new
code after the change?

-jonathan


On Thu, Apr 3, 2008 at 11:15 AM, Stuart (FunkDaWeb) [EMAIL PROTECTED]
wrote:

 thanks Jonathan for some reason i get this error when i change to your
 code...

 ReferenceError: Error #1069: Property formatter not found on
 flash.text.TextField and there is no default value.
   - Original Message -
  From: jonathan howe
  To: Flash Coders List
  Sent: Thursday, April 03, 2008 4:04 PM
  Subject: Re: [Flashcoders] Reading properties of a textbox [AS3]


  var formatter:TextFormat = _selectedBox.getTextFormat();

  On Thu, Apr 3, 2008 at 10:43 AM, Stuart (FunkDaWeb) [EMAIL PROTECTED]
 
  wrote:

   Hi all im tring to write a button that changes the format of a textbox
   from normal to italic and back again. I have written the below code but
 i
   cannot seam to get it to work!
  
   var formatter:TextFormat = new TextFormat();
  
 if (formatter.italic == false)
 {
  formatter.italic = true;
 }
 else
 {
  formatter.italic = false;
 }
  
 _selectedBox.setTextFormat(formatter);
  
   So my question is how do i read the properties of a textbox in order to
   create an if statment to change the properties?
  
   SM
   ___
   Flashcoders mailing list
   Flashcoders@chattyfig.figleaf.com
   http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
  



  --
  -jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME 04101
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




-- 
-jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME 04101
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Reading properties of a textbox [AS3]

2008-04-03 Thread Stuart (FunkDaWeb)
formatter is a blank variable and has nothing to do with reading the text 
propperties its used for setting them! I need to figure out how to tell if a 
text field is set to italic or not! once i can do this i can fix the if 
statement!

do you have any idea how to do this?





FUI - New code is this

var formatter:TextFormat = _selectedBox.getTextFormat();
   
   if (_selectedBox.formatter.italic == false)
   {
formatter.italic = true;
   }
   else
   {
formatter.italic = false;
   }
   
 _selectedBox.setTextFormat(formatter);
  - Original Message - 
  From: jonathan howe 
  To: Flash Coders List 
  Sent: Thursday, April 03, 2008 5:53 PM
  Subject: Re: [Flashcoders] Reading properties of a textbox [AS3]


  Hi, Stuart,

  Based on the error message sounds like maybe you are trying to access
  _selectedBox.formatter or something else invalid. Can you repaste your new
  code after the change?

  -jonathan


  On Thu, Apr 3, 2008 at 11:15 AM, Stuart (FunkDaWeb) [EMAIL PROTECTED]
  wrote:

   thanks Jonathan for some reason i get this error when i change to your
   code...
  
   ReferenceError: Error #1069: Property formatter not found on
   flash.text.TextField and there is no default value.
 - Original Message -
From: jonathan howe
To: Flash Coders List
Sent: Thursday, April 03, 2008 4:04 PM
Subject: Re: [Flashcoders] Reading properties of a textbox [AS3]
  
  
var formatter:TextFormat = _selectedBox.getTextFormat();
  
On Thu, Apr 3, 2008 at 10:43 AM, Stuart (FunkDaWeb) [EMAIL PROTECTED]
   
wrote:
  
 Hi all im tring to write a button that changes the format of a textbox
 from normal to italic and back again. I have written the below code but
   i
 cannot seam to get it to work!

 var formatter:TextFormat = new TextFormat();

   if (formatter.italic == false)
   {
formatter.italic = true;
   }
   else
   {
formatter.italic = false;
   }

   _selectedBox.setTextFormat(formatter);

 So my question is how do i read the properties of a textbox in order to
 create an if statment to change the properties?

 SM
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

  
  
  
--
-jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME 04101
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
   ___
   Flashcoders mailing list
   Flashcoders@chattyfig.figleaf.com
   http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
  



  -- 
  -jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME 04101
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Reading properties of a textbox [AS3]

2008-04-03 Thread jonathan howe
Okay, but in the simple example, you are using it for both:

Okay, but formatter should not be treated as a property of _selectedBox.
_selectedBox has no property named formatter.

This is the offending line:

if (_selectedBox.formatter.italic == false)

You already have set formatter to the value of _selectedBox.getTextFormat();
Thus your conditional should read:

if (formatter.italic == false)

To simplify it to keeping formatter separate from the current format, let's
rewrite:

var currentFormat:TextFormat = _selectedBox.getTextFormat();
var formatter:TextFormat = new TextFormat();

  if (currentFormat.italic == false)
  {
   formatter.italic = true;
  }
  else
  {
   formatter.italic = false;
  }

 _selectedBox.setTextFormat(formatter);


-jonathan


On Thu, Apr 3, 2008 at 1:19 PM, Stuart (FunkDaWeb) [EMAIL PROTECTED]
wrote:

 formatter is a blank variable and has nothing to do with reading the text
 propperties its used for setting them! I need to figure out how to tell if a
 text field is set to italic or not! once i can do this i can fix the if
 statement!

 do you have any idea how to do this?



 


 FUI - New code is this

 var formatter:TextFormat = _selectedBox.getTextFormat();

if (_selectedBox.formatter.italic == false)
{
formatter.italic = true;
   }
   else
   {
formatter.italic = false;
   }

  _selectedBox.setTextFormat(formatter);
   - Original Message -
  From: jonathan howe
  To: Flash Coders List
   Sent: Thursday, April 03, 2008 5:53 PM
  Subject: Re: [Flashcoders] Reading properties of a textbox [AS3]


  Hi, Stuart,

  Based on the error message sounds like maybe you are trying to access
  _selectedBox.formatter or something else invalid. Can you repaste your
 new
  code after the change?

  -jonathan


  On Thu, Apr 3, 2008 at 11:15 AM, Stuart (FunkDaWeb) [EMAIL PROTECTED]
 
  wrote:

   thanks Jonathan for some reason i get this error when i change to your
   code...
  
   ReferenceError: Error #1069: Property formatter not found on
   flash.text.TextField and there is no default value.
 - Original Message -
From: jonathan howe
To: Flash Coders List
Sent: Thursday, April 03, 2008 4:04 PM
Subject: Re: [Flashcoders] Reading properties of a textbox [AS3]
  
  
var formatter:TextFormat = _selectedBox.getTextFormat();
  
On Thu, Apr 3, 2008 at 10:43 AM, Stuart (FunkDaWeb) 
 [EMAIL PROTECTED]
   
wrote:
  
 Hi all im tring to write a button that changes the format of a
 textbox
 from normal to italic and back again. I have written the below code
 but
   i
 cannot seam to get it to work!

 var formatter:TextFormat = new TextFormat();

   if (formatter.italic == false)
   {
formatter.italic = true;
   }
   else
   {
formatter.italic = false;
   }

   _selectedBox.setTextFormat(formatter);

 So my question is how do i read the properties of a textbox in order
 to
 create an if statment to change the properties?

 SM
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

  
  
  
--
-jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME
 04101
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
   ___
   Flashcoders mailing list
   Flashcoders@chattyfig.figleaf.com
   http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
  



  --
  -jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME 04101
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




-- 
-jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME 04101
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Reading properties of a textbox [AS3]

2008-04-03 Thread Stuart (FunkDaWeb)
YAY! It works! Thank you! :o)

Wont work with embedFonts = true thought! :o(

Onwards and upwards!

Thanks for your help!

SM
  - Original Message - 
  From: jonathan howe 
  To: Flash Coders List 
  Sent: Thursday, April 03, 2008 6:53 PM
  Subject: Re: [Flashcoders] Reading properties of a textbox [AS3]


  Okay, but in the simple example, you are using it for both:

  Okay, but formatter should not be treated as a property of _selectedBox.
  _selectedBox has no property named formatter.

  This is the offending line:

  if (_selectedBox.formatter.italic == false)

  You already have set formatter to the value of _selectedBox.getTextFormat();
  Thus your conditional should read:

  if (formatter.italic == false)

  To simplify it to keeping formatter separate from the current format, let's
  rewrite:

  var currentFormat:TextFormat = _selectedBox.getTextFormat();
  var formatter:TextFormat = new TextFormat();

if (currentFormat.italic == false)
{
 formatter.italic = true;
}
else
{
 formatter.italic = false;
}

   _selectedBox.setTextFormat(formatter);


  -jonathan


  On Thu, Apr 3, 2008 at 1:19 PM, Stuart (FunkDaWeb) [EMAIL PROTECTED]
  wrote:

   formatter is a blank variable and has nothing to do with reading the text
   propperties its used for setting them! I need to figure out how to tell if a
   text field is set to italic or not! once i can do this i can fix the if
   statement!
  
   do you have any idea how to do this?
  
  
  
   

  
  
   FUI - New code is this
  
   var formatter:TextFormat = _selectedBox.getTextFormat();
  
  if (_selectedBox.formatter.italic == false)
  {
  formatter.italic = true;
 }
 else
 {
  formatter.italic = false;
 }
  
_selectedBox.setTextFormat(formatter);
 - Original Message -
From: jonathan howe
To: Flash Coders List
 Sent: Thursday, April 03, 2008 5:53 PM
Subject: Re: [Flashcoders] Reading properties of a textbox [AS3]
  
  
Hi, Stuart,
  
Based on the error message sounds like maybe you are trying to access
_selectedBox.formatter or something else invalid. Can you repaste your
   new
code after the change?
  
-jonathan
  
  
On Thu, Apr 3, 2008 at 11:15 AM, Stuart (FunkDaWeb) [EMAIL PROTECTED]
   
wrote:
  
 thanks Jonathan for some reason i get this error when i change to your
 code...

 ReferenceError: Error #1069: Property formatter not found on
 flash.text.TextField and there is no default value.
   - Original Message -
  From: jonathan howe
  To: Flash Coders List
  Sent: Thursday, April 03, 2008 4:04 PM
  Subject: Re: [Flashcoders] Reading properties of a textbox [AS3]


  var formatter:TextFormat = _selectedBox.getTextFormat();

  On Thu, Apr 3, 2008 at 10:43 AM, Stuart (FunkDaWeb) 
   [EMAIL PROTECTED]
 
  wrote:

   Hi all im tring to write a button that changes the format of a
   textbox
   from normal to italic and back again. I have written the below code
   but
 i
   cannot seam to get it to work!
  
   var formatter:TextFormat = new TextFormat();
  
 if (formatter.italic == false)
 {
  formatter.italic = true;
 }
 else
 {
  formatter.italic = false;
 }
  
 _selectedBox.setTextFormat(formatter);
  
   So my question is how do i read the properties of a textbox in order
   to
   create an if statment to change the properties?
  
   SM
   ___
   Flashcoders mailing list
   Flashcoders@chattyfig.figleaf.com
   http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
  



  --
  -jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME
   04101
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

  
  
  
--
-jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME 04101
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
   ___
   Flashcoders mailing list
   Flashcoders@chattyfig.figleaf.com
   http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
  



  -- 
  -jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME 04101
  ___
  Flashcoders mailing list
  Flashcoders

Re: [Flashcoders] Reading properties of a textbox [AS3]

2008-04-03 Thread Cory Petosky
Replace that with:

formatter.italic = !currentFormat.italic;

The conditionals aren't necessary in that situation. :)

On Thu, Apr 3, 2008 at 1:21 PM, Stuart (FunkDaWeb) [EMAIL PROTECTED] wrote:
 YAY! It works! Thank you! :o)

  Wont work with embedFonts = true thought! :o(

  Onwards and upwards!

  Thanks for your help!

  SM


   - Original Message -
   From: jonathan howe
   To: Flash Coders List
   Sent: Thursday, April 03, 2008 6:53 PM
   Subject: Re: [Flashcoders] Reading properties of a textbox [AS3]


   Okay, but in the simple example, you are using it for both:

   Okay, but formatter should not be treated as a property of _selectedBox.
   _selectedBox has no property named formatter.

   This is the offending line:

   if (_selectedBox.formatter.italic == false)

   You already have set formatter to the value of _selectedBox.getTextFormat();
   Thus your conditional should read:

   if (formatter.italic == false)

   To simplify it to keeping formatter separate from the current format, let's
   rewrite:

   var currentFormat:TextFormat = _selectedBox.getTextFormat();
   var formatter:TextFormat = new TextFormat();

 if (currentFormat.italic == false)
 {
  formatter.italic = true;
 }
 else
 {
  formatter.italic = false;
 }

_selectedBox.setTextFormat(formatter);


   -jonathan


   On Thu, Apr 3, 2008 at 1:19 PM, Stuart (FunkDaWeb) [EMAIL PROTECTED]
   wrote:

formatter is a blank variable and has nothing to do with reading the text
propperties its used for setting them! I need to figure out how to tell 
 if a
text field is set to italic or not! once i can do this i can fix the if
statement!
   
do you have any idea how to do this?
   
   
   

 
   
   
FUI - New code is this
   
var formatter:TextFormat = _selectedBox.getTextFormat();
   
   if (_selectedBox.formatter.italic == false)
   {
   formatter.italic = true;
  }
  else
  {
   formatter.italic = false;
  }
   
 _selectedBox.setTextFormat(formatter);
  - Original Message -
 From: jonathan howe
 To: Flash Coders List
  Sent: Thursday, April 03, 2008 5:53 PM
 Subject: Re: [Flashcoders] Reading properties of a textbox [AS3]
   
   
 Hi, Stuart,
   
 Based on the error message sounds like maybe you are trying to access
 _selectedBox.formatter or something else invalid. Can you repaste your
new
 code after the change?
   
 -jonathan
   
   
 On Thu, Apr 3, 2008 at 11:15 AM, Stuart (FunkDaWeb) [EMAIL PROTECTED]

 wrote:
   
  thanks Jonathan for some reason i get this error when i change to your
  code...
 
  ReferenceError: Error #1069: Property formatter not found on
  flash.text.TextField and there is no default value.
- Original Message -
   From: jonathan howe
   To: Flash Coders List
   Sent: Thursday, April 03, 2008 4:04 PM
   Subject: Re: [Flashcoders] Reading properties of a textbox [AS3]
 
 
   var formatter:TextFormat = _selectedBox.getTextFormat();
 
   On Thu, Apr 3, 2008 at 10:43 AM, Stuart (FunkDaWeb) 
[EMAIL PROTECTED]
  
   wrote:
 
Hi all im tring to write a button that changes the format of a
textbox
from normal to italic and back again. I have written the below code
but
  i
cannot seam to get it to work!
   
var formatter:TextFormat = new TextFormat();
   
  if (formatter.italic == false)
  {
   formatter.italic = true;
  }
  else
  {
   formatter.italic = false;
  }
   
  _selectedBox.setTextFormat(formatter);
   
So my question is how do i read the properties of a textbox in order
to
create an if statment to change the properties?
   
SM
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
   
 
 
 
   --
   -jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME
04101
   ___
   Flashcoders mailing list
   Flashcoders@chattyfig.figleaf.com
   http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
   
   
   
 --
 -jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME 04101
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders