AS3 Dynamic Text with Vars - string

I am working on a project with a few dynamic text boxes. I want to have one of the boxes show the variable "frameWeightText" and them "lbs" Here is some of the code:
var frameWeightText:String;
var frameWeight:Number;
frameWeight = 16;
frameWeightText = frameWeight.toString();
base_info.frameWeightBox.text = frameWeightText + "lbs";
The text box only shows "lbs" but not 16 before that.

Your code all looks fine to me, but have you made sure to embed the font you're using? If you haven't, but the text field on the stage has "lbs" already typed in, that would explain only those characters showing up.

David Mear is right. surfaspen you should embed fonts to library and actionscript

Related

Set OpenSeaDragon Viewer Home to "Top" of Image

I'm using OSD to display a few pages from a PDF. Each page is lined up one on top of the other.
I'd like the viewer to start at the top of the image, zoomed to fit. I've played with various settings, but what seems to work for one image of three pages, doesn't work for another image of five. I can get close to what I want with this command:
viewer.viewport.panTo(new OpenSeadragon.Point(.5, .5));
viewer.viewport.zoomTo(1);
But I'll be honest that I don't quite understand what that means, and I have no idea how to set this as the "home" bounds. I've been through the documentation several times, but this escapes me.
Appreciate any guidance!
Rather than using panTo and zoomTo, I recommend using fitBounds instead. You'll want to base it off of the aspect ratio of your viewer so the result is snug. Something like so:
var oldBounds = viewer.viewport.getBounds();
var newBounds = new OpenSeadragon.Rect(0, 0, 1, oldBounds.height / oldBounds.width);
viewer.viewport.fitBounds(newBounds, true);
The true in the fitBounds is to make it snap there immediately instead of animating.

GWT - split string according to the chars physical length (not number of chars)

I have a gwt button that has a fixed size.
I want to present a text on it, and if that text exceeds the button length, I need to cut it short and put "..." in the end. I use the following code now:
if(name.length() > 11){
//limiting the size of the text presented on the button
name = name.substring(0,10)+"...";
}
I have a list of such buttons, and this approach causes that not all button's text have the same size.
The problem is, for example, that 10 chars of "!" are much shorter than 10 chars of "A".
Can anyone help me with a way to solve this issue?
Thanks!
Fast answer. Try ussing HTML5/CSS3 property. It does exactly that:
http://www.w3schools.com/cssref/css3_pr_text-overflow.asp
If you need to do that for non-CSS3 browsers you'll need to make some kind of fake. Maybe setting a button div content, with overflow-hidden, and placing a floating "..." to the right. But it's more difficult...
You could add a style-class to all those buttons and fix their size.
Should be something like this:
First, add the style-class to each button:
Button button = new Button();
button.addStyleName("buttonSizeStandard");
Then add a matching style in the css file:
.buttonSizeStandard{
width: 200px; //change 200 to whatever
}

How do I get tag info from text?

I have written an application using Python 2.7 and Tkinter that edits *.docx files. In the Text control where the user is able to write text, I can change the font family and fontsize with tag_add and tag_config. Now I need to write this to new *.docx file. How can I retrieve fontfamily and fontsize that were set in several of the text ranges?
My best guess is to get tag from range and later try to get font from this, but I'm not sure.
I have just solved my problem myself :)
Maybe anyone will need it somewhen. You can read any applied attribute from a tag. To do this, you have to use tag_cget method:
selectedFont = textBox.tag_cget("tagName", 'font')
Now, when we got the font from specially tag, we can get from it other attributes by the same way:
fontFamily = selectedFont.cget('family')
It works! ;)

LWUIT display bold text + normal text

I need to display some Rich-Text in LWUIT.
I was thinking of HTML Component, but I can't get linewrapping there - probably an error on my side.
Another idea would be to use TextAreas or Labels and do it manually.
I'd need the possibility to have bold words in a non bold sentence.
Hello, this is a bold. <- This dot shouldn't be bold.
Is there a way I can achieve that? I think I only can use one Font per Component...
Use a Container with flow layout and just place labels into it. This is what the HTML Component does internally.
Try com.sun.lwuit.html.HTMLComponent class. Use it like,
HTMLComponent htmlComp = new HTMLComponent(null);
htmlComp.setBodyText("<b>Hello</b>, this is a <b>bold</b>. <- This dot shouldn't be <b>bold</b>.");
form.addComponent(htmlComp);
This component will allow you to use html tags inside text. For more information, refer this link: HTMLComponent

display an extrafield over product image with virtuemart when typed by user (something like tshirt designer)

i need to display an extrafield (virtuemart standard attribute) on flypage over the product image.
I need it as a "customization print option" to display what user want to write over product!
I need the field under other extrafield (as it is normally), but let it appear over image only when user write on it! Is it possible?
Or is there some other solution for this?
Here's the example:
I'm using:
Joomla V 1.5.14
Virtuemart V1.1.6
code are welcome, i'm not so expert!
thank you
The first solution that comes to mind is to use Mootools (since VM already loads it) to update a blank div that you position over the top of the image. This is a built in function in Mootools.
http://mootools.net/docs/core/Element/Element#Element%3areplaces

Resources