Getting length of text selection AS3 - actionscript-3

How could I get the length number of a input text selected?
Like, if the text has 2 characters selected, then, it would return me length 2.
Is that possible?
Thanks.

Use textfield.selectionBeginIndex and textfield.selectionEndIndex to count chars currently selected.
var selected:int = field.selectionEndIndex - field.selectionBeginIndex;
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/TextField.html#selectionBeginIndex

Related

How to sum 2 text boxes into a 3 text box on form

I am trying to get the value in textboxA (text) + value in textboxB (text) to populate in textboxC (number).
In control source expression builder for textboxC I have:
=[TextboxA]+[TextboxB]
I have also tried:
=Nz([TextboxA],0)+Nz(TextboxB],0)
I found the above on this site but it is not working because if I enter 1 in textboxA and 2 in textboxB then textboxC shows 12.
I am using Access 2016.
Either change the format of your textboxes to General Number or convert the text content to a number using the Val function, e.g.:
=Val(Nz([TextboxA]))+Val(Nz([TextboxB]))

Retrieving value including input mask from TextBox field - Access VBA 2016

I have an input mask of JAAA-AAA on a TextBox, so when the user enters that input field, they will see this: "J___-___".
However, when they fill it out like so, J123-321, and I get the value using [myfield].Value, it says that the value is only 123321. It strips the preset 'J' and '-' I had in there. How can I prevent the stripping of these characters when I retrieve the value from this field?
You need to set the second part of the input mask property to 0.
If you look at the documentation, you can see it has 3 parts, and the 2nd part controls if the mask is stored with the data, or only the data is stored.
The final mask property would be the following:
\JAAA\-AAA;0;_

Percentage SSRS

I have two text boxes in my SSRS report.
The Total Number is simply - =COUNT(Fields!CommunicationId.Value)
The First Call Resolutions = =SUM(Fields!FirstCallResolution.Value)
The FirstCallResolution simply has a 1 for when it is a first call resolution and a 0 when it is not.
What would the expression be to get this to show the % correctly in SSRS?
Thanks
Edit : format code
You can do calculations in your expressions. Try
=(SUM(Fields!FirstCallResolution.Value) / COUNT(Fields!CommunicationId.Value)) * 100
If you looking for a precision and a percentage representation., you can also write the below expression in the text box where you want the result to be displayed.
=(SUM(Fields!FirstCallResolution.Value) / COUNT(Fields!CommunicationId.Value))
You can then do a custom formatting for this text box in the Text-Box properties.
Right click on Text Box --> Text Box Properties --> Number-->Custom, and enter P1 or P2 or P3 and so on for number of decimal places after the decimal point.
You can also use the Round function in your expression. With this function =ROUND(...,1) you'll get one number after the decimal point. If you want two numbers after the decimal point then use 2 instead of 1, and so on.
=Round(((SUM(Fields!FirstCallResolution.Value) / COUNT(Fields!CommunicationId.Value)) * 100),1)
Try =FORMAT((SUM(Fields!FirstCallResolution.Value) / COUNT(Fields!CommunicationId.Value)),"P")

how do I change a lookup value to whole a number in ssrs?

How do I format a number with 2 decimal places to a whole number?
I used the Lookup function to get a result, but formatting decimal to whole number does not work for this value. I did Text box properties -> number -> whole number doesn't work for one of my value. Also customize number to #,### but its not changing anything.
How do I make this value display as a whole number?
You may be confusing how the number is displayed (which can be controlled using text box properties) and it's actual value. It sounds like the value returned from the lookup is not a number, it might be a string/text value instead which would explain why it was not affected by number formatting.
One option is to convert the value to an integer (whole number) in the lookup expression itself, using a function to convert the value: CInt()
For example if your expression currently looks something like this:
=Lookup(Fields!SomeField.Value, Fields!SomeDatasetField1.Value, Fields!SomeDatasetField2.Value, "SomeDataset")
then you can change it to:
=CInt(Lookup(Fields!SomeField.Value, Fields!SomeDatasetField1.Value, Fields!SomeDatasetField2.Value, "SomeDataset"))
Or if you want to keep the original value, but just change how it is displayed then convert to a decimal value instead:
=CDec(Lookup(Fields!SomeField.Value, Fields!SomeDatasetField1.Value, Fields!SomeDatasetField2.Value, "SomeDataset"))
and then use the text box formatting options to control the displayed format.

Defining input text as a number input in Flash

So, when I'm building an application in Flash and Actionscript 3.0 I create a sharedobject.data and I have an input field, the sharedobject is equal to the input field.But it's only restricted to numbers, but when the input is put in the number is thought to be text.. rather than an actual number (eg. "1" instead of just 1) is there anyway that I can make an input field into something like a number field?
Have you tried:
var variable:Number;
variable= Number(input_txt.text);