RE: [flexcoders] Re: Loading style sheets at run time

2008-08-13 Thread Alex Harui
I think you will need to contact the provider of the chart component to
determine how to work with their API.

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of saatreddy
Sent: Wednesday, August 13, 2008 11:12 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Loading style sheets at run time

 


Hi,

I have to embed fonts into my application. I have .swf font files.
I have to use these swf files as an array in a combo box, so that the 
user can select the font. Once he selects that font I have to use the
selected swf(ex Arial.swf) file in an xml element as value. I 
specifically dont use the emded fonts to display any component in my 
app. But the xml file is used by a chart flex component to display 
the chart. In the xml file I have to specify the font file name and 
the path where it is found. I tried using @font face. But when I try 
to use the .swf in the dropdown, and specify the path to it in the 
xml file, I get an IO error. I am not sure if the font.swf files are 
getting loaded or how should I approach resolving this issue.

Thanks

--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, Alex Harui [EMAIL PROTECTED] wrote:

 2. Bseides the @font-face, you must have some way of specifying 
in
 CSS to use the Ad Lib font. What does the relevant CSS look like?
 
 4. What happens if you load the CSS from the main app instead of 
the
 module?
 
 
 
 
 
 From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com

[mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
] On
 Behalf Of kaushal_bshah
 Sent: Thursday, July 24, 2008 10:31 PM
 To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com 
 Subject: [flexcoders] Re: Loading style sheets at run time
 
 
 
 Alex,
 
 Thanks for quick response. Following are the answers to your 
questions.
 
 1. Yes I have embed each fonts in .swf, and use following css
 @font-face {
 src: url(adlib_embed.swf);
 fontFamily: Ad Lib;
 }
 
 2. Sorry I have no idea on selectors. Is it the thing which I am
 missing? 
 
 3. MyTextArea is a mxml file, and root tag of this component is 
TextArea
 
 4. The code which loads CSS SWF is in the module but again in Card
 component. (main app  module  card (custom component)load CSS SWF)
 
 --- In flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com  mailto:flexcoders%
40yahoogroups.com
 , Alex Harui aharui@ wrote:
 
  Are you embedding fonts? Or just setting the font family?
  
  
  
  What kinds of selectors are you using to tell MyTextArea about its
 font?
  
  
  
  What does MyTextArea extend?
  
  
  
  Is the code that loads the CSS SWF in the module or main app?
  
  
  
  
  
  From: flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com  mailto:flexcoders%
40yahoogroups.com
 [mailto:flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com  mailto:flexcoders%
40yahoogroups.com
 ] On
  Behalf Of kaushal_bshah
  Sent: Thursday, July 24, 2008 3:06 AM
  To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
mailto:flexcoders%
40yahoogroups.com 
  Subject: [flexcoders] Loading style sheets at run time
  
  
  
  I have created few fonts css and compiled them into swf to load 
them
  at run time.
  
  There is one custom component Card, is placed into a Module and 
this
  Module is loaded by main application.
  
  The Card component contains TextArea, MyTextArea(custom 
component) and
  ComboBox (which display font list).
  
  Now when user select any font from ComboBox, Card component load 
css
  and when it get loaded, it updates fontFamily of TextArea and
  MyTextArea. But only TextArea updated with new fonts while 
MyTextArea
  is not getting update anytime.
  
  Can anyone help me to figure out this.
  
  I am using following code to load css run time.
  
  var myEvent:IEventDispatcher =
 
 StyleManager.loadStyleDeclarations(fontSource
[0].src,true,false,Applicat
  ionDomain.currentDomain);
  myEvent.addEventListener(StyleEvent.COMPLETE,fontComplete);
  myEvent.addEventListener(StyleEvent.ERROR,fontError);
  
  Any help is appreciated, Thanks
 


 



RE: [flexcoders] Re: Loading style sheets at run time

2008-07-25 Thread Alex Harui
2.  Bseides the @font-face, you must have some way of specifying in
CSS to use the Ad Lib font.  What does the relevant CSS look like?

4.   What happens if you load the CSS from the main app instead of the
module?

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of kaushal_bshah
Sent: Thursday, July 24, 2008 10:31 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Loading style sheets at run time

 

Alex,

Thanks for quick response. Following are the answers to your questions.

1. Yes I have embed each fonts in .swf, and use following css
@font-face {
src: url(adlib_embed.swf);
fontFamily: Ad Lib;
}

2. Sorry I have no idea on selectors. Is it the thing which I am
missing? 

3. MyTextArea is a mxml file, and root tag of this component is TextArea

4. The code which loads CSS SWF is in the module but again in Card
component. (main app  module  card (custom component)load CSS SWF)

--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, Alex Harui [EMAIL PROTECTED] wrote:

 Are you embedding fonts? Or just setting the font family?
 
 
 
 What kinds of selectors are you using to tell MyTextArea about its
font?
 
 
 
 What does MyTextArea extend?
 
 
 
 Is the code that loads the CSS SWF in the module or main app?
 
 
 
 
 
 From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
[mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
] On
 Behalf Of kaushal_bshah
 Sent: Thursday, July 24, 2008 3:06 AM
 To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com 
 Subject: [flexcoders] Loading style sheets at run time
 
 
 
 I have created few fonts css and compiled them into swf to load them
 at run time.
 
 There is one custom component Card, is placed into a Module and this
 Module is loaded by main application.
 
 The Card component contains TextArea, MyTextArea(custom component) and
 ComboBox (which display font list).
 
 Now when user select any font from ComboBox, Card component load css
 and when it get loaded, it updates fontFamily of TextArea and
 MyTextArea. But only TextArea updated with new fonts while MyTextArea
 is not getting update anytime.
 
 Can anyone help me to figure out this.
 
 I am using following code to load css run time.
 
 var myEvent:IEventDispatcher =

StyleManager.loadStyleDeclarations(fontSource[0].src,true,false,Applicat
 ionDomain.currentDomain);
 myEvent.addEventListener(StyleEvent.COMPLETE,fontComplete);
 myEvent.addEventListener(StyleEvent.ERROR,fontError);
 
 Any help is appreciated, Thanks


 



RE: [flexcoders] Re: Loading style sheets at run time

2008-07-25 Thread Alex Harui
RichTextEditor may block setting of styles using setStyle as it expects
the markup to describe the font properties.  This may not be a module
problem.  Try it in a simple test app.

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of kaushal_bshah
Sent: Friday, July 25, 2008 12:21 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Loading style sheets at run time

 

Hi 

Let me clear what is MyTextArea. This component is copied from
mx:RichTextEditor/, so that user can format each character of
MyTextArea's text. 

For a testing purpose I have create one more component TempTextArea
based on TextArea, and put it inside Card component. And when user
change font I am updating fontFamily of TempTextArea using following
setter method
public function set _font(val:String):void{
this.setStyle(fontFamily,val);
}

And TempTextArea is working correct.

I think there is something wrong in MyTextArea, as it uses all method
of RichTextEditor.mxml and have following function to update styles of
TextArea

public function setTextStyles(type:String, value:Object = null):void
{
//I have removed lines which are not related to my issue
var tf:TextFormat;
var beginIndex:int = this.getTextField().selectionBeginIndex;
var endIndex:int = this.getTextField().selectionEndIndex;
.
tf[type] = value;
..
this.getTextField().setTextFormat(tf,beginIndex,endIndex);
}