Spark DataGrid Embedded Font Quandary

01.  In everything that follows, I am talking about the latest [21328] version of the SDK, not that I believe that my problems have anything to do with that release, just so anyone interested and willing to help will know the version.
02.  My application happens to be rooted in AIR's WindowedApplication, but again, I do not think that has any impact on my problems; I believe the same results would obtain for a Flex Application.
03.  I have a custom renderer for the Spark DataGrid which extends DefaultGridItemRenderer.  It works fine. Its primary job is to change the font characteristics of each row in the list as a visual clue to the user as to the specific nature of the content that is accessible.  Some entries are just in the Regular font, some in Bold, some in Italic, and some in Bold-Italic.
04.  I have, for most of the project, embedded the necessary fonts like this:
    [Embed (source="C:/Windows/Fonts/ArnoPro-Caption.otf", fontName="ArnoPro_BI_4",
        fontStyle="italic",
        fontWeight="bold",
        mimeType="application/x-font",
        embedAsCFF="true",
        unicodeRange="U+0021-U+00ff, U+20ac-U+20ac")]
    private const ArnoPro_BI_4:Class;
As I said, that all works just as advertized.  But, that method of embedding carries the somewhat painful burden of slower compilations, so for the last 24 hours I have unseccessfully been trying to replace that with:
[Embed (source = "../resources/assets/ArnoPro_BI_4.swf", symbol="ArnoPro_BI_4")]
private const ArnoPro_BI_4:Class;
where the swf file was produced via fontswf, using this incantation:
fontswf -4 -u U+0021-U+00ff,U+20ac-U+20ac -b -i -a ArnoPro_BI_4 -o ArnoPro_BI_4.swf C:/Windows/Fonts/ArnoPro-Caption.otf
06.  By all that is holy, the two different means of embedding the font ought to yield the same result, but they do not.  I have debugging code inserted to print out the list of fonts upon initiation of the application, and they are identical.  Both means of embedding do succeed in getting the embedded fonts into the .swf, but the attempt to use the fonts fails using the second approach.
There is, of course, no change being made to the code in the item renderer which merely uses setStyle() to effect the row-by-row result.  The result in the second case is that the only style of the embedded font that renders is 'regular'.
07.  I have used the 'keep-generated' facility to look at the code being generated by the mxmlc compiler and can see that different code is emitted, but it does not help me find a fix to the problem.  Both forms of the meta-tag do something; both methods of embedding seem to correctly register themselves with the FontManager, but only the method of embedding which actually performs the transcoding during compilation seems to result in a set of registered fronts which can be found and correctly used to render output based on the runtime setting of the font style.

Thank for the reply
I hoped that my posting indicated how the fonts in the the .swf file were constructed.  The "-4", argument to the command-line tool, fontswf, as far as I can tell, is the precise analog to the "embedAsCFF" argument in the [Embed] syntax.  That is what makes it so perplexing.  Given all the external documentation that is available for each tool/methodology, I would have thought that the resultant bytecodes, classes, flags, whatever, would have been identical.  The only difference would be the timing of when the transcoding took place.
Since it is clearly more efficient to only transcode whatever set of fonts an application needs once, not once per build/test turn-around, I would really like to make the fontswf workflow work.  For those of us outside the beneficial environment of your licensed tools, the kindly-provided alternative to the facilities built into Flash Professional and/or Flash Builder give us the greatest degree of productivity.
Whoever has access to the source code for Font [I can only see the uninteresting FontAsset in the SDK] can probably determine what difference might result from mxmlc working with this intermediate output, when inline transcoding is 'tagged':
package
import mx.core.FontAsset;
[ExcludeClass]
[Embed(fontName="ArnoPro_IT_4", _resolvedSource="C:/WINDOWS/Fonts/ArnoPro-ItalicCaption.otf", fontStyle="italic", _line="1189", _pathsep="true", embedAsCFF="true", fontWeight="normal", unicodeRange="U+0021-U+00ff, U+20ac-U+20ac", source="C:/Windows/Fonts/ArnoPro-ItalicCaption.otf", _column="2", exportSymbol="AIRZoom_ArnoPro_IT_4", _file="G:/FP/AIRZoom/src/AIRZoom_AS.as", mimeType="application/x-font")]
public class AIRZoom_ArnoPro_IT_4 extends mx.core.FontAsset
    public function AIRZoom_ArnoPro_IT_4()
        super();
versus this, when swf extraction is 'tagged':
package
import mx.core.FontAsset;
[ExcludeClass]
[Embed(fontName="ArnoPro_IT_4", _resolvedSource="C:/WINDOWS/Fonts/ArnoPro-ItalicCaption.otf", fontStyle="italic", _line="1191", _pathsep="true", embedAsCFF="true", fontWeight="normal", unicodeRange="U+0021-U+00ff, U+20ac-U+20ac", source="C:/Windows/Fonts/ArnoPro-ItalicCaption.otf", _column="2", exportSymbol="AIRZoom_ArnoPro_IT_4", _file="G:/FP/AIRZoom/src/AIRZoom_AS.as", mimeType="application/x-font")]
public class AIRZoom_ArnoPro_IT_4 extends mx.core.FontAsset
    public function AIRZoom_ArnoPro_IT_4()
        super();
The only difference is that value for '_line' which probably only indicates that one of the two processes has a comment or empty line somewhere.

Similar Messages

  • Questions about Spark DataGrid (Header Font Styles, Header Gradient)

    Just starting out in 4.5 SDK, and just a tad confused on the Spark DataGrid.
    1) Trying to set the font style for just the header, but don't see those properties in the designer....as they appear to apply to every part of the DataGrid.
    2) Want to set a linear gradient for the header utilizing two specific colors, alphas and ratios.  Not sure where to set them now.
    I think that is it for now.  From what I have done with it so far, I love it....just obviously not as much user documentation as the MX DataGrid.
    Thanks in advance!
    Bill

    You can do per column header renderers by setting the headerRenderer property on the column. But if you want to swap out all the headers, the header renderer has to be specified in the skin. One neat trick you can do is subclass the DataGridSkin and replace the "headerRenderer" declaration. This also works with the other skin parts.
    <?xml version="1.0" encoding="utf-8"?>
    <skins:DataGridSkin xmlns:fx="http://ns.adobe.com/mxml/2009"
                    xmlns:s="library://ns.adobe.com/flex/spark"
                    xmlns:mx="library://ns.adobe.com/flex/mx"
                    xmlns:skins="spark.skins.spark.*">
        <fx:Declarations>
            <!-- See DataGridSkin for other possible parts -->    
            <fx:Component id="headerRenderer">
                <s:CustomGridHeaderRenderer />
            </fx:Component>
        </fx:Declarations>
    </skins:DataGridSkin>
    -Kevin

  • Flex Spark Datagrid - Scalable (font size) with No scroll Bars

    I was wondering what would be the most optimized way to scale (increase/decrease) the fonts size in a Spark DataGrid with NO Scroller, so as to make it when the User Resizes the DataGrid, the Fonts inside the Grid would increase/decrease. 
    Is there a way to listen for the size change of the DataGrid? 
    I would probably need to change the font size to increase/decrease as the event gets fired on Datagrid Resize. 
    Any suggestions?

    I've pasted as much code as I can legally can.  What i would like to achieve is that when the the window resizes, the Content & the DataGrid Scales. I am also aware of scalemode on the VBox, though it scale oddly with width more than height (this is internal).
    Else, I tried:
    protected function vgroup1_addedToStageHandler(event:Event):void
                //stage.scaleMode = StageScaleMode.EXACT_FIT;
                stage.scaleMode = StageScaleMode.SHOW_ALL;
                stage.align = StageAlign.TOP_LEFT;
                scaleX = .5;
                scaleY = .5; 
                /* if(stage.stageWidth != (event.currentTarget as VGroup).width || stage.stageHeight != (event.currentTarget as VGroup).height)
                    var scaling:Number = 1;
                    if(width>height)
                        scaling = stage.stageWidth / (event.currentTarget as VGroup).width;
                    else
                        scaling = stage.stageHeight / (event.currentTarget as VGroup).height;
                    scaleX = scaleY = scaling;
    == THIS IS All I can Post ==
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/mx"
        xmlns:components="components.*"
         viewSourceURL="srcview/index.html">
        <fx:Script>
        <![CDATA[
            import mx.events.FlexEvent;
            import mx.events.ResizeEvent;
            import mx.rpc.events.ResultEvent;
            import mx.rpc.xml.SimpleXMLDecoder;
            import mx.utils.ArrayUtil;
            import mx.utils.ObjectUtil;
            import spark.components.ResizeMode;
            import spark.effects.Resize;
            // Skin Colors
            private const ALTERNATING_GRID_COLOR:Array = [ 0xF5F5F0 , 0xE7E4E9 ];
            private const ROLL_OVER_COLOR:int = 0x6D9960;
            private const SELECTION_COLOR:int = 0x668F59;
            private const TEXT_FONT_SIZE:int = 11;
            private const TEXT_COLOR:int = 0x080808;
            private const SUMMARY_TEXT_COLOR:int = 0xFAAFFF;
            // First column width
            private var collectiveFirstColumnWidth:int = 160;
            private var collectiveValuesColumnWidth:int = 50;
            // XML data
            [Bindable] private var portfolioSummary1:XMLList;
            [Bindable] private var reconstructedAC:ArrayCollection;
            private function convertXmlToArrayCollection(file:String):ArrayCollection {
                var xml:XMLDocument = new XMLDocument(file);
                var decoder:SimpleXMLDecoder = new SimpleXMLDecoder();
                var data:Object = decoder.decodeXML(xml);
                var array:Array = ArrayUtil.toArray(data);
                return new ArrayCollection(array);
            private function convertToAC():void {
                var ac1:ArrayCollection = convertXmlToArrayCollection(psr1)
                trace(ObjectUtil.toString(ac1));
                //reStructureAC(ac1);
            private function restructureXMLIntoHierarchicalAC():void {
            private function addProperty(obj:Object, attribute:String, value:String):Object {
                var o:Object = obj;
                o[attribute] = value;
                return o;
            protected function httpservice1_resultHandler(event:ResultEvent):void
                portfolioSummary1 = event.result.Analytics.Side.Analytic as XMLList;
                trace('-----\nSide: Sell' + ObjectUtil.toString(event.result.Analytics.Side.(@name=='Sell')));
                trace('-----\nSide: Buy: Analytic Values : \n' + ObjectUtil.toString(event.result.Analytics.Side.(@name=='Buy').Analytic.@value));
                //dg.dataProvider = new XMLListCollection(portfolioSummary1);
                //dg.requestedRowCount = dg.dataProviderLength;
            protected function vgroup1_addedToStageHandler(event:Event):void
                //stage.scaleMode = StageScaleMode.EXACT_FIT;
                stage.scaleMode = StageScaleMode.SHOW_ALL;
                stage.align = StageAlign.TOP_LEFT;
                scaleX = .5;
                scaleY = .5; 
                /* if(stage.stageWidth != (event.currentTarget as VGroup).width || stage.stageHeight != (event.currentTarget as VGroup).height)
                    var scaling:Number = 1;
                    if(width>height)
                        scaling = stage.stageWidth / (event.currentTarget as VGroup).width;
                    else
                        scaling = stage.stageHeight / (event.currentTarget as VGroup).height;
                    scaleX = scaleY = scaling;
            protected function vgroup1_resizeHandler(event:ResizeEvent):void
                (event.currentTarget as VGroup).resizeMode = ResizeMode.SCALE;
        ]]>
        </fx:Script>
        <fx:Declarations>
            <fx:XML id="psr1" source="data/PortfolioSummaryResponse1.xml" />
            <fx:XML id="psr2" source="data/PortfolioSummaryResponse2.xml" />
            <fx:XML id="psr3" source="data/PortfolioSummaryResponse3.xml" />
            <s:XMLListCollection id="headXMLListCol"
                source="{psr1.children()}" />
            <s:HTTPService id="portfolio_HS" result="httpservice1_resultHandler(event)"
                resultFormat="e4x" url="data/PortfolioSummaryResponse1.xml" />
        </fx:Declarations>
        <s:VGroup id="vbox" width="100%" height="100%" top="0" left="0" bottom="0" gap="0" addedToStage="vgroup1_addedToStageHandler(event)">
            <!-- First DataGrid -->
            <components:ExpandableDataGrid5 id="dg"
                color="{TEXT_COLOR}"
                rollOverColor="{ROLL_OVER_COLOR}"
                alternatingRowColors="{ALTERNATING_GRID_COLOR}"
                selectionColor="{SELECTION_COLOR}"
                skinClass="skins.ResizableDataGridSkin"
                >
                <components:columns>
                    <s:ArrayList>
                        <s:GridColumn id="field1" dataField="dataField1" headerText="Portfolio Summary"
                            itemRenderer="itemRenderers.LeftAlignGridItemRenderer"
                            headerRenderer="itemRenderers.HeaderGridItemRenderer"
                            />
                        <s:GridColumn id="field2" dataField="dataField2" headerText="Buy"
                            itemRenderer="itemRenderers.RightAlignGridItemRenderer"
                            headerRenderer="itemRenderers.RightAlignHeaderGridItemRenderer"
                            />
                        <s:GridColumn id="field3" dataField="dataField3" headerText="Sell"
                            itemRenderer="itemRenderers.RightAlignGridItemRenderer"
                            headerRenderer="itemRenderers.RightAlignHeaderGridItemRenderer"
                            />
                        <s:GridColumn id="field4" dataField="dataField4" headerText="Total"
                            itemRenderer="itemRenderers.RightAlignGridItemRenderer"
                            headerRenderer="itemRenderers.RightAlignHeaderGridItemRenderer"
                            />
                    </s:ArrayList>
                </components:columns>
                <components:dataProvider>
                    <s:ArrayCollection>
                        <fx:Object dataField1="data1" dataField2="data2" dataField3="data2"  dataField4="data16"></fx:Object>
                        <fx:Object dataField1="data2" dataField2="data3" dataField3="data3" dataField4="data17"></fx:Object>
                        <fx:Object dataField1="data3" dataField2="data2" dataField3="data2"  dataField4="data16"></fx:Object>
                        <fx:Object dataField1="data4" dataField2="data3" dataField3="data3" dataField4="data17"></fx:Object>
                        <fx:Object dataField1="data5" dataField2="data2" dataField3="data2"  dataField4="data16"></fx:Object>
                        <fx:Object dataField1="data6" dataField2="data3" dataField3="data3" dataField4="data17"></fx:Object>
                        <fx:Object dataField1="data7" dataField2="data2" dataField3="data2"  dataField4="data16"></fx:Object>
                        <fx:Object dataField1="data8" dataField2="data3" dataField3="data3" dataField4="data17"></fx:Object>
                        <fx:Object dataField1="data9" dataField2="data2" dataField3="data2"  dataField4="data16"></fx:Object>
                        <fx:Object dataField1="data10" dataField2="data3" dataField3="data3" dataField4="data17"></fx:Object>
                        <fx:Object dataField1="data11" dataField2="data2" dataField3="data2"  dataField4="data16"></fx:Object>
                        <fx:Object dataField1="data12" dataField2="data3" dataField3="data3" dataField4="data17"></fx:Object>
                        <fx:Object dataField1="data13" dataField2="data3" dataField3="data3" dataField4="data17"></fx:Object>
                        <fx:Object dataField1="data14" dataField2="data3" dataField3="data3" dataField4="data17"></fx:Object>
                        <fx:Object dataField1="data15" dataField2="data3" dataField3="data3" dataField4="data17"></fx:Object>
                    </s:ArrayCollection>
                </components:dataProvider>
            </components:ExpandableDataGrid5>
            <!-- Summary Totals -->
            <components:SummaryRow >
                <s:Label text="Summary Totals" fontWeight="bold" color="{SUMMARY_TEXT_COLOR}"/>
                <s:Spacer width="100%" />
                <s:ButtonBar click="convertToAC()"> 
                    <mx:ArrayCollection>
                        <fx:String>Convert to AC</fx:String>
                        <fx:String>CPS</fx:String>
                    </mx:ArrayCollection>
                </s:ButtonBar>
                <s:ButtonBar click="restructureXMLIntoHierarchicalAC()"> 
                    <mx:ArrayCollection>
                        <fx:String>Parse XML</fx:String>
                        <fx:String>15% POV</fx:String>
                    </mx:ArrayCollection>
                </s:ButtonBar>
            </components:SummaryRow>
            <!-- Second Datagrid -->
            <components:ExpandableDataGrid5 id="dg2"
                color="{TEXT_COLOR}"
                rollOverColor="{ROLL_OVER_COLOR}"
                selectionColor="{SELECTION_COLOR}"
                alternatingRowColors="{ALTERNATING_GRID_COLOR}"
                skinClass="skins.HeadlessDataGridSkin"
                >
                <components:columns>
                    <s:ArrayList>
                        <s:GridColumn dataField="dataField1"
                            itemRenderer="itemRenderers.LeftAlignGridItemRenderer"
                            />
                        <s:GridColumn dataField="dataField2"
                            itemRenderer="itemRenderers.RightAlignGridItemRenderer"
                            />
                        <s:GridColumn dataField="dataField3"
                            itemRenderer="itemRenderers.RightAlignGridItemRenderer"
                            />
                        <s:GridColumn dataField="dataField4"
                            itemRenderer="itemRenderers.RightAlignGridItemRenderer"
                            />
                    </s:ArrayList>
                </components:columns>
                <s:ArrayList>
                    <fx:Object dataField1="data16" dataField2="data2" dataField3="data2"  dataField4="data16"></fx:Object>
                    <fx:Object dataField1="data17" dataField2="data3" dataField3="data3" dataField4="data17"></fx:Object>
                </s:ArrayList>
            </components:ExpandableDataGrid5>
            <!-- Summary Totals - values -->
            <components:SummaryRow>
                <s:Label text="Summary Totals - Values" width="100%" fontWeight="bold" color="{SUMMARY_TEXT_COLOR}"/>
            </components:SummaryRow>
            <!-- Third Datagrid -->
            <components:ExpandableDataGrid5 id="dg3"
                color="{TEXT_COLOR}"
                rollOverColor="{ROLL_OVER_COLOR}"
                selectionColor="{SELECTION_COLOR}"
                alternatingRowColors="{ALTERNATING_GRID_COLOR}"
                skinClass="skins.HeadlessDataGridSkin"
                >
                <components:columns>
                    <s:ArrayList>
                        <s:GridColumn dataField="dataField1"
                            itemRenderer="itemRenderers.LeftAlignGridItemRenderer"
                            />
                        <s:GridColumn dataField="dataField2"
                            itemRenderer="itemRenderers.ToolTipItemRenderer"
                            />
                        <s:GridColumn dataField="dataField3"
                            itemRenderer="itemRenderers.ToolTipItemRenderer"
                            />
                        <s:GridColumn dataField="dataField4"
                            itemRenderer="itemRenderers.ToolTipItemRenderer"
                            />
                    </s:ArrayList>
                </components:columns>
                <s:ArrayList>
                    <fx:Object dataField1="data18" dataField2="data2" dataField3="data3"  dataField4="data16"></fx:Object>
                    <fx:Object dataField1="data19" dataField2="data3" dataField3="data3" dataField4="data17"></fx:Object>
                </s:ArrayList>
            </components:ExpandableDataGrid5>
            <!-- Percent of Tops -->
            <components:SummaryRow>
                <s:Label text="Percent of Tops" color="{SUMMARY_TEXT_COLOR}" width="100%" fontWeight="bold"/>
            </components:SummaryRow>
            <!-- Fourth DataGrid -->
            <components:ExpandableDataGrid5 id="dg4"
                color="{TEXT_COLOR}"
                rollOverColor="{ROLL_OVER_COLOR}"
                selectionColor="{SELECTION_COLOR}"
                alternatingRowColors="{ALTERNATING_GRID_COLOR}"
                skinClass="skins.HeadlessDataGridSkin"
                >
                <components:columns>
                    <s:ArrayList>
                        <s:GridColumn dataField="dataField1"
                            itemRenderer="itemRenderers.LeftAlignGridItemRenderer"  />
                        <s:GridColumn dataField="dataField2"
                            itemRenderer="itemRenderers.RightAlignGridItemRenderer"
                            />
                        <s:GridColumn dataField="dataField3"
                            itemRenderer="itemRenderers.RightAlignGridItemRenderer"
                            />
                        <s:GridColumn dataField="dataField4"
                            itemRenderer="itemRenderers.RightAlignGridItemRenderer"
                            />
                    </s:ArrayList>
                </components:columns>
                <s:ArrayList>
                    <fx:Object dataField1="data20" dataField2="data1" dataField3="data1" dataField4="data20"></fx:Object>
                    <fx:Object dataField1="data21" dataField2="data2" dataField3="data2" dataField4="data21"></fx:Object>
                    <fx:Object dataField1="data22" dataField2="data3" dataField3="data3" dataField4="data22"></fx:Object>
                </s:ArrayList>
            </components:ExpandableDataGrid5>
        </s:VGroup>
    </s:Application>
    ExpandableDataGrid5.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <s:DataGrid xmlns:fx="http://ns.adobe.com/mxml/2009"
                xmlns:s="library://ns.adobe.com/flex/spark"
                xmlns:mx="library://ns.adobe.com/flex/mx"
                horizontalScrollPolicy="off"
                verticalScrollPolicy="off"
                selectionMode="singleCell"
                variableRowHeight="true"
                requestedColumnCount="4"
                width="100%"
                resizableColumns="false"
                creationComplete="thisDatagrid_creationCompleteHandler(event)"
                >
        <fx:Script>
            <![CDATA[
                 import mx.events.FlexEvent;
                /*import mx.events.ResizeEvent;
                [Bindable] private var oldWidth:int;
                [Bindable] private var oldHeight:int;
                protected function thisDatagrid_resizeHandler(event:ResizeEvent):void
                    oldWidth = event.oldWidth;
                    oldHeight = event.oldHeight;
                    this.invalidateDisplayList();
                override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
                    if (oldWidth < width) {
                        setStyle('fontSize', getStyle('fontSize') + 0.5); // might wanna~ width % height to increase by a certain pt
                        //this.scaleX += .1;
                    } else if (oldWidth > width) {
                        setStyle('fontSize', getStyle('fontSize') - 0.5);
                        //this.scaleX -= .1;
                    trace('unscaledWidth: ' + unscaledWidth);
                    trace('unscaledHeight: ' + unscaledHeight);
                    trace('explicitMinHeight: ' + explicitMinHeight);
                    trace('explicitMinWidth: ' + explicitMinWidth);
                    minHeight = measuredMinHeight;
                    super.updateDisplayList(unscaledWidth, unscaledHeight);
                protected function thisDatagrid_creationCompleteHandler(event:FlexEvent):void
                    requestedRowCount = dataProviderLength;
                    requestedMaxRowCount = dataProviderLength;
                    requestedMinRowCount = dataProviderLength;
                    minHeight = measuredHeight;
                /* protected function datagrid1_addedToStageHandler(event:Event):void
                    stage.scaleMode = StageScaleMode.SHOW_ALL;
                    /*                stage.align = StageAlign.TOP;
                     this.width = stage.stageWidth;
                    this.height = stage.stageHeight;
            ]]>
        </fx:Script>
    </s:DataGrid>
    You can Check other ExpandableDataGrids:
    <?xml version="1.0" encoding="utf-8"?>
    <s:DataGrid xmlns:fx="http://ns.adobe.com/mxml/2009"
                xmlns:s="library://ns.adobe.com/flex/spark"
                xmlns:mx="library://ns.adobe.com/flex/mx"
                resize="thisDatagrid_resizeHandler(event)"
                creationComplete="thisDatagrid_creationCompleteHandler(event)"
                horizontalScrollPolicy="off" verticalScrollPolicy="off"
                selectionMode="singleCell"
                variableRowHeight="true"
                requestedColumnCount="4"
                editable="false"
                width="100%"
                >
        <fx:Script>
            <![CDATA[
                import mx.events.FlexEvent;
                import mx.events.ResizeEvent;
                protected function thisDatagrid_resizeHandler(event:ResizeEvent):void
                    //event.stopImmediatePropagation();
                    if (event.oldWidth < width) {
                        setStyle('fontSize', getStyle('fontSize') + 0.5); // might wanna~ width % height to increase by a certain pt
                        //this.scaleX += .1;
                    } else if (event.oldWidth > width) {
                        setStyle('fontSize', getStyle('fontSize') - 0.5);
                        //this.scaleX -= .1;
                    minWidth = measuredMinWidth;
                protected function thisDatagrid_creationCompleteHandler(event:FlexEvent):void
                    requestedRowCount = dataProviderLength;
                    requestedMaxRowCount = dataProviderLength;
                    requestedMinRowCount = dataProviderLength;
                    minHeight = measuredMinHeight;
            ]]>
        </fx:Script>
    </s:DataGrid>
    OR
    <?xml version="1.0" encoding="utf-8"?>
    <s:DataGrid xmlns:fx="http://ns.adobe.com/mxml/2009"
                xmlns:s="library://ns.adobe.com/flex/spark"
                xmlns:mx="library://ns.adobe.com/flex/mx"
                horizontalScrollPolicy="off"
                verticalScrollPolicy="off"
                selectionMode="singleCell"
                variableRowHeight="true"
                requestedColumnCount="4"
                width="100%"
                resize="thisDatagrid_resizeHandler(event)"
                creationComplete="thisDatagrid_creationCompleteHandler(event)"
                >
        <fx:Script>
            <![CDATA[
                 import mx.events.FlexEvent;
                 import mx.events.ResizeEvent;
                [Bindable] private var oldWidth:int;
                [Bindable] private var oldHeight:int;
                protected function thisDatagrid_resizeHandler(event:ResizeEvent):void
                    oldWidth = event.oldWidth;
                    oldHeight = event.oldHeight;
                    this.invalidateDisplayList();
                override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
                    if (oldWidth < width) {
                        setStyle('fontSize', getStyle('fontSize') + 0.5); // might wanna~ width % height to increase by a certain pt
                        //this.scaleX += .1;
                    } else if (oldWidth > width) {
                        setStyle('fontSize', getStyle('fontSize') - 0.5);
                        //this.scaleX -= .1;
                    trace('unscaledWidth: ' + unscaledWidth);
                    trace('unscaledHeight: ' + unscaledHeight);
                    trace('explicitMinHeight: ' + explicitMinHeight);
                    trace('explicitMinWidth: ' + explicitMinWidth);
                    minHeight = measuredMinHeight;
                    super.updateDisplayList(unscaledWidth, unscaledHeight);
                protected function thisDatagrid_creationCompleteHandler(event:FlexEvent):void
                    requestedRowCount = dataProviderLength;
                    requestedMaxRowCount = dataProviderLength;
                    requestedMinRowCount = dataProviderLength;
                    minHeight = measuredHeight;
            ]]>
        </fx:Script>
    </s:DataGrid>

  • How to change header font style in Spark DataGrid?

    I'm looking since last week for a way how to change the font style of the header in a Spark DataGrid. It drive me nuts that I can't find a way to do this. Have anyone one an idea how to achieve it? Any help is appreciated.
    Thanks,
    - Artur

    Hi,
    Some styles won't work because some text styles got hardcoded into the DefaultGridHeaderRenderer's Label. You'll run into this issue not just with the DataGrid headers but also things like the Panel's title and other places where we have text. One way to get around this issue is to create your own custom headerRenderer based on the default one and then redefine the headerRenderer skin part in the skin.
    First, create a subclass of the DefaultGridHeaderRenderer and tweak the "labelDisplay" to your liking (or even just take out all the styles and style it on your own as you had earlier using your custom header renderer's name). Example below (I named it "CustomHeaderRenderer"):
    <?xml version="1.0" encoding="utf-8"?>
    <skins:DefaultGridHeaderRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                                     xmlns:s="library://ns.adobe.com/flex/spark"
                                     xmlns:mx="library://ns.adobe.com/flex/mx"
                                     xmlns:skins="spark.skins.spark.*"
                                     xmlns:comps="comps.*">
        <fx:Declarations>
            <!-- Remove fontweight="bold" and other styles as you wish
                 Must be a component and not a factory. -->
            <s:Label id="labelDisplay"
                     verticalCenter="1" left="0" right="0" top="0" bottom="0"
                     textAlign="start"
                     verticalAlign="middle"
                     maxDisplayedLines="1"
                     showTruncationTip="true" />
        </fx:Declarations>
    </skins:DefaultGridHeaderRenderer>
    Next, create a simple DataGrid skin by creating a subclass of the  spark.skins.spark.DataGridSkin in MXML and defining a new headerRenderer  component in the fx:Declarations section. Example below (I named it "CustomDataGridSkin"):
    <?xml version="1.0" encoding="utf-8"?>
    <skins:DataGridSkin xmlns:fx="http://ns.adobe.com/mxml/2009"
                    xmlns:s="library://ns.adobe.com/flex/spark"
                    xmlns:mx="library://ns.adobe.com/flex/mx"
                    xmlns:skins="spark.skins.spark.*"
                    xmlns:comps="comps.*">
        <fx:Declarations>
            <!-- Must be a factory with the right id for the skin part -->
            <fx:Component id="headerRenderer">
                <comps:CustomHeaderRenderer />
            </fx:Component>
        </fx:Declarations>
    </skins:DataGridSkin>
    Last, assign your new skin as the skinClass of your DataGrid (either in MXML or as a style):
    <s:DataGrid skinClass="comps.CustomDataGridSkin">
    I know it's not pretty, but it's the result of trading off between having completely custom skinning vs. having knobs to tweak every style. Hope this helps.
    -Kevin

  • Embedded font not working in Spark Label control?

    Hi,
    I'm trying to use embedded fonts with the Spark Label (formerly SimpleText) control. I'm using SDK 4 build 10485 now, but I could not manage it in Beta 1 neither.
    I'v been playing with cff: true/false, embedAsCFF:true/false but no results.
    I've added my test application where it does work with the Halo <mx:Label> control, but not with the Spark <s:Label> control.
    So, no compiler errors, but the Spark label control shows a serif (Helvetia?) font where it should be sans as does the Halo control.
    Can anybody help me out here?
    Thanks
    Jan
    As I get the message 'the content type of this attachment is not allowed' on uploading the MXML file, here is the code:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/halo"
        minWidth="1014" minHeight="768"
        backgroundColor="#7B7374">
        <s:layout>
            <s:VerticalLayout paddingBottom="8" paddingLeft="8" paddingRight="8" paddingTop="8" />
        </s:layout>
        <fx:Style>
            @namespace mx "library://ns.adobe.com/flex/halo";
            @namespace s "library://ns.adobe.com/flex/spark";
            @font-face {
                src: url("project/assets/thesans/THSP____.TTF");
                fontFamily: HaloSans;
                fontWeight: normal;
                advancedAntiAliasing: true;
                unicode-range: U+0021-U+007B;
            @font-face {
                src: url("project/assets/thesans/THSP____.TTF");
                fontFamily: SparkSans;
                fontWeight: normal;
                advancedAntiAliasing: true;
                unicode-range: U+0021-U+007B;
                embedAsCFF: true;
            .mySparkSans {
                fontFamily: SparkSans;
                fontSize: 24;
            .myHaloSans {
                fontFamily: HaloSans;
                fontSize: 24;
        </fx:Style>
        <s:SkinnableContainer>
            <s:Label styleName="mySparkSans" text="This should be TheSans but it is not...., notice the characters 'ag'"/>
            <mx:Label styleName="myHaloSans" text="This is TheSans, notice the characters 'ag'" top="100"/>
        </s:SkinnableContainer>
    </s:Application>

    Hi,
    I'm trying to use embedded fonts with the Spark Label (formerly SimpleText) control. I'm using SDK 4 build 10485 now, but I could not manage it in Beta 1 neither.
    I'v been playing with cff: true/false, embedAsCFF:true/false but no results.
    I've added my test application where it does work with the Halo <mx:Label> control, but not with the Spark <s:Label> control.
    So, no compiler errors, but the Spark label control shows a serif (Helvetia?) font where it should be sans as does the Halo control.
    Can anybody help me out here?
    Thanks
    Jan
    As I get the message 'the content type of this attachment is not allowed' on uploading the MXML file, here is the code:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/halo"
        minWidth="1014" minHeight="768"
        backgroundColor="#7B7374">
        <s:layout>
            <s:VerticalLayout paddingBottom="8" paddingLeft="8" paddingRight="8" paddingTop="8" />
        </s:layout>
        <fx:Style>
            @namespace mx "library://ns.adobe.com/flex/halo";
            @namespace s "library://ns.adobe.com/flex/spark";
            @font-face {
                src: url("project/assets/thesans/THSP____.TTF");
                fontFamily: HaloSans;
                fontWeight: normal;
                advancedAntiAliasing: true;
                unicode-range: U+0021-U+007B;
            @font-face {
                src: url("project/assets/thesans/THSP____.TTF");
                fontFamily: SparkSans;
                fontWeight: normal;
                advancedAntiAliasing: true;
                unicode-range: U+0021-U+007B;
                embedAsCFF: true;
            .mySparkSans {
                fontFamily: SparkSans;
                fontSize: 24;
            .myHaloSans {
                fontFamily: HaloSans;
                fontSize: 24;
        </fx:Style>
        <s:SkinnableContainer>
            <s:Label styleName="mySparkSans" text="This should be TheSans but it is not...., notice the characters 'ag'"/>
            <mx:Label styleName="myHaloSans" text="This is TheSans, notice the characters 'ag'" top="100"/>
        </s:SkinnableContainer>
    </s:Application>

  • Embedded fonts display differently in mx and spark

    Hi there,
    My apologies if this is an known issue but I have not been able to find any posts describing this problem. As the title of the discussion describes the problem I see is that when embedding the same font for spark and mx components they display differently to the point of making the application look sloppy. I created a small app to illustrate the problem:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application
        minWidth="955" minHeight="600"
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/mx">
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <fx:Style>
    @namespace s "library://ns.adobe.com/flex/spark";
    @namespace mx "library://ns.adobe.com/flex/mx";
    @font-face
    src:url("arial.ttf");
    fontFamily: arialCFF;
    embedAsCFF: true;
    @font-face {
    src:url("arial.ttf");
    fontFamily: arialNoCFF;
    embedAsCFF: false;
    advancedAntiAliasing: false;
    s|Label
    fontFamily: arialCFF;
    fontSize: 20px;
    mx|Label
    fontFamily: arialNoCFF;
    fontSize: 20px;
    </fx:Style>
        <s:layout>
            <s:VerticalLayout
                paddingLeft="10"
                paddingTop="10"/>
        </s:layout>
        <s:Label text="This is a label that uses spark"/>
        <mx:Label text="This is a label that uses mx"/>
    </s:Application>
    I used the Arial.ttf font I found in my mac, though I have also tried with courier new and even the myriad web pro provided with an example in the SDK. Also I have tried with SDKs 4.1, 4.5 and 4.5.1. I have played with the value of advancedAniAliasing as well. Regardless of the combination I will still see differences such as this:
    Is this a known issue? Any solutions at hand?
    Thanks in advance for the help!!

    Hi there,
    Thanks for the quick reply. I was able to make fonts display correctly after hacking the display of some components (mx.controls.FormItem for example) however I did notice a whole buch of runtime warnings that showed up as a result of the workaround such as:
    warning: incompatible embedded font 'arialCFFFont' specified for mx.core::UITextFormat. This component requires that the embedded font be declared with embedAsCFF=false.
    TextFieldAutomationHelper:captureSelection() - 'selectionBeginIndex' is not implemented in FTETextField.
    And in some cases for components I do not even use:
    warning: incompatible embedded font 'arialCFFFont' specified for mx.controls::TextInput (TextInput1967) . This component requires that the embedded font be declared with embedAsCFF=false.
    Any ideas on how to avoid this noise or do we have to live with this?

  • Setting font style on hover for spark datagrid

    I'm trying to skin a Spark datagrid. I have most things sorted by creating a custom skin, but one thing I can't find is how to set the colour of the row's font on hover. I can set the background colour fine, but how would I go about changing the font colour when a user hovers over the row?
    Thanks

    Hi
    You don’t actually deal with the text that’s displayed in the a datagrid inside of the skin
    Look at item renderers for the grid columns. You can style your text or whatever else you would like to display in the grid, in the renderer
    Hope that helps a little
    If you are still stuck just let me know and I’ll send you some code
    Cheers
    g
    heres some code
    NOTE: I am making this up as I sit here so I may be forgetting something. Don’t be surprised if this doesn’t work, but the basic idea is right I think
    So in the spark datagrid when you set your column (if you use mxml) this will replace a glob renderer so you can have a different one for each column if you wish.
    <s:GridColumn dataField="Status"
    headerText="name"
    width="37"                                                    
    itemRenderer="fooRenderer"
    />
    Or set a gloabel renderer in the grid def itself
    <s:DataGrid itemRenderer=”fooRenderer” />
    Then write a custom renderer: fooRenderer.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <s:GridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                         xmlns:s="library://ns.adobe.com/flex/spark"
                         xmlns:mx="library://ns.adobe.com/flex/mx"
                         clipAndEnableScrolling="true"
                         >
           <fx:Script>
                  <![CDATA[
                         override public function discard(willBeRecycled:Boolean):void
                               labelData.text="";
                               super.discard(willBeRecycled);
                         override public function prepare(hasBeenRecycled:Boolean):void
                               if(data)
                                       // set the colour of the text label to black
                                      labelData.setStyle("color",0x000000)
                                      // put some logic here to dynamic style the label
                               //check for the 'format' function on the column  (THIS MAY BE WRONG)
                               if( column.labelFunction != null )
                                      labelData.text = column.labelFunction( data, column );
                               else
                                      labelData.text = data[column.dataField];
                         super.prepare(hasBeenRecycled);
                  ]]>
           </fx:Script>
           <s:Label id="labelData" />
    </s:GridItemRenderer

  • Problems with embedded font on spark RichText control

    « Hide
    I have an embedded font that appears correctly when used with Halo components, but when associated with the spark RichText component, it is not recognized.
    The embedded font is defined in css file, my css file
    @namespace s "library://ns.adobe.com/flex/spark";
    @namespace mx "library://ns.adobe.com/flex/halo";
    @font-face {
    src:url("assets/fonts.swf");
    fontFamily: "Helvetica Neue";
    @font-face {
    src:url("assets/fonts.swf");
    fontFamily:"Helvetica Neue";
    fontWeight: bold;
    global{
    color:#333333;
    fontFamily: "Helvetica Neue";
    fontSize:12px;
    The embedded font it used in the following manner:
    <mx:Label styleName="panelTitle" text="Hello There"  width="263" x="21" y="11"/>
    <s:Group width="410" x="38" y="52" height="50">
    <s:RichText styleName="panelTitle" text="Hello There" fontFamily="Helvetica Neue"  width="263" x="21" y="11"/>
    </s:Group>
    The Label shows the embedded font correctly while the RichText control does not. It does not matter if the fontFamily is specified explicitly on the control or not.
    I created a bug SDK-22137, but since I'd need to get this working soon any help would be appreciated.

    Just a friendly reminder. Many of the examples on that site are fairly old and havent been updated to use the latest APIs. For example, "cff" has recently been renamed to "embedAsCFF". In fact, here's a better example:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/halo">
        <s:layout>
            <s:VerticalLayout paddingLeft="20" paddingTop="20" />
        </s:layout>
        <fx:Style>
            @namespace mx "library://ns.adobe.com/flex/halo";
            @namespace s "library://ns.adobe.com/flex/spark";
            /* DefineFont3 (embedAsCFF == false) */
            @font-face {
                src: url("assets/georgia.TTF");
                fontFamily: embGeorgia;
                fontWeight: normal;
                embedAsCFF: false;
            @font-face {
                src: url("assets/georgiab.TTF");
                fontFamily: embGeorgia;
                fontWeight: bold;
                embedAsCFF: false;
            /* DefineFont4 (embedAsCFF == true) */
            @font-face {
                src: url("assets/georgia.TTF");
                fontFamily: embGeorgiaCFF;
                fontWeight: normal;
                embedAsCFF: true;
            @font-face {
                src: url("assets/georgiab.TTF");
                fontFamily: embGeorgiaCFF;
                fontWeight: bold;
                embedAsCFF: true;
            mx|Label {
                fontFamily: embGeorgia;
            s|RichText {
                fontFamily: embGeorgiaCFF;
                fontLookup: embeddedCFF;
        </fx:Style>
        <mx:Label text="Halo Label" />
        <mx:Label text="Halo Label (bold)" fontWeight="bold" />
        <s:RichText text="Spark RichText" />
        <s:RichText text="Spark RichText (bold)" fontWeight="bold" />
    </s:Application>
    Also, depending on what you're trying to do, this may help you: http://blog.flexexamples.com/2009/06/14/using-a-cff-embedded-font-with-a-halo-label-contro l-in-flex-4/. Basically, you can set the textFieldClass style on certain Halo controls and have them use the mx.core.UITLFTextFieldClass (instead of the default mx.core.UITextFieldClass) so they can take advantage of the new CFF fonts.
    In fact, here's the same example as above, but with the single embedded font:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/halo">
        <s:layout>
            <s:VerticalLayout paddingLeft="20" paddingTop="20" />
        </s:layout>
        <fx:Style>
            @namespace mx "library://ns.adobe.com/flex/halo";
            @namespace s "library://ns.adobe.com/flex/spark";
            /* DefineFont4 (embedAsCFF == true) */
            @font-face {
                src: url("assets/georgia.TTF");
                fontFamily: embGeorgiaCFF;
                fontWeight: normal;
                embedAsCFF: true;
            @font-face {
                src: url("assets/georgiab.TTF");
                fontFamily: embGeorgiaCFF;
                fontWeight: bold;
                embedAsCFF: true;
            mx|Label {
                fontFamily: embGeorgiaCFF;
                textFieldClass: ClassReference("mx.core.UITLFTextField");
            s|RichText {
                fontFamily: embGeorgiaCFF;
                fontLookup: embeddedCFF;
        </fx:Style>
        <mx:Label text="Halo Label" />
        <mx:Label text="Halo Label (bold)" fontWeight="bold" />
        <s:RichText text="Spark RichText" />
        <s:RichText text="Spark RichText (bold)" fontWeight="bold" />
    </s:Application>
    Peter

  • Embedded font on Spark Button

    I am using an embedded font for all spark labels. It works fine.
    However, the font is not applied to the button label. If I switch the font to Comic Sans MS then the font is used on the button.
    I can't figure out why this particular embedded font works in all labels, except the button label.
    Any help would be greatly appreciated.
    gkx

    I'm seconding Robs reply here... I had a very similar issue and ended up having to set the fontWeight and fontStyle to match the embedded font. In my case it was normal and normal using a Futura family font.
    So, my overall embed was:
    @font-face {
                                  src: url("assets/fonts/Futura_Book_BT.ttf");
                                  fontFamily: "FuturaCFF";
                                  embedAsCFF: true;
                        @font-face {
                                  src: url("assets/fonts/Futura_Book_BT.ttf");
                                  fontFamily: "Futura";
                                  embedAsCFF: false;
    Then my buttons looked like
    <s:Button fontFamily="Futura"  fontWeight="normal" label="Select"  click="hubSelectionHandler(event)" />

  • [svn:fx-trunk] 10545: Make DataGrid smarter about when and how to calculate the modulefactory for its renderers when using embedded fonts

    Revision: 10545
    Author:   [email protected]
    Date:     2009-09-23 13:33:21 -0700 (Wed, 23 Sep 2009)
    Log Message:
    Make DataGrid smarter about when and how to calculate the modulefactory for its renderers when using embedded fonts
    QE Notes: 2 Mustella tests fail:
    components/DataGrid/DataGrid_HaloSkin/Properties/datagrid_properties_columns_halo datagrid_properties_columns_increase0to1_halo
    components/DataGrid/DataGrid_SparkSkin/Properties/datagrid_properties_columns datagrid_properties_columns_increase0to1
    These fixes get us to measure the embedded fonts correctly when going from 0 columns to a set of columns so rowHeight will be different (and better) in those scenarios
    Doc Notes: None
    Bugs: SDK-15241
    Reviewer: Darrell
    API Change: No
    Is noteworthy for integration: No
    tests: checkintests mustella/browser/DataGrid
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-15241
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/DataGrid.as
        flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/dataGridClasses/DataGridBase .as
        flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/dataGridClasses/DataGridColu mn.as

    Hi Matthias,
    Sorry, if this reply seems like a products plug (which it is), but this is really how we solve this software engineering challenge at JKI...
    At JKI, we create VI Packages (which are basically installers for LabVIEW instrument drivers and toolkits) of our reusable code (using the package building capabilities of VIPM Professional).  We keep a VI Package Configuration file (that includes a copy of the actual packages) in each of our project folders (and check it into source code control just as we do for all our project files).  We also use VIPM Enterprise to distribute new VI Packages over the network.
    Also, as others have mentioned, we use the JKI TortoiseSVN Tool to make it easy to use TortoiseSVN directly from LabVIEW.
    Please feel free to contact JKI if you have any specific questions about these products.
    Thanks,
    -Jim 

  • Spark datagrid item editor font see through

    I am using a default item editor on a spark datagrid.
    When the user attempts to edit the field the old value shows through.
    How do I get rid of this?
    I am using out of the box stuff? Is this a listed bug?
    Code is...
    <s:GridColumn dataField="Actual" headerText="Actual" width="75" editable="true">
                        <s:itemRenderer>
                            <fx:Component>
                                <s:DefaultGridItemRenderer textAlign="right"   background="true" backgroundColor="#FFFFFF" alpha="1.0" color="#000000" />
                            </fx:Component>
                        </s:itemRenderer>
        </s:GridColumn>
    Thanks
    Dan Pride

    Try <s:DefaultGridItemEditor if you are wanting to make it editable.
    here is an example of combobox, but it is similiar ....
    <s:itemEditor>
    <fx:Component>
    <s:ComboBoxGridItemEditor  >
    <s:dataProvider>
    <s:ArrayList>
    <fx:String>Edit</fx:String>
    <fx:String>Read</fx:String>
    </s:ArrayList>
    </s:dataProvider>
    </s:ComboBoxGridItemEditor>
    </fx:Component>
    </s:itemEditor>
    Don

  • Unable to load embedded fonts in Textlayout Framework using SWFContext.

    Hi,
        We are having issues with embedding/renderring fonts in swf.
        Here is the code of the slide1.swf compiled by mxmlc.exe [Adobe Flex Compiler (mxmlc) Version 4.1.0 build 16076] with compiler parameters --  "-static-link-runtime-shared-libraries".
    and checked with  Flash player version 10.1 and 10.2 and 10.3.
        package
            import flash.display.Sprite;
            import flashx.textLayout.compose.ISWFContext;
            public class Slide1 extends Sprite implements ISWFContext
                [Embed(source="C:/WINDOWS/FONTS/CALIBRI.TTF", fontName="Calibri", embedAsCFF = "true", unicodeRange="U+0041,U+0072,U+0069,U+0061,U+006C,U+0020,U+004E,U+006F,U+006D", mimeType="application/x-font")]
                public static const calibri:Class;
                [Embed("slide1/sldBg1.png", mimeType="image/png")]
                public static const bg:Class;
                [Embed("slide1/slide1.xml", mimeType="application/octet-stream")]
                public static const slide:Class;
                public function callInContext(fn:Function, thisArg:Object, argsArray:Array, returns:Boolean=true):*
                    if (returns)
                    return fn.apply(thisArg, argsArray);
                    fn.apply(thisArg, argsArray);
        Using Flex 4.1 SDK:--
            When I load the slide1.swf in ActionScript Project it shows the embedded text.
            But, when I load the slide1.swf in  MX+Spark Flex Project, it gives an error :
            Warning: An ActionScript 1.0/2.0 SWF file has loaded an ActionScript 3.0 SWF; code in the ActionScript 3.0 SWF will not run.
           Error TypeError: Error #1034: Type Coercion failed: cannot convert Slide1@f56fce9 to mx.core.IFlexModuleFactory. !
            Below red colored text is the code where the exception occurs.
            var fontClass:Class = ApplicationDomain.currentDomain.getDefinition("slide1") as Class;
          textFlow.flowComposer.swfContext = new fontClass();
            textFlow.flowComposer.addController(new ContainerController(textContainer, containerWidth, containerHeight));   
            textFlow.flowComposer.updateAllControllers();           
            And, when I load the slide1.swf in Only MX Flex Poject, it shows the embedded Font.
        Using Flex 4.5 SDK:--
            With MX+ Spark and MX only Flex Project we get following errors
            VerifyError: Error #1053: Illegal override of createGeometry in flashx.textLayout.elements.FlowGroupElement.
            VerifyError: Error #1053: Illegal override of canReleaseContentElement in flashx.textLayout.elements.SubParagraphGroupElement.
            VerifyError: Error #1103: Class flashx.textLayout.elements::LinkElement cannot extend final base class.
            VerifyError: Error #1053: Illegal override of display in flashx.textLayout.elements.ContainerFormattedElement.
            VerifyError: Error #1053: Illegal override of canReleaseContentElement in flashx.textLayout.elements.FlowLeafElement.
            VerifyError: Error #1053: Illegal override of addParaTerminator in flashx.textLayout.elements.SpanElement.
            VerifyError: Error #1053: Illegal override of canReleaseContentElement in flashx.textLayout.elements.InlineGraphicElement.
            VerifyError: Error #1053: Illegal override of minPercentValue in flashx.textLayout.property.NumberOrPercentProperty.
            VerifyError: Error #1053: Illegal override of hash in flashx.textLayout.property.EnumStringProperty.
            VerifyError: Error #1053: Illegal override of hash in flashx.textLayout.property.BooleanProperty.
            VerifyError: Error #1053: Illegal override of minValue in flashx.textLayout.property.NumberProperty.
            VerifyError: Error #1014: Class flashx.textLayout.property::NumberProperty could not be found.
            VerifyError: Error #1053: Illegal override of minValue in flashx.textLayout.property.IntProperty.
            VerifyError: Error #1014: Class flashx.textLayout.property::IntProperty could not be found.
            VerifyError: Error #1053: Illegal override of hash in flashx.textLayout.property.UintProperty.
            VerifyError: Error #1014: Class flashx.textLayout.property::UintProperty could not be found.
            VerifyError: Error #1053: Illegal override of hash in flashx.textLayout.property.StringProperty.
            VerifyError: Error #1014: Class flashx.textLayout.property::NumberOrPercentProperty could not be found.
            VerifyError: Error #1053: Illegal override of hash in flashx.textLayout.property.ArrayProperty.
            VerifyError: Error #1103: Class flashx.textLayout.elements::TCYElement cannot extend final base class.
            VerifyError: Error #1053: Illegal override of createTextLine in flashx.textLayout.compose.ComposeState.

    Hi Jin-Huang
              But when I use Simple ASProject with SDK 4.1 then it works fine but when I create Flex project then it give error
    with SWFContext.
    I think it's a issue of swfcontext or AS comunication with Spark components.
    Please let me know if any solution.
    Thanks

  • Module not unloading if embedded font was ever used

    So, I have a test app that uses modules with the font embeded. Using ModuleManager I am able to load up the module. Once I call   IModuleInfo.factory.create(), I am then able to setStyle("fontFamily", "BPDiet") and the font does show up. The issue I am now having is that once I have used a font from a module, even if my TextArea is no longer using it (I even tried removing the textArea, and replacing it with a new one), the module will not unload.
    I read through this "What We Know About Unloading Modules" and I think I am not leaving any references around.They are loaded using the load() defaults. There is no code (that is used) in the module. The modules are not being added to the display, so they never receive focus.
    Note that I am unable to run the profiler as suggested in the article as I don't have the premium Flash Builder 4. <grrr>
    Note that the first module that is loaded, I can never get to unload, even if I never used the font embedded in it, but all subsequent modules will unload, if I do not use the embedded font. I can live with the first one being pinned as long as I can unload the others that are not in use.
    Here is the code from one of my modules:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Module xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx">
        <fx:Script>
            <![CDATA[
                import spark.components.TextArea;
                [Embed(source='assets/BPDiet.otf',
                        fontName='BPDiet',
                           mimeType='application/x-font')]
                public static var BPDietNormal:Class;
                public function GetSampleTextArea():TextArea {
                    var SampleTextArea:TextArea = new TextArea();
                    SampleTextArea.text = "Test BPDiet please!";
                    SampleTextArea.setStyle("fontFamily", 'BPDiet');
                    return SampleTextArea;           
            ]]>
        </fx:Script>
    </mx:Module>
    And here is the App that is loading and using the modules:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="400" minHeight="400">
        <fx:Script>
            <![CDATA[
                import mx.collections.ArrayCollection;
                import mx.core.UIComponent;
                import mx.events.FlexEvent;
                import mx.events.ModuleEvent;
                import mx.managers.SystemManager;
                import mx.modules.IModule;
                import mx.modules.IModuleInfo;
                import mx.modules.Module;
                import mx.modules.ModuleManager;
                import spark.components.TextArea;
                private var _ta:TextArea = null;
                protected var _moduleInfo:IModuleInfo;
                private function LoadFontTextArea(fontSwf:String):void {
                    status.text = "Loading the font pack";
                    _moduleInfo = ModuleManager.getModule(fontSwf);
                    // add some listeners
                    _moduleInfo.addEventListener(ModuleEvent.READY, onModuleReady);
                    _moduleInfo.addEventListener(ModuleEvent.ERROR, moduleLoadErrorHandler);
                    _moduleInfo.addEventListener(ModuleEvent.UNLOAD, moduleUnloadHandler);
                    _moduleInfo.load();
                private function onModuleReady(event:ModuleEvent):void {
                    status.text = "The font pack swf Ready \n" + event.module.url;
                    //All I had todo was create the module, then I could access the embeded font by name
                    var fontMod:* = event.module.factory.create();
                    //_ta = fontMod.GetSampleTextArea();
                    //panelToStuff.addElement(_ta);
                    fontMod = null;
                    //fontNameForSample = event.module.url.replace(".swf", "");
                private function moduleLoadErrorHandler(event:ModuleEvent):void {
                    status.text = "Font Module Load Error. \n" +
                        event.module.url + "\n"+ event.errorText;
                private function moduleUnloadHandler(event:ModuleEvent):void {
                    status.text = "Font Module Unload Event. \n" + event.module.url;
                private function fontChangedHandler():void {
                    unloadCurrentFont();
                    LoadFontTextArea(String(availFonts.selectedItem));
                private function unloadCurrentFont():void {
                    if (_ta != null) {
                        panelToStuff.removeElement(_ta);
                        _ta = null;
                    panelToStuff.removeElement(sampleTextArea);
                    sampleTextArea = null;
                    sampleTextArea = new TextArea();
                    sampleTextArea.id = "sampleTextArea";
                    sampleTextArea.text = "Some text for your viewing pleasure. " + colorForBK.toString(16);
                    panelToStuff.addElement(sampleTextArea);               
                    if (_moduleInfo != null)
                        _moduleInfo.release();
                        //_moduleInfo.unload();
                        _moduleInfo = null;
                    System.gc();
                private function DoNonImportantWork():void {
                    colorForBK -= 0xFAA;
                    if (colorForBK < 0x0) colorForBK = 0xFFFFFF;
                    var foo:* = {prop1: "yea" + colorForBK.toString(), prop2:"boo" + colorForBK.toString()};
                    var hmm:String = foo.prop1 + " " + foo.prop2;
                    regedFonts = new ArrayCollection(Font.enumerateFonts(false));
                [Bindable]
                private var colorForBK:int = 0xFFFFFF;
                [Bindable]
                private var fonts:ArrayCollection =
                    new ArrayCollection(new Array("AlexandriaFLF.swf", "BPDiet.swf", "ChanpagneFont.swf", "KidsFont.swf"));
                [Bindable]
                private var regedFonts:ArrayCollection;
                [Bindable]
                private var fontNameForSample:String = "";
            ]]>
        </fx:Script>
        <s:VGroup id="panelToStuff">
            <s:HGroup>
                <s:Label id="status" text="status area" backgroundColor="{colorForBK}"/>
                <s:VGroup>
                    <s:DropDownList id="availFonts" dataProvider="{fonts}" change="fontChangedHandler()" />
                    <s:Button label="UnLoad" enabled="true" click="unloadCurrentFont()"/>
                    <s:Button label="doSome" enabled="true" click="DoNonImportantWork()"/>
                </s:VGroup>
            </s:HGroup>
            <s:HGroup>
                <s:Button click="fontNameForSample = 'BPDiet';" label="BPDiet"/>
                <s:Button click="fontNameForSample = 'Champagne';" label="Champagne"/>
                <s:Button click="fontNameForSample = 'Kids';" label="Kids"/>
            </s:HGroup>
            <s:Label text="{regedFonts.length} reg'ed"/>
            <s:TextArea id="sampleTextArea" fontFamily="{fontNameForSample}" text="Some Sample text for your viewing"/>
        </s:VGroup>
    </s:Application>
    A couple things to note; I am calling System.rc() in the unloadCurrentFont() method just to speed up seeing the SWF unload in the debug console. The DoNonImportantWork() is there to just cause some events to happen and to create some objects that will need to be GC'ed. It also let me know that the fonts are not getting registered in Font.
    I'm going to have 30 fonts (and more, that designer is busy) that I will need to be able to dynamically load, but right now, loading them with CSS style modules blows up after about 15 because style modules register the font so I cannot unload the CSS swf.

    To help eliminate the question of whether the TextArea is being held by something else, I have removed it from the MXML, and now programatically create it. That did not help.
    So, I got the trial version of Flash Builder 4 installed on another machine in the office so that I can use the profiler. (The profiler is pretty cool by the way).
    After a lot of profiing, I found four paths to the module's FlexModuleFactory.
    Two of those paths go to EmbeddedFontRegistry, whose data is static. I could get into it and remove font entry and free up the moduleFactory from there. This is a hack, that entry in/on EmbeddedFontRegistry.font should have been cleaned up by the code removing the fontFamily from the TextArea. (Note that EmbeddedFontRegistry is marked [ExcludeClass], which I assume means I should not really be messing with it.
    The other two I cannot get to as they are anonymous. They also don't appear to be referenced, as the Object References shows them both as GC root objects. Here is a screen shot:
    I did a search through the sdk code and 'fbs' only shows up as a parameter on the init function of various Marshal support classes, but is not used in the init()
    Anyway, these references to the FlexModuleFactory do not get held if I do not use the embeded font in the module.
    Here is the updated code:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="400" minHeight="400">
        <fx:Script>
            <![CDATA[
                import mx.collections.ArrayCollection;
                import mx.core.EmbeddedFont;
                import mx.core.EmbeddedFontRegistry;
                import mx.core.IEmbeddedFontRegistry;
                import mx.core.UIComponent;
                import mx.events.FlexEvent;
                import mx.events.ModuleEvent;
                import mx.managers.SystemManager;
                import mx.modules.IModule;
                import mx.modules.IModuleInfo;
                import mx.modules.Module;
                import mx.modules.ModuleManager;
                import spark.components.TextArea;
                private var _ta:TextArea = null;
                protected var _moduleInfo:IModuleInfo;
                private function LoadFontTextArea(fontSwf:String):void {
                    status.text = "Loading the font pack";
                    _moduleInfo = ModuleManager.getModule(fontSwf);
                    // add some listeners
                    _moduleInfo.addEventListener(ModuleEvent.READY, onModuleReady);
                    _moduleInfo.addEventListener(ModuleEvent.ERROR, moduleLoadErrorHandler);
                    _moduleInfo.addEventListener(ModuleEvent.UNLOAD, moduleUnloadHandler);
                    _moduleInfo.load();
                private function onModuleReady(event:ModuleEvent):void {
                    status.text = "The font pack swf Ready \n" + event.module.url;
                    //All I had todo was create the module, then I could access the embeded font by name
                    var fontMod:* = event.module.factory.create();
                    fontMod = null;
                private function moduleLoadErrorHandler(event:ModuleEvent):void {
                    status.text = "Font Module Load Error. \n" +
                        event.module.url + "\n"+ event.errorText;
                private function moduleUnloadHandler(event:ModuleEvent):void {
                    status.text = "Font Module Unload Event. \n" + event.module.url;
                private function fontChangedHandler():void {
                    unloadCurrentFont();
                    LoadFontTextArea(String(availFonts.selectedItem));
                private function unloadCurrentFont():void {
                    if (_ta != null && _moduleInfo != null) {
                        var fontName:String = _ta.getStyle("fontFamily");
                        _ta.setStyle("fontFamily", "");
                        _ta.validateProperties();
                        if (_ta.textDisplay) {
                            _ta.textDisplay.validateProperties();
                        panelToStuff.removeElement(_ta);               
                        _ta = null;
                        //This I should not have to do, but the framework is not doing it
                        var embFontReg:IEmbeddedFontRegistry = EmbeddedFontRegistry.getInstance();
                        var embFonts:Array = embFontReg.getFonts();
                        for each (var curEmbFont:EmbeddedFont in embFonts){
                            if (curEmbFont.fontName == fontName){
                                embFontReg.deregisterFont(curEmbFont, _moduleInfo.factory);
                    if (_moduleInfo != null)
                        _moduleInfo.unload();
                        _moduleInfo = null;
                    System.gc();
                private function AddTA():void {
                    _ta = new TextArea();
                    _ta.text = "Some text for your viewing pleasure. " + colorForBK.toString(16);
                    panelToStuff.addElement(_ta);
                private function DoNonImportantWork():void {
                    colorForBK -= 0xFAA;
                    if (colorForBK < 0x0) colorForBK = 0xFFFFFF;
                    var foo:* = {prop1: "yea" + colorForBK.toString(), prop2:"boo" + colorForBK.toString()};
                    var hmm:String = foo.prop1 + " " + foo.prop2;
                [Bindable]
                private var colorForBK:int = 0xFFFFFF;
                [Bindable]
                private var fonts:ArrayCollection =
                    new ArrayCollection(new Array("AlexandriaFLF.swf", "BPDiet.swf", "ChanpagneFont.swf", "KidsFont.swf"));
            ]]>
        </fx:Script>
        <s:VGroup id="panelToStuff">
            <s:HGroup>
                <s:Label id="status" text="status area" backgroundColor="{colorForBK}"/>
                <s:VGroup>
                    <s:DropDownList id="availFonts" dataProvider="{fonts}" change="fontChangedHandler()" />
                    <s:Button label="UnLoad" enabled="true" click="unloadCurrentFont()"/>
                    <s:Button label="AddTA" enabled="true" click="AddTA()"/>
                    <s:Button label="doSome" enabled="true" click="DoNonImportantWork()"/>
                </s:VGroup>
            </s:HGroup>
            <s:Button click="_ta.setStyle('fontFamily', 'BPDiet');" label="BPDiet"/>
        </s:VGroup>
    </s:Application>
    I really think I've reached the end of what I can do. This really seems like a bug.

  • Arabic vocalization diacritics are not rendered correctly using Adobe Arabic as Embedded Font

    Hi,
    Vocalization diacritics are rendered as independent characters.
    Vocalization diacritics should be rendered combined and merged with the characters preceding them like in the third line of the attached image.
    Have a look at the SWF:
    1) The first line is aTextLayoutComponent which uses Adobe Arabic as en Embeded Font.
    2) The second line is using the System Font Adobe Arabic.
    Does anyone have an idea ?
    I personally think, when you choose System Font, it uses System Text rendering Engine. But if you embeed font flash has problem with rendering the diacritics properly.

    Hello,
    this is my whole code:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/halo"
                   minWidth="1024" minHeight="768"
                   creationComplete="init()"
                   xmlns:controls="flashx.textLayout.controls.*">
        <s:layout >
            <s:VerticalLayout/>
        </s:layout>
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
            <s:HTTPService id="httpServiceObj" url="TopFirst.txt" result="handleResult(event)"
                           fault="handleFault(event)" 
                           resultFormat="text"/>
        </fx:Declarations>
        <fx:Style>
            @namespace s "library://ns.adobe.com/flex/spark";
            @namespace mx "library://ns.adobe.com/flex/halo";
              @font-face
                src:url("trado.ttf");
                fontFamily: ArabicFont;
                fontWeight: normal;
                font-style:normal;
                advancedAntiAliasing: true;
        </fx:Style>
        <fx:Script>
            <![CDATA[
                import mx.controls.Alert;
                import mx.rpc.events.FaultEvent;
                import mx.rpc.events.ResultEvent;
                private function init():void{
                    httpServiceObj.send();
                [Bindable]
                private var _str:String;
                private function handleResult(event:ResultEvent):void{
                    _str    =    event.result as String;       
                private function handleFault(event:FaultEvent):void{
                    Alert.show("fault is = " + event.fault.faultString);
            ]]>
        </fx:Script>
        <s:TextArea text="{_str}"  width="100%"
                    height="100%"
                    fontSize="50"
                    />
    </s:Application>
    As you can see from the code, I am not given any font to the TextArea , even  after giving the font which I have embeded ,out is the same.
    Where I am going wrong..

  • Why don't embedded fonts work inside ItemRenderers?

    I'm trying to use an embedded font on a spark label inside an item renderer for a list control and it doesn't work.  Works fine everywhere else.

    So i think i figured out what was going on.  Here is my simplified code:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:components="com.rtn.jccFlex.components.*" xmlns:local="*" xmlns:components1="com.ray.components.*">
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <fx:Style>
            @namespace s "library://ns.adobe.com/flex/spark";
            @namespace mx "library://ns.adobe.com/flex/mx";
            @font-face {
                src: url("/assets/Typewriter.ttf");
                fontFamily: Typewriter;
                embedAsCFF: true;
        </fx:Style>
        <mx:VBox width="100%" height="100%">
            <s:Label fontFamily="Typewriter" text="MY FONT WORKS!!" fontSize="14" />
            <s:Panel width="60%" height="100%" fontSize="18" fontWeight="bold">
                <s:Label fontFamily="Typewriter" text="MY FONT DOESNT WORKS!!" fontSize="14" />               
            </s:Panel>       
        </mx:VBox>
    </s:Application>
    It was looking for the bold version of the font since it inherited it from the parent panel. But the embed by default embeds the "normal" weight.
    In our project someone wrote a common panel component that sets the content of the panel using the "DefaultProperty" and we put our list in there.  So you don't really think about the container that the List and ItemRenderer sit inside, and it was very easy to overlook.
    This was very painful to figure out.
    Thanks for the help guys.

Maybe you are looking for

  • Facebook and Twitter integration not working

    I'm have trouble using Facebook and Twitter integration in Mountain Lion. When I click 'Click to Tweet', or 'Click to Post', nothing happens; I don't get the notecard looking thig, and it's like I never clicked the button. Same thing with sharing fro

  • Net due date incorrect in FBL3N report

    Hi, Net due date is coming correctly in Vendor Display report FBL1N, however the same entry when we see in reconciliation account in FBL3N we get the wrong due date. We are going thorough GL head to get the correct amount which is tallying with f.08

  • Can I create a Submit Form button that allows a choice of who to submit it to?

    I have some paperwork that all new hires need to complete and then send back to their specific HR representative.  Is there a way to allow them to choose which email they want to submit their form to?  We're dealing with blue collar workers that aren

  • When to use parallel models?

    I am using TestStand to control test execution in a thermal chamber. I am unsure which process model best suits my needs (sequential, parallel, or batch). My requirements are as follows: Up to 4 UUTs will be tested using a single test system. Each UU

  • Inbound idoc testing via partner profile

    i want to test inbound idoc testing via partner profile. the problem is i its generating idoc no and giving a message like "idoc no 12453152.. is saved but cannot or shd not be processed". what does that mean .. how shd i veiw properties of partner p