AS3 - Removing the blinking cursor in text field - actionscript-3

Can I remove this blinking cursor from a textfield?
Thanks,

Not in a INPUT Textfield.
You can still use some ticks with a Dynamic textfield which listens to KEY_UP events, but you'll have to do all the things by yourself (delete, home key, end key...), and you can forget about things like copy/paste, undo, mouse selection...
It's a tricky way. What can also work, is hide the textfield by setting its textcolor to the background color (so you won't see the cursor), or set its alpha to 0, then copy the text into another dynamic text field on KEY_UP events. Still, it's quite a hack.
Good luck.

Related

Simulate Button Click With Event Change [AS3]

I am trying to simulate button click with event change. It works well but when i type a character in textbox, it calculates. I cant type the word. How can i fix this.
stage.addEventListener(Event.CHANGE, autohesap);
function autohesap(event:Event) {
hesapla_btn.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
}
TextField dispatches the Event.CHANGE every time it's contents are changed (e.g. a new character is entered). As you're adding the Event.CHANGE listener to the stage, the stage is going to pick up all the events of type CHANGE, including the one dispatched by your TextField. I'm not sure if this is the behaviour you're looking for?
If it is, and you "cant type the word", then it looks like it's because your autohesap is changing the stage.focus - when you click on a TextField to write in it, stage.focus is set to the TextField in question - if you manually set stage.focus = null, then the TextField will be deselected and you won't be able to type into any more, until you click it again.
Create a container object to hold all of the 'changeable' objects as children. But leave the textfield out of the container's 'family.' You can still position the textfield anywhere but its events will bypass the container, which will 'hear' events only in itself or its children.

Reset mouse cursor behavior after changing the default value in AS3

`I have a movie clip that I wanted to behave as a button on mouse over and mouse out, so I added a listener to change the cursor to button and arrow in roll over and roll out:
Object(this).my_mc.addEventListener(MouseEvent.ROLL_OVER,overButton);
Object(this).my_mc.addEventListener(MouseEvent.ROLL_OUT,outButton);
function overButton(e:MouseEvent):void {
Mouse.cursor="button";
}
function outButton(e:MouseEvent):void {
Mouse.cursor="arrow";
}
The problem is that after moving the mouse over and out the my_mc and executing this code, the mouse cursor will always be arrow even when rolling over other button symbols. Is like it will only behave according to the last instruction which is the outButton function.
How can I reset the mouse cursor behavior so that it will work normally with selectable text areas and buttons?
Thanks.
You should probably be restoring the Mouse.cursor property to "auto".
Mouse.cursor="auto"
Setting it to MouseCursor="arrow" on roll out means it will always show the arrow.
However, I would recommend removing these event listeners, and setting the buttonMode property of the MovieClip to true.
It's a bit cleaner, and I'm assuming performs better b/c Flash Player manages this without any extra code.

How to Change Text Cursor Color of Text Input Flex 4?

I want to change the blinking text cursor color of Text Input in Flex 4...
How can I change it ?
Is there any way to handle it, or it can be only controlled by Flash Player ???
I had a similar question about this a while ago. I never found a way to update the actual cursor, so I got creative with the solution. My solution was to have two textfields stacked. One input field on top of a dynamic field.
Set the alpha of the input field to 0. Then, add a CHANGE event listener to the input field. In the handler, update the dynamic field and reposition your cursor based on the textWidth.
Not ideal, but it did the job.
I had solved this problem,
Actually there was a problem in skinning of text input.
If we set textinput skin's richeditabletext's alpha to 75 or some down value, flash player makes cursor color white itself.
So by increasing that alpha value, I got the cursor color black.
I change the TextField.textColor = OxFFFFFF, the cursor changes into white as well. Works for my case when I need the same color for the blinking cursor and text.

AS3 Dynamic text box over button

In AS3 I have a button on the stage and above it I create a textbox box dynamically with code.
My problem is that the area that is under the text (i.e. that part of the button) is no longer clickable.
I have set:
tBox.selectable = false;
but that doesn't solve it.
Any ideas
Season greetings,
Luben
Use InteractiveObject.mouseEnabled:
textField.mouseEnabled=false;
If you set component.visible to false it does not interact with the user.
So, if you set tBox.visible = false then it will be invisible and the button will become clickable. Just a thought, but overlapping components is really bad UI design. If you have space on your stage, you should consider keeping them separate
The problem is that text field (despite it's transparent) is lying over button. To make click on button possible you have to be sure that button is in front of text. Take a look at AddChildAt method of DisplayObject. Objects with greater position index are lying over objects with lower position index. So all you need is to make sure that button has greater index:
container.addChildAt(button, 1)
...
container.addChildAt(text, 0)
P.S.: you may embed button dirrectly into text field using html <a href="javascript:..."><img src="link_to_image"><a/> or something like that.

Actionscript 3.0 TextField cursor change when above TextField

My scene has a TextField object.
I set up my TextField as DynamicText because I need to change it programmatically.
How do I prevent mouse cursor change to I-Beam form when it's above TextField?
Also, user of my flash application is able to select text of this TextField using mouse cursor. I would like to disable this behavoiur too.
In the TextField properties panel, there is an icon that reads "Selectable", you need to uncheck it, and you will disable both.
EDIT: The icon is right below the "Anti-Alias" drop down, first in row. There is a Ab (the b is selected/highlighted) inside.
If you want to do this by ActionScript, the code is:
myTextField.selectable = false;
Hope this helps!
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/TextField.html?filter_flash=cs5&filter_flashplayer=10.2&filter_air=2.6
You are looking for the property selectable