ByteArray.readUTFBytes() and TextInput.text
Hi all,
I'm working on an Adobe AIR program that allows users to store a username/password in the encrypted local store. Upon application launch, if a stored username/password exists, I want to populate the corresponding username/password text inputs (so the user only has to click the "Login" button). In order to do this, I must get the username/password from the encrypted locat store as ByteArray objects, then call readUTFBytes() to get them into String form.
This is where something very peculiar is happening (perhaps a bug in Flex). If I try to set the text input's text value directly equal to the readUTFBytes() call, the text input remains empty:
var usernameByteArray:ByteArray = EncryptedLocalStore.getItem('some-username');
usernameInput.text = usernameByteArray.readUTFBytes(usernameByteArray.bytesAvailable);
However, if I create a separate string and set that equal to the readUTFBytes() call, then set the text input's text value equal to this new string, then the text input has the desired string:
var usernameByteArray:ByteArray = EncryptedLocalStore.getItem('some-username');
var storedUsername:String = usernameByteArray.readUTFBytes(usernameByteArray.bytesAvailable);
usernameInput.text = storedUsername;
What the hell?
hi
i guess that its a casting issue (ie: it doesnt know that usernameByteArray.readUTFBytes(usernameByteArray.bytesAvailable) is meant to be a String)
your solution is correct, but it can be shortened to one line by casting directly as a String.
change this:
var storedUsername:String = usernameByteArray.readUTFBytes(usernameByteArray.bytesAvailable);
usernameInput.text = storedUsername;
to this:
usernameInput.text = String(usernameByteArray.readUTFBytes(usernameByteArray.bytesAvailable));
Similar Messages
-
How to persist TextInput text values?
Can anyone provide a brief explanation of how to persist text
values?
Description:
Stuff written into a TextInput field does not persist when
moving
to another frame, and back again.
Example:
Frame 1: Put a TextInput component on the stage.
Frame 1: Put a "forward" button on the stage.
Frame 9: Put a "back" button on the stage.
Frame 1 actionScript:
this.btnForward.onRelease = function() {
gotoAndStop(9);
Frame 9 actionScript:
this.btnBack.onRelease = function() {
gotoAndStop(1);
Play it.
Write something in the TextInput.
Click the forward button. (this takes it to Frame 9)
Click the back button. (this takes it back to Frame 1)
>> The TextInput field is blank.
Hoping someone can help,
Thanks,
Johnquote:
Originally posted by:
JohnKirk
Hi,
Thanks for your quick reply!! -- still have a problem, as
follows: Value gets set to "undefined" upon return.
Can you go into just a little more detail about "where" the
variable should be created, and "when" it should be populated and
read?
Details:
Frame 1:
1) I declare a variable in Frame 1, and initialize it to
null:
"var myStr:String = "";"
That seems reasonable (thoug technically you set it to an
empty string and not to null, but the empty string is better in
this case)
quote:
2) I save the value in the btnForward.OnRelease function:
"myStr = Ti.text;"
when using the button this way you would have to use
"this._parent.myStr = this._parent.Ti.text";
as the scope in buttons behaves different if you put the
action directliy on the button (flash 5 way) or if you do it your
way.
quote:
3) I add a line to set the TextInput text: "Ti.text = myStr;"
4) When I Play it, Ti is empty. I type in words, and click
forward (moving to Frame 9). Then I click back (moving to Frame 1).
Ti shows "undefined".
Thanks for your patience,
John
I hope that helps.
[I have to put my kids to bed now, so it'll be a while before
I can help if it won't work as I expect.
Anybody else also is very welcome to help ;-) ] -
I wish to use VBA and Excel to programmatically open numbered Dreamweaver HTML (CS5) and find and replace text in the code view of these files, save and close them.
I have 5000 associations between Find: x0001 and Replace: y0001 in an Excel sheet.
I have the VBA written but do not know how to open, close and save the code view of the ####.html files. Please ... and thank you...
[email protected]This is actually the code view of file ####.html that I wish to find and replace programmatically where #### is a four digit number cataloguing each painting.... In 1995 I thought this was clever... maybe not so clever now :>)) Thank you for whatever you can do Rob!
!####.jpg!
h2. "Name####"
Oils on acrylic foundation commercial canvas - . xx X xx (inches) Started
Back of the Painting In Progress </p> </body> </html>
Warmest regards,
Phil the Forecaster, http://philtheforecaster.blogspot.ca/ and http://phils-market.blogspot.ca/ -
i have an Iphone 4S and the text i send to a friend with a galaxy 4s he is not receiving. Any help?
Then it's sending as SMS and not iMessage (that's good) so deleting the contact probably didn't help. It also seems iMessage isn't redirecting his texts as he's not used and apple device on the account previously. Can he receive a picture message from you instead? Does he receive texts from other apple devices? (iPhones,pods/pads) try sending a text through Verizon online using your account on a web browser. If it is also blocked then it confirms the issue is with his device, well at least points you there rather than guessing if it's yours or his or both. There's some ideas, let me know- Joe
Sent from my iPhone -
my Iphone can call ut and receive text/email messages but is not receiving incoming calls. What is your thought?
Hi Baileyfour,
Welcome to the Support Communities!
The articles below may be able to help you with this issue.
Click on the link to see more details and screenshots.
iPhone: Can't hear through the receiver or speakers
http://support.apple.com/kb/TS1630
There are two places where vibrations can be set.
One is the Settings > Sounds
The other area is Settings > Notifications
If you have an app set to Alert, it may have a vibration set for it.
iOS: Understanding Notifications
http://support.apple.com/kb/ht3576
Information about Notifications settings can also be found in the iPhone User Guide (pages 131, 132)
http://manuals.info.apple.com/en_US/iphone_user_guide.pdf
I hope this information helps ....
Have a great day!
- Judy -
Anchor tag error, also copy and pasting text comes up "null"
After the recent update I am receiving anchor tag errors telling me to start with an alphabetic letter, which I was. Also no longer lets me copy and paste text onto a page, instead it says "null". Any ideas on a fix ?
I don't see a closing </body> tag in your code. There's an opening tag, but no closing tag, hence unbalanced.
^_^ -
My iphone 4S stopped receiving and sending text messges. Help!
My iphone 4S stopped receiving and sending text messges. Help!
Hi J.A. Curie!
Here is an article that can help you troubleshoot this issue:
iOS: Troubleshooting Messages
http://support.apple.com/kb/ts2755
Thanks for coming to the Apple Support Communities!
Cheers,
Braden -
Difference in a string and the text retrieved from JTextBox
Hello,
I am facing a peculiar problem. Please see the following code fragment:
m.replaceAll(";\ngo;);
where m is a matcher. This is working fine. But whenever I am doing
m.replaceAll(myTextBox.getText());
and placing ";\ngo;" in the text Field is not working as before. This is because that getText() returns a string in text form(doesnot take the newline into consideration). Any idea how to solve this?
Regards,
SauravHere is the following code:
File fin = new File(file);
File fout = new File("C:\\Temp\\temp123.txt");
FileInputStream fis = new FileInputStream(fin);
FileOutputStream fos = new FileOutputStream(fout);
BufferedReader in = new BufferedReader(new InputStreamReader(fis));
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(fos));
Pattern p = Pattern.compile(find);
Matcher m = p.matcher("");
String aLine = null;
while((aLine = in.readLine()) != null) {
m.reset(aLine);
String result = m.replaceAll(replace);
out.write(result);
out.newLine();
in.close();
out.close();
What I intend to do is that the user will provide a fileName from the GUI and also the text to find and the text to repalce with. Both of them will be in a JTextBox. Now
suppose I want to replace ";" in the line "Hello;" with ";\nHow are u?" so that the line looks like
"Hello;
How are u?"
But what is happening is that the line looks like
"Hello;\nHow are u?" after replacement.
This happens because getText() doesnot considers that as a special character...
I tried to harcode the replace string and it worked perfectly....
Thats the problem.....I need the same behaviour with getText().
Regards,
Saurav -
Sending Email using both HTML and plain text
I could use some advise on how to start researching email for
both HTML and plain text messages.
I have a script called class.phpMail.php, but the code is
alittle advanced for me. Basically I can't get
it to work on my server and I don't know where to begin the
learning process here.
I talked to my provider, "HOST" company goDaddy.com and I was
told that to connect so that I could send email I would need this
line of code. They didn't say it should by in my php.ini file but
that was where I found it.
SMTP = relay-hosting.secureserver.net
This is the smtp address that my provider uses to make the
connection with my mail client.
I was told that with this line of code I would not need a
password or username
I did some further reseach and I found an article that stated
that my original error:
Warning: fsockopen() expects parameter 2 to be long, string
given in ...../php/class.smtp.php on line 105
was being caused by this code because the $port value needed
to be between 1 - 65365:
$this->smtp_conn = fsockopen($host, # the host of the server
$port, # the port to use ----- "this is line 105"
$errno, # error number if any
$errstr, # error message if any
$tval); # give up after ? secs
In particular the $port value was coming in corrupted and
that I needed to cast it.
I did as they suggested and made it an (int) as they
suggested.
$this->smtp_conn = fsockopen($host, # the host of the server
(int)$port, # the port to use
$errno, # error number if any
$errstr, # error message if any
$tval); # give up after ? secs
It resolved part of the error message however, the other half
of the error message is shown below:
Message could not be sent.
Mailer Error: Language string failed to load: connect_host
What exactly is the connect_host they refer to in this
message?
Would it be the string in my php.ini file refering to the
SMTP = relay-hosting.secureserver.net
I have allot of what I think are disconnected questions as I
really have just begun to work
with the mail() function. If anyone has the time to educate
this newbie into the wonderful
world of email() I would appreciate it.
Thank You
Kevin RaleighSorry to dig up an old post, but we've spent the last few days trying to work out why an email campaign being sent from BC is going into the Junk folder of recipients that use MS Exchange. We've fixed quite a lot of issues, including the fact that Legacy Templates have random JS injected just before they get sent, so we had to switch to the new template system. We've narrowed the issue down to one of three things:
1. A missing alt tag on the tracking image that BC drops into the email (pretty unlikely)
2. The BC Europe IP (54.240.14.45) is blacklisted here: UCEPROTECTL2 (possible, but if you actually look it's not the IP itself, but another IP on the same network, so unlikely)
3. The fact that the HTML email has no text component.
I agree, BC is late on this but I think that it needs to be added, even if most users have HTML-ready email clients, spam checkers do seem to prefer multi-MIME emails.
This is backed up by the following SpamAssassin rule, which we are currently unable to resolve:
-1.105
MIME_HTML_ONLY
Message only has text/html MIME parts
You should also include a text version of your message (text/plain)
So in my opinion, BC do still need to add this as a feature, otherwise the system is not viable for our customers and we'll have to look elsewhere. -
Problem with focus and selecting text in jtextfield
I have problem with jtexfield. I know that solution will be very simple but I can't figure it out.
This is simplified version of situation:
I have a jframe, jtextfield and jbutton. User can put numbers (0-10000) separated with commas to textfield and save those numbers by pressing jbutton.
When jbutton is pressed I have a validator which checks that jtextfield contains only numbers and commas. If validator sees that there are invalid characters, a messagebox is launched which tells to user whats wrong.
Now comes the tricky part.
When user presses ok from messagebox, jtextfield should select the character which validator said was invalid so that user can replace it by pressing a number or comma.
I have the invalid character, but how can you get the focus to jtextfield and select only the character which was invalid?
I tried requestFocus(), but it selected whole text in jtextfield and after that command I couldn't set selected text. I tried with commands setSelectionStart(int), setSelectionEnd(int) and select(int,int).
Then I tried to use Caret and select text with that. It selected the character I wanted, but the focus wasn't really there because it didn't have keyFocus (or something like that).
Is there a simple way of doing this?textField.requestFocusInWindow();
textField.select(...);The above should work, although read the API on the select(...) method for the newer recommended approach on how to do selection.
If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)",
see http://homepage1.nifty.com/algafield/sscce.html,
that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
Don't forget to use the "Code Formatting Tags",
see http://forum.java.sun.com/help.jspa?sec=formatting,
so the posted code retains its original formatting. -
I can make calls and send texts on my new iPhone 5, but all incoming calls and texts are received by my old (non-Apple) phone.
Basic troubleshooting from the User's Guide is reset, restart, restore (first from backup then as new). Try each of these in order until the issue is resolved.
-
Is there a software in which I can hook up my iPhone 4s to my computer and send and receive text messages and calls (via headset) through my computer? Whether it's free or cost money, can someone please give me a name of a program or software that allows me to do this? I can't seem to find anything like this for the iPhone.
No.
-
Applescript: open Pages doc from Templete, change filename and replace text
Hi!
I just got started with applescript and i want a script that does the following:
1. open "choose from list" dialog to choose the topic of my document
from 4 possibilities (here for example A, B, C, D)
2. open document from TemplateXY
3. set document name with date and topic (dd.mm.yyy) "16.02.2011 - A"
4.inside of document: replace text "date" with the currend date (dd.mm.yyy)
and the text "topic" with the topic chosen in (1.) "A"
this is what i already did:
here as colored screenshot:
http://i55.tinypic.com/2mnhxkm.jpg
set datum to do shell script "date \"+%d.%m.%Y\""
--choose topic:
set chosentopic to choose from list {"A", "B", "C", "D"}
--text "topic" becomes replaced throug variable topic
set searchstringT to "topic"
set replacestringT to chosentopic
--text "date" gets replaced by currend date (variable datum)
set searchstringD to "date"
set replacestringD to datum
--open pages, define filename & do search&replace of the strings defined above
tell application "Pages"
activate
set DocName to datum & " - " & chosentopic
set (every text where it is searchstringT) to replacestringT
set (every text where it is searchstringD) to replacestringD
end tell
the "choose from list" dialog works and the variables like topic, datum and the search&replace strings get defined as well
my problems are:
i only get an error that the text could not be replaced
i dont know how to get a new document from a template and how to get its filename changed
i really just started doin things with applescript for a day so i hope you can help me
regards
DaNylz
Message was edited by: DaNylzTry something like this:
set myFoundItems to change text text of all page items of pages 3 thru 5 of document 1
Shane Stanley <[email protected]>
AppleScript Pro Sessions <http://scriptingmatters.com/aspro> -
SAP SCRIPT Header text and Item text not printing in customized PO
Hello Experts,
I have copied the standard MEDRUCK to ZMEDRUCK and customized the form according to the requirement.
I want to print the header text and Item text in my form.
For Header text I have used :
/: INCLUDE &EKKO-EBELN& OBJECT EKKO ID F01
Problem 1: The text what I enter in header text is flowing only when I hit on print preview without saving the form. Once I save the SAP SCRIPT and click on print preview the field is appearing blank. I also tried to print the form, but the field is appearing blank even on the print out.
Problem 2: For item text the field is concatenation of EBELN & EBELP. Can anyone suggest me how to concatenate and fetch the text in item text.Hi,
Im getting an error in my subroutine pool for i_xtline which is to fetch ITEM TEXT., It says its not a in any internal table nor defined as data. How can I proceed further. I have pasted my code below. Please check and revert ASAP
PROGRAM ZMEDRUCK_SUBP1.
TABLES: EKPO, EKKO.
FORM fetch_table_data TABLES in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
data xname like THEAD-TDNAME.
data i_xtline like xtline.
clear i_xtline.
refresh i_xtline.
CONCATENATE EKPO-ebeln EKPO-ebelp INTO v_item_text.
MOVE v_item_text to ITEMTXT.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
id = F01
language = EN
name = ITEMTXT
object = EKPO
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
HEADER =
tables
lines = i_xtline
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. -
ADOBE: How to print a table only on uneven pages and a text on the back?
Hi, I am looking for a clear document on how to use pagination and the Odd and Even pages.
We need to print a table over several pages, but the table should only appear on Odd pages. The even pages should be skipped. On the even (back) pages we need to print "Terms and Conditions". Is that possible? Can it be done without scripting?
We are using ADOBE version 8.1
In the file properties, double sided is switched on, and version set to 8.1 and higher.
I created two Master pages, a FrontPage with ContentArea1and a BackPage with ContentArea2.
FrontPage is used for uneven pages, BackPage is used for the even pages. The masterpages are printed correctly (alternating properly).
One page was created for the table, totals etc.:
ITEMS: contains item data (table with header and footer). Place is "On Odd Page". After "Goto page BackPage", so there is always one page with the text. And if the table needs to be paginated it goes to BackPage with overflow leader "Conditions".
What should happen is that on the front pages the item table is printed. If there are too many lines then it should continue on page number 3 then 5 etc. All the even pages should display text only.
What actually happens is that the item table also gets printed in the content area for the Condition text...
The best I could achieve is to decrease the contenta area of the back page. To force pagination. But still it prints one table record in the (very small) content area of the back page before paginating to the next page (front page again). If it only would not do that, it would be fine.
Cheers,
Edwin.Fixed it... After a lot of creating, deleting, playing around with pagination and the inevitable cursing...
I have created 5 pages:
1. FirstPage
- Odd/Even: Odd (Front) Pages
- Placement: First page (In page set)
2. FrontPage (For Odd pages)
- Odd/Even: Odd/Front Pages
- Placement: Rest of Pages
3. BackPage (For Even pages)
- Odd/Even: Even (Back) Pages
- Placement: Rest of Pages
4. LastPage
- Odd/Even: No Odd/Even Restrictions
- Placement: Last page (In page set)
5. DummyPage
- Odd/Even: Blank pages
The 'Terms and conditions' are located on the BackPage and LastPage (as a text).
The table that is printed is (of course) located on a normal page (flowed subform).
Pagination tab: Placement = Following previous, and After = "Continue filling parent". No overflow... Basically, it's all default.
The table lines will now start on the first page and if there are more lines than can be printed on this page, it will continue in the next content area. That will be on the FrontPage.
The trick is that each master page must have a content area (mandatory). Except for Blank pages, but these cannot be used... Blank pages would only be used once, after the first page.
What I discovered is that you can drag a content area away from the Master page and attach it to a different master page.
Logically, if there is no content area on a page, then data cannot be printed there. So, I created a Dummypage. On this page I dumped the content areas from the LastPage and the BackPage. As a result, content cannot be printed anymore on the back of pages. Only the standard text (a text field) is printed there. When the data from the table is overflowing, it will automatically overflow from the FirstPage to the next content area. Which is located on the FrontPages only.
The DummyPage is NOT used anywhere.
The result is that the records can only be printed on the content areas that exist on the First and Front pages. The back pages are now skipped.
Duplex printing is now working correctly, and the text is printed on the back of all the pages.
Cheers,
Edwin.
Maybe you are looking for
-
Kernel panic/hard drive crash
Preface: I am attempting to recover about a weeks worth of slaving on my masters thesis, that I thought I had backed up but in deed did not. My computer had a kernel panic while I was using ms word, and the hard disk appears to be the issue. I cannot
-
Language display to particular customer
Hi ALL, I created sapscript for billing document using the standard form RVINVOICE01. for a customer sales order will be created, then delivery will be created and finally billing will be done. suppose if i have some three customers such as A1, B1
-
How to Group Invoce Qualtity in SD by Month based on Billing Date
Hi, I have Invoice quantity in a cube whcih I want to group monthwise. For example : Material Billing Date Invoiced Quantity Material 1 Jan-15,2007 100 Material 1 Jan-20,2007 50 Material 1 Jan
-
When in use my phone makes a quiet buzzing noise coming not from the speakers but the actual phone. It does not do it all the time but it is quite frequent, my phone is an iPhone 5. Please can you tell me what the problem is?
-
Firewire target Disk mode-accessing second hard drive
When linking two computers in Target Disk Mode I find that I can only access the boot drive. In the computer that I'm accessing there are two drives. Is there any way to access the second drive?