Text doesn't change on frame 1 - actionscript-3

Hi I'm new to flash programming so please bear with me if this sounds like a bit too junior a question to someone in the Flash area.
I've dragged a Text Tool from the panel to Stage and named the instance "status". Then I typed in "ABC" into the Text Tool. In frame 1 on the timeline I typed in the following code:
status.text = "Hello";
status.color = 0x0000FF;
The problem is that text in the status doesn't seem to change and remain "ABC". The color also doesn't change to the specified one, although if I delete the second line of code, I wouldn't be able to see the text at all (it seems the color gets to white which is the same as the background?)
Could someone please give me some guidance?
Thanks,
Jack

Changing color of dynamic text in flash cannot be done using "color" instead use "textColor"
status.text="hello"
status.textColor=0xff0000
This will also solve your problem of the text not changing
I hope I answered your question :)

Related

Adding an info label to my image

Im not entirely sure what this is actually called which is probably why I havent been able to find help elsewhere.
Basically when I hover my mouse over my image I want it to tell me what it is, for example tell me that, the image is the delete button.
"<td><a href=$del><img src=\"del.png\"></td>";
This is working fine no issues with what I want it to do. Just want a bit of info about what its doing when mouse is over the image?
Thanks
You can use "title" attribute, example:
"<td><a href=$del><img src=\"del.png\" title='EXPLANATION HERE'></td>";
In this case the text "EXPLANATION HERE" will appear when the mouse is over the image.

Text not appearing on textfield

To appear softkeyboard for android app i written textfield.needsSoftKeyboard = true and onclick on textfield call textfield.requestSoftKeyboard() method. keyboard is appearing..but the problem is text is not appearing on textfield...
It would make sense if you could post the code snippet here for further investigation. Other than that, it might be that your textfield loses focus for some reason so you may get your issue resolved by calling "stage.focus = textfield;". It could also be the case that there is a problem with font embedding or styles (e.g. white text on white background). Make sure the textfield shows text at all by passing a prefilled text to it. There is currently also a bug, where Chinese and Japanese chars cannot be displayed on some Android devices (https://bugbase.adobe.com/index.cfm?event=bug&id=3839647).
Problem is textfield loses focus.Finally I got solution.We have to set Focus for that tlf textfield like this.txtField.textFlow.interactionManager = new EditManager();
txtField.textFlow.interactionManager.selectRange(0, 0);
txtField.textFlow.interactionManager.setFocus();

Looking for an addon to automatically select all instances of selected word in the current page

I am looking for an addon to install so that when you select a word in a webpage ( by clicking) it automatically highlights all the instances of that selected words in that text. There used to be this
highlightall addon but it no longer works for recent version of Firefox! It was ver handy as all you had to do is to select that word and all instances get highlighted
Such an addon would be very helpful when reading a code as you can simply select a variable name and it would select everywhere that variable has been used in the code so you could understand the program better.
Ok man I made the addon and released it at AMO. I called HiliteOnSelection I linkified it.
Use it tell me how it works tell me how you would like to change it etc. I appreciate feedback.
More than 50 bounty would have been nice too, a side effect was I learned a lot so it's cool.
If you press ctrl+f and then click highlight all it will do it.
If you want to copy it heres the code for highlihgt all:
function toggleHighlight(aHighlight) {
if (!this._dispatchFindEvent("highlightallchange"))
return;
let word = this._findField.value;
// Bug 429723. Don't attempt to highlight ""
if (aHighlight && !word)
return;
this.browser._lastSearchHighlight = aHighlight;
this.browser.finder.highlight(aHighlight, word);
}
here it is on mxr
if you need more help let me know
Well, my code is quite complex because it performs several advanced services, but if you're asking how to highlight a word of text, the easiest way is to add a style attribute around the word. For example:
This hot dog needs more mustard.
... would become...
This hot <span style="color:#FFFF60">dog</span> needs more mustard.
The above would highlight "dog" in the sentence. The above assumes white text on black background, where yellow is a good highlight color. If the text is black on white background, that #FFFF60 should probably be something like #40FFC0 or #40FF40 or #4040FF or whatever you find looks good.
When you want to remove the highlight, you can delete the <span> element. In my case I usually put the style="color:#FFFF60" in some other existing element, so I don't delete the element to remove the highlight, I delete the style attribute I added to the element.
By the way, the reason I change text color to highlight terms is because that does not change the size of the word, and therefore the text never reflows (and screws up formatting). You could probably change background color to highlight, but I never tried that.
To find all instances of a certain word, I don't know, but probably the TreeWalker is part of the solution.
Ok C Graphics man here's the code
Ok its real easy you don't even have to write another function. Here's the code to highlight any word in the current tab.
gBrowser.selectedTab.linkedBrowser.finder.highlight(true, 'YOUR_WORD_HERE')
if you want to unighlight then set the first argument to false.
You can do this in any tab just have to supply the browser element within the tab.
like this code here will highlight everything in the first tab:
gBrowser.tabContainer.childNodes[0].linkedBrowser.finder.highlight(true, 'YOUR_WORD_HERE');

how to change text vertical offset in textfield as3

Hello.
Is there any way to discover how big is vertical offset in text field(red line, place beetween begining of text field and start of text). Can I also change it ?
Thank you for advice
There is no way to measure this distance. Maybe TextLineMetrix can help you little. Check this document:
textLineMetrics reference
Also you can use textHeight property of text field.
you can trace a comparison between the property textHeight and textField.height that may tell you the difference.
if you want to adjust it manually a work around may be in order such as creating a Sprite that holds the graphics of your box, or border like you have displayed, then imposing a textField on that which you can place by its coordinates.

TextField input not working

I am working on a class similar to the standard text field. I actually use the default TextField inside it. My only problem is that the textField does not work correctly. If I set it to textField.type = TextFieldType.INPUT, I can delete the text, but I can't enter new text. Also, the cursor is not being displayed. This is my Class (part of it): http://pastebin.com/LsgQjxpa
The skin is like this: http://pastebin.com/yDhEGHLm
I can't figure out what exactly I am doing wrong. I also have to mention that I am compiling for AIR Mobile and testing directly from Flash Builder
One problem appears to be that you have set the selectable property to false. This makes sense when type is TextFieldType.DYNAMIC. However, it's problematic when the type is TextFieldType.INPUT.
When you disable selection of the text, no cursor is displayed. I am able to still edit the text. However, since the cursor is not visible I cannot change it's position and the text gets added in front of any existing text.