English 中文(简体)
图4.5
原标题:FlashBuilder 4.5 :: Render Text without lifecycle for upsampling

I need to find a way to "upsample" text from 72dpi (screen) to 300dpi (print) for rendered client generated text. This is a true WYSIWYG application and we re expecting a ton of traffic so client side rendering is a requirement. Our application has several fonts, font sizes, colors, alignments the user can modify in a textarea. The question is how to convert 72dpi to 300dpi. We have the editior complete, we just need to make 300dpi versions of the textarea.

MY IDEA

(1) 字塔,将高、宽和体积增加300/72。 (如果在体积上需要帐篷,我可能需要将体积的后向高度/宽度增加)

2) 使用比图Util。 了解案文的解答

THE QUESTION

我怎么能够把案文放在没有部件生命周期的文本里? 想象:

var textArea:TextArea = new TextArea();
textArea.text = "This is a test";    
var bmd:BitmapData = textArea.render();
最佳回答

这里是我用来解决如何制作一个可打印文本的“自动文本Area”部分案文和风格问题的最后方法。 我最后把习俗部分文本AreaRenderer(见下文)放在数据和元数据交换中,并给人以假名。 然后利用提及该构成部分处理任何文本领域(主题),并回复一个比图Data标。

public class TextAreaRenderer extends TextArea implements IAssetRenderer
{

    public function render(renderObject:Object, dpi:int = 300):BitmapData{

        // CAST THE OBJECT
        //.................
        var userTextArea:TextArea = TextArea(renderObject);

        // SCALE IS THE DIVISION OF THE NEW DPI OVER THE SCREEN DPI 72
        //............................................................
        var scale:Number = dpi / 72;

        // COPY THE USER S TEXT AREA INTO THE OFFSCREEN TEXT AREA
        //.......................................................
        this.text = userTextArea.text;                          // the actual text
        this.height = Math.floor(userTextArea.height * scale);  // scaled height
        this.width = Math.floor(userTextArea.width * scale);    // scaled width


        // GET THE LAYOUT FORMATS AND COPY TO OFFSCREEN
        // - the user s format =  userTextAreaLayoutFormat
        // - the hidden format = thisLayoutFormat
        //...............................................
        var editableLayoutProperties:Array = [ fontSize ,  fontFamily ,  fontWeight ,  fontStyle ,  textAlign ,  textDecoration ,  color ]
        userTextArea.selectAll();
        var userTextAreaLayoutFormat:TextLayoutFormat = userTextArea.getFormatOfRange();
        this.selectAll();
        var thisLayoutFormat:TextLayoutFormat = this.getFormatOfRange();
        for each(var prop:String in editableLayoutProperties){
            thisLayoutFormat[prop] = userTextAreaLayoutFormat[prop];
        }

        // SCALE THE FONT SIZE
        //....................
        thisLayoutFormat.fontSize = thisLayoutFormat.fontSize * scale;

        // SET THE FORMAT BACK IN THE TEXT BOX
        //...................................
        this.setFormatOfRange(thisLayoutFormat);

        // REDRAW THE OFFSCREEN
        // RETURN THE BITMAP DATA
        //.......................
        this.validateNow();
        return BitmapUtil.getSnapshot(this);
    }
}

Then calling the TextAreaRenderer after the text area is changed to get a scaled up bitmap.

// COPY THE DATA INTO THE OFFSCREEN COMPONENT
//............................................
var renderableComponent:IAssetRenderer = view.offScreenTextArea;
return renderableComponent.render(userTextArea, 300);

www.un.org/Depts/DGACM/index_french.htm 通过与我一起工作的灵活性。

问题回答

和“灵活”一样,除你实际在4.16X申请中zoom外,食宿与新闻部没有任何关系。 如果您的运用都有病媒图象,那就是一个问题。 此外,任何网络应用中都失去了新闻部的概念,直到你重新努力挽救/印出一个比图。

这无疑是可能的,但你不得不自行表示。

To ask a question another way, it is possible to create a TextArea in memory which I can use the BitmapUtil.getSnapshot() function to generate a BitmapData object

从技术上讲,所有组成部分都记忆犹新。 我认为,你想要做的是,在不将其添加到集装箱内的情况下,就能够成为一个组成部分。

我们确实是用于灵活部分的水标记。 从概念上讲,我们创造了一种使情况成为事实的方法。

public function render(argInheritingStyles : Object):void{
 this.createChildren();
 this.childrenCreated();
 this.initializationComplete();
 this.inheritingStyles = argInheritingStyles;
 this.commitProperties();
 this.measure(); 
 this.height = this.measuredHeight;
 this.width = this.measuredWidth;
 this.updateDisplayList(this.unscaledWidth,this.unscaledHeight);
}

The method must be explicitly called. Then you can use the standard procedure for turning the component into a bitmap. I think we use a Label; but the same approach should work on any given component.





相关问题
Disable button tooltip in AS3

I want to disable the tooltip on certain buttons. The tooltip manager seems to be an all or nothing solution. Is it possible to disable the tooltip for just one or two buttons?

Multiple Remote call made simultenously

I was making multiple remote calls and they are done sequentially and when I am getting a result event back it s triggering calls to all the methods with ResultEvent as an argument . I am supposed to ...

Attaching a property to an event in Flex/AS3

I have a parameter that needs to be passed along with an event. After unsuccessful attempts to place it on the type by extending the class, I ve been advised in another SO question to write a custom ...

Clearing RSL in Cache

I have built a flex application which has a "main" project and it is assosciated with a few RSL s which are loaded and cached once i run my "main" application. The problem i am facing is that the ...

What s a good way of deserializing data into mock objects?

I m writing a mock backend service for my flex application. Because I will likely need to add/edit/modify the mock data over time, I d prefer not to generate the data in code like this: var mockData =...

AS3 try/catch out of memory

I m loading a few huge images on my flex/as3 app, but I can t manage to catch the error when the flash player runs out of memory. Here is the what I was thinking might work (I use ???? because i dont ...