Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Developer
Posts: 153
Registered: ‎10-26-2010
My Device: Bold 9900
My Carrier: AT&T

TextArea usage

Hi,

 

I'm trying to do something similar to  http://www.flashwonderland.com/control-components/textarea.html

but it's not working for me.  I'm not sure what to import to get appendText() and I can get errors like this:

 

Error: Unable to resolve resource bundle "core" for locale "en_US".  Any assistance will be appreciated.

 

Harry

--------------
Accepted PlayBook Applications: Marmi-doos, BASIC, Run and Hide, SuperClip
Accepted OS4-7 SmartPhone App: KeepLightOn
Developer
Posts: 278
Registered: ‎10-27-2010
My Device: Playbook

Re: TextArea usage

[ Edited ]

There are two posts on this forum which can help you resolve that error ( the en_US error ):

 

Tablet-OS-SDK-for-Adobe-AIR/Errors-when-switching-to-Blackberry-SDK-for-existing-project

 

and

 

Tablet-OS-SDK-for-Adobe-AIR/try-Consumer-on-playbook-but-error-when-compile

 

I hope this helps you resolve your error, it did for me. :smileyhappy:  If not, let me know and I will see if I can find more information for ya.

 

--kdittyr

--------------
kdittyr

Accepted PlayBook Applications:
HDB Converter -- Utilities/Calculators
Developer
Posts: 153
Registered: ‎10-26-2010
My Device: Bold 9900
My Carrier: AT&T

Re: TextArea usage

[ Edited ]

 

Hi,

 

Thanks for the help (so far).  That fixed the error I listed.  But when I try to do the appendText() I still get this:

 

Error: Call to a possibly undefined method appendText through a reference with static type mx.controls:TextArea.

 

It's probably something stupid that I'm missing here like using the wrong package on the import line.

 

Harry

 

--------------
Accepted PlayBook Applications: Marmi-doos, BASIC, Run and Hide, SuperClip
Accepted OS4-7 SmartPhone App: KeepLightOn
Developer
Posts: 278
Registered: ‎10-27-2010
My Device: Playbook

Re: TextArea usage

[ Edited ]

Well,according to Adobe livedocs the mx component doesn't have the appendText method and that would explain why you are seeing that error.

 

To see the livedoc page I am talking about just click here:

mx.controls.TextArea

 

However, if you look at the spark component: spark.components.TextArea you should notice that this does have the method you are looking for.

 

Since I am not sure of your experience level I tried to show a complete project.  I also wanted to help out anyone in the future that might find this useful.  If you need any explanations just let me know and I will see what I can do :smileyhappy:

 

<?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"
			   width="220"
			   height="280"
			   applicationComplete="init()">

	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>

	<fx:Script>
		<![CDATA[
			import flash.events.MouseEvent;
			
			// notice I am doing this with mx components, not spark
			import mx.controls.Button;
			import mx.controls.TextInput;
			import mx.controls.TextArea;
			
			// You may wish to make these public instead of private, that is up to you.
			private var ta_story:TextArea;
			private var ti_append:TextInput;
			private var btn_append:Button;

			public function init():void
			{
				// just initializing my components and placing them in the Display List
				ta_story = new TextArea();
				ta_story.name = 'ta_story';
				ta_story.x = ta_story.y = 10;
				ta_story.width = ta_story.height = 200;
				ta_story.text = 'This is a little bit of text that shows up in the text area.';
				addElement( ta_story );
				
				ti_append = new TextInput();
				ti_append.name = 'ti_append';
				ti_append.x = 10;
				ti_append.y = 215;
				ti_append.width = 200;
				ti_append.text = 'Woot...  and this is added to the text above!';
				addElement( ti_append );
				
				btn_append = new Button();
				btn_append.name = 'btn_append';
				btn_append.x = 135;
				btn_append.y = 243;
				btn_append.label = 'APPEND';
				btn_append.addEventListener( MouseEvent.CLICK, btn_append_event );
				addElement( btn_append );
			}
			
			// Simple event handler that 
			private function btn_append_event( e:MouseEvent ):void
			{
				// Adding the text from the TextInput box to the end of the TextArea text.
				// Notice that I included a space before the appended text and concatenated it with the +. 
				ta_story.text += ' ' + this.ti_append.text;
				
				// Now I am erasing the text that was in the TextInput
				// box so I can enter more if I desire
				this.ti_append.text = '';
			}
		]]>
	</fx:Script>

</s:Application>

 

 

--------------
kdittyr

Accepted PlayBook Applications:
HDB Converter -- Utilities/Calculators
Developer
Posts: 153
Registered: ‎10-26-2010
My Device: Bold 9900
My Carrier: AT&T

Re: TextArea usage

Hi,

 

I see your comment on the MXML vs ActionScript thread and that is probably part of my problem as well.  I've just started picking of the rudiments of ActionScript ( I prefer C first, assembly second, java third, all others last) and was trying to get it to work that way.  in ActionScript, all I get is a blank screen.

 

Thanks,

         Harry

--------------
Accepted PlayBook Applications: Marmi-doos, BASIC, Run and Hide, SuperClip
Accepted OS4-7 SmartPhone App: KeepLightOn