Auto resizable spark TextArea (Flex 4).

Creating auto resizable components is a typical and often not a hard task for developer. But there are some problems with TextArea. TextArea automatically displays scrollers when content is too large. The main suggestion in the internet on how to fix it is to add handlers on textChange event and resize TextArea by number of text lines. But it requires manual work every time you use TextArea, so this approach is not optimal. But there is a way to reskin TextArea to obtain autoresize, this way you’ll just need to apply this skin instead of default (or inherit from TextArea and make this new skin default).

The main skin part of TextArea is textDisplay. TextDisplay implements IEditableText and usually it is an instance of RichEditableText Class. RichEditableText has no scrolls and it determines its size by content. So the answer on how to create auto resizable TextArea you can find in skinClass. Let’s look default skin of TextArea from wireframe theme:


1.	<?xml version="1.0" encoding="utf-8"?>
3.	<!--
6.	    Copyright 2008 Adobe Systems Incorporated
7.	    All Rights Reserved.
9.	    NOTICE: Adobe permits you to use, modify, and distribute this file
10.	    in accordance with the terms of the license agreement accompanying it.
12.	-->
14.	<!--- The default wireframe skin class for the Spark TextArea component.
15.	        Skin classes in the wireframe package are useful for using as a simple base for a custom skin.
17.	     @see spark.components.TextArea
19.	     @langversion 3.0
20.	     @playerversion Flash 10
21.	     @playerversion AIR 1.5
22.	     @productversion Flex 4
23.	-->
24.	<s:Skin xmlns:fx="" xmlns:s="library://"
25.	     alpha.disabledStates="0.5">
27.	    <fx:Metadata>
28.	        /**
29.	         * @copy spark.skins.spark.ApplicationSkin#hostComponent
30.	         */
31.	        [HostComponent("spark.components.TextArea")]
32.	    </fx:Metadata>
34.	    <fx:Script>
35.	        <![CDATA[
36.	            /**
37.	             * @private
38.	             */
39.	            override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
40.	            {
41.	                if (promptDisplay)
42.	                {
43.	                    promptDisplay.setLayoutBoundsSize(unscaledWidth - 1, unscaledHeight - 1);
44.	                    promptDisplay.setLayoutBoundsPosition(1, 1);
45.	                }
47.	                super.updateDisplayList(unscaledWidth, unscaledHeight);
48.	            }            
49.	        ]]>
50.	    </fx:Script>
52.	    <s:states>
53.	        <s:State name="normal"/>
54.	        <s:State name="disabled" stateGroups="disabledStates"/>
55.	        <s:State name="normalWithPrompt"/>
56.	        <s:State name="disabledWithPrompt" stateGroups="disabledStates"/>
57.	    </s:states>
59.	    <!-- border/fill -->
60.	    <s:Rect left="0" right="0" top="0" bottom="0">
61.	        <s:stroke>
62.	            <s:SolidColorStroke color="#5C5C5C" weight="1"/>            
63.	        </s:stroke>
64.	        <s:fill>
65.	            <s:SolidColor color="#FFFFFF"/>
66.	        </s:fill>
67.	    </s:Rect>
69.	    <!-- shadow -->
70.	    <s:Rect left="1" top="1" right="1" height="1">
71.	        <s:fill>
72.	            <s:SolidColor color="#000000" alpha="0.12" />
73.	        </s:fill>
74.	    </s:Rect>
76.	    <!--- Defines the scroller used to scroll the TextArea. -->
77.	    <s:Scroller id="scroller" left="0" top="0" right="0" bottom="0" minViewportInset="1" measuredSizeIncludesScrollBars="false">
78.	        <!--- @copy spark.components.supportClasses.SkinnableTextBase#textDisplay -->
79.	        <s:RichEditableText id="textDisplay"
80.	                 heightInLines="10"
81.	                 widthInChars="15"
82.	                 paddingLeft="3" paddingTop="5"
83.	                 paddingRight="3" paddingBottom="3"/>
84.	    </s:Scroller>
85.	    <!--- Defines the Label that is used for prompt text. The includeInLayout property is false so the prompt text does not affect measurement. -->
86.	    <s:Label id="promptDisplay"
87.	             mouseEnabled="false" mouseChildren="false"
88.	             includeIn="normalWithPrompt,disabledWithPrompt"
89.	             includeInLayout="false"
90.	             paddingLeft="3" paddingTop="5"
91.	             paddingRight="3" paddingBottom="3"
92.	             />                
94.	</s:Skin>

In the 79th line there is a textDisplay definition. As you see it is the child of Scroller. To make a resizable TextArea you’ll need to:

  1. Remove scrollers from the skin;
  2. Set heightInLines=”NaN” or remove property definition from mxml (textDisplay will determine its height automatically);
  3. Set widhtInChars=”NaN” or remove property (textDisplay will determine its width automatically);
  4. Set minHeight, left, top, right properties;
  5. If you use spark theme remove definition of textDisplay.bottom property from updateDisplayList and in mxml;

Completed skin for auto resizable TextArea (based on wireframe theme):


1.	<?xml version="1.0" encoding="utf-8"?>
2.	<s:Skin xmlns:fx="" xmlns:s="library://"
3.	     alpha.disabledStates="0.5" minHeight="0">
4.	    <fx:Metadata>
5.	        [HostComponent("spark.components.TextArea")]
6.	    </fx:Metadata>
7.	    <fx:Script>
8.	        <![CDATA[
9.	            override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
10.	            {
11.	                if (promptDisplay)
12.	                {
13.	                    promptDisplay.setLayoutBoundsSize(unscaledWidth - 1, unscaledHeight - 1);
14.	                    promptDisplay.setLayoutBoundsPosition(1, 1);
15.	                }
16.	                super.updateDisplayList(unscaledWidth, unscaledHeight);
17.	            }            
18.	        ]]>
19.	    </fx:Script>
20.	    <s:states>
21.	        <s:State name="normal"/>
22.	        <s:State name="disabled" stateGroups="disabledStates"/>
23.	        <s:State name="normalWithPrompt"/>
24.	        <s:State name="disabledWithPrompt" stateGroups="disabledStates"/>
25.	    </s:states>
27.	    <s:Rect left="0" right="0" top="0" bottom="0">
28.	        <s:stroke>
29.	            <s:SolidColorStroke color="#5C5C5C" weight="1"/>            
30.	        </s:stroke>
31.	        <s:fill>
32.	            <s:SolidColor color="#FFFFFF"/>
33.	        </s:fill>
34.	    </s:Rect>
36.	    <s:Rect left="1" top="1" right="1" height="1">
37.	        <s:fill>
38.	            <s:SolidColor color="#000000" alpha="0.12" />
39.	        </s:fill>
40.	    </s:Rect>
42.	     <s:RichEditableText id="textDisplay" minHeight="0"
43.	                 left="5" right="5" top="5" paddingBottom="5"
44.	                 />
45.	    <s:Label id="promptDisplay"
46.	             mouseEnabled="false" mouseChildren="false"
47.	             includeIn="normalWithPrompt,disabledWithPrompt"
48.	             includeInLayout="false"
49.	             paddingLeft="3" paddingTop="5"
50.	             paddingRight="3" paddingBottom="3"
51.	             />                
53.	</s:Skin>

Example of Application:


1.	<?xml version="1.0" encoding="utf-8"?>
2.	<s:Application xmlns:fx=""
3.	              xmlns:s="library://"
4.	              xmlns:mx="library://"
5.	              width="400" minHeight="600"
6.	              backgroundColor="#E6E6E6">
7.	    <fx:Declarations>
8.	    </fx:Declarations>
9.	    <s:layout>
10.	        <s:VerticalLayout paddingTop="40" paddingLeft="10" paddingRight="10"/>
11.	    </s:layout>
12.	    <s:TextArea skinClass="com.yumasoft.skins.TextAreaNoScrollsSkin" maxWidth="300"/>
13.	    <s:TextArea width="100%" skinClass="com.yumasoft.skins.TextAreaNoScrollsSkin"/>
14.	</s:Application>



Full source code25.83 KB
Auto resizeable TextAreas skin with spark theme1.77 KB
Auto resizeable TextAreas skin with wireframe theme856 bytes


Effortless Acne Tips You Are Unable To Do Without

Is pimples obtaining you lower? Pimples can depress the majority of people, and then for young people it may be terrible. But you will find points that can be done to reduce the appearance of acne breakouts. There are actually no right away solutions, but pursuing our suggestions brings about a marked improvement.
informacje i ciekawostki ze swiata seo
Try using sodium normal water to remove the acne. If normal skin soap and water aren't very receiving the task finished, try cleansing your facial skin with sodium drinking water as an alternative. It will work to remove essential oil with out drying out your skin area. Simply be mindful about getting it with your eye or inside of available abrasions.

A useful way of combating acne is to make a sensitive energy to maintain your hands from all areas of the deal with. Extreme holding of your facial area can disperse acne breakouts-causing bacteria all over the surface of the skin, and might help to additional exacerbate current swelling. It is never smart to purposely burst pimples along with your convenience, simply because scar issues will probably outcome.

Attempt to avoid utilizing essential oil-structured cosmetics if your skin area is vulnerable to zits. The oil in weighty oils-centered moisturizers or foundations can prevent pores ultimately causing the development of whiteheads, pimples and zits. Oils-structured items can provide an effective setting for bacteria to particular breed of dog on the skin which could cause an pimples outbreak.

You shouldn't grab yourself obsessed around one particular pimple. It might actually result in more pressure, and you may break out in a number of locations. Just permit it to be and it will surely go away completely on its own. Should you proceed to be concerned about it, it can only become worse.

Should you have a tendency to get acne breakouts face up or chest, there might be a problem with the clothing you use. You should scrub them regularly, specifically if you exercising in these outfits. Also, using tight clothing can upset your skin layer to make it bust out. Try wearing loosened clothes, instead.

For those who have aspirin laying around you can test an aspirin face mask to your acne. Grind up several capsules and add more just enough h2o to produce a face mask. Use this for the skin for approximately 10 minutes. The components in the aspirin will minimize the puffiness and swelling.

Don't neglect to moisturize your skin if you suffer from acne breakouts. Most acne treatment products consist of strong ingredients that can often lead to red-colored patches and dryness. There are a number of skin lotions accessible for all kinds of skin. If your skin is extremely greasy, pick an oil-cost-free moisturizing lotion. For hypersensitive skin area, go along with a thing that is aroma-totally free and hypo-allergenic. If you are using an acne treatments cream, steer clear of any moisturizer containing substances that exfoliate your skin layer, such as alpha hydroxy or salicylic acidity. It could additional aggravate the skin.

To enhance the way in which your skin looks, try to keep both hands away of the epidermis as far as possible. During the course of the time, both hands preserve a lot of bacteria, which can irritate your facial skin and result in acne cysts and spots, spoiling the way you look .

Keeping yourself hydrated will allow you to lessen your acne. Ensure that you maintain hydrated daily by ingesting plenty of h2o . A lot of people need to beverage six to eight eyeglasses every day, at least. Old skin debris clog your skin pores and so are a cause of acne.

Occasionally, acne cases are induced coming from a bodily hormone modify. There are actually forms of arrival manage capsules that can help clean up this sort of acne breakouts. When healing hormone acne, it is quite crucial to do so less than medical professionals supervision. It will clear up with time if still left on your own, so long as you are looking after on your own.

To aid remove acne breakouts preventing futures kinds from showing, take a chromium dietary supplement once daily. Even though Chromium is better known as an help for weight-loss, it can also help to mend infected skin area. These nutritional supplements might be generally present in a drug stores and nourishment shops.

Employing natural aloe vera lotion on a daily basis could have a optimistic result on pimples split outs. Aloe-vera has skin soothing components. It may lessen swelling and minimize scarring. Apply it for your epidermis twice a day, in the morning and just before your bed, for best results.

A powerful home cure for severe acne is witch hazel. Apply to your facial skin by using a natural cotton tennis ball, once you have cleansed your face along with your typical merchandise. Then, utilize two % salicylic acid item . It helps prevent any longer breakout, along with handle the imperfections which can be presently there.

An essential idea to take into consideration when regarding acne cases are to take into consideration making use of Hydrocortisone as being a treatment. It is really an over the counter treatment that has been seen to eliminate inflammation in pimples. Make sure you not overuse this product, or use on unaffected locations so that you usually do not inflame the skin.

Ensure that you make sure to hydrate after applying your acne remedy. Most acne treatments will dry out the skin. This is just what many of them are meant to do. This is a good thing, but when you enable your pores and skin to remain dried up you can get soreness and irritation.

Prevent upcoming cystic acne and reduce present ones, be preserving your fingers off your facial skin. The hands pick-up harmful bacteria from whatever you feel and holding your skin only propagates that harmful bacteria all around. You can even aggravate skin which is currently inflamed from the latest acne breakouts outbreak. Be mindful of where by your hands are already and make certain to clean them typically.

In order to prevent your zits from starting to be more severe, you need to in no way pop your acne breakouts. Whenever you pop your pimples, the germs plugged in your own skin pores will be released, and may distribute more than your entire encounter causing better soreness and discomfort. The bacteria on your hands can also intensify your zits.

Given, some of this advice is easier to utilize than others. However, it is obvious that when you get challenging on on your own, and constantly apply these suggestions, that you will see a positive change with your epidermis. So, what are you waiting around for? There's almost no time much better than now to get going.