ActionScript 2.0 :: Scale Font To Fit Width?
Dec 17, 2009How do I scale text like this? [URL]
(the blog post titles)
How do I scale text like this? [URL]
(the blog post titles)
Is there a function or property or better way to do what the following code do?
var width:int = 20
while (textField.defaultTextFormat.size > 1 && textField.width > width) {
textField.defaultTextFormat.size--
}
I have built a very simple Flash gallery in CS4 using AS2. It calls the images from an XML file and works great. The problem is that the captions underneath the images are in a fixed width text box. They look fine underneath horizontal images, but I want to have the text shift in when a vertical image is loaded, and is narrower.
View 3 RepliesI have a strange and extremely annoying problem.I have a simple would-be navigation bar that works perfectly with this code:
Code:
import gs.TweenLite;
var buttons:Array = new Array();
var btnProps:Array = new Array();[code].....
It takes the 5 items in the menu and when they are individually moused-over, they simple move 10 points to the left, then when the mouse is off they move back to their original position.Now I want to change it so that they scale up a tiny bit in both width and height. I've been trying to do this for some time and I have no idea why this code does not work:
Code:
var _rect:Rectangle = new Rectangle(_btn.x, _btn.y, _btn.width, _btn.height);
btnProps.push(_rect);
}[code]...
Everything in these two versions is EXACTLY the same except for this part I've posted.
if i was to make a flash website is there a way that i could have it scale the width to fit the browser, and scale the height so that it keeps the same aspect ratio and doesn't stretch the contents out of proportion?
View 3 RepliesI have a sprite in as3 code, I want to enter its height to resize it, how can I scale the width accordingly?
sprite.height = 200;
sprite.width = ??
I have a dynamic layout, where an image is loaded into an HBox:
<mx:HBox ...>
<mx:Image height="100%" .../>
</mx:HBox>
[code].....
If I have a rectangular shape under some angle, 45 or similar, how could I tween its width or height so that it scales with that angle?
View 0 RepliesI managed to scale a movie clip's width with easing.With this code:
onClipEvent (enterFrame) {
endWidth = 50;
_width += (endWidth-_width)/speed;
[code].....
My website is going to have a main wrapper that is set to a max-width property for compatible browsers. It will stretch to 940px across at max. When scaled down I would like the swf to scale proportionately with it. Like an image with width percent applied. The flash movie has the dimensions of 940 × 360 pixels.
I can't seem to figure out the correct attributes to add to the embed tag to get it to do this.I am currently using jquery flash embed, but am open to other options, though this is my ideal.In the example I have set the flash background to black.
When resize the browser window the flash movie doesn't scale proportionately to the div, only the photo does, leaving a blank canvas (black), while the div height stays the same. I can't add a height value in the CSS.How do I make this scale correctly? Adding a noscale param only crops the image. The swf's height doesn't scale also.
Does anyone know how I can retrieve the "ORIGINAL" stage height and width that was set during compile of an Air/Flash ApplicationI have set the Application to compile to 1920x1080;I have stage.scaleMode = StageScaleMode.SHOW_ALL;and stage.nativeWindow.maximize();But when I trace stage.stageWidth I get 1280 which is the resolution of the screen.I was hoping to get the 1920.I cannot use stage.width or stage.getBounds(stage) because this returns 6000. Due to items being masked off screen.
With the stage.stageWidth being the screen resolution, I was hoping I could use that and mathematically work out the original using stage.scaleX. but even with SHOW_ALL scaling the entire application, stage.scaleX returns 1EDIT: I know what "Show all" does, you do not need to tell me about it.I also know what stage.width and stage.stageWidth do, but stage.stageWidth is returning what I believe is incorrect in this example and need an alternative.
How does flash scale for fullscreen?For example, if I draw a shape and give it a width and height of 100px (square)...does that scale up proportionally when the flash is made full screen? Or does that object stay 100px x 100px?
View 2 RepliesSo I've got one more problem because the font size limit on 127px I need to scale my dynamic text so it can be bigger. So here the code I tought could work:
this.createEmptyMovieClip("text1_mc",1);
[Code]....
Is there anyway (with action scripting) when having a Flash Video set to Expand to 100% Width and Height to have certain elements within that video maintain their inherent size and not scale ?URL...Notice how the BG Scales, but the video in the center does not nor does the footer. Is this performed with CSS and using multiple DIVs with varying Z Indices.
View 4 RepliesI am seeking the answer form the brain trust at FK. I am making a quick flash movie.. which has an 'lcd screen' display.. that needs to have numbers/timer being displayed on it..
I have found a few of these LCD/CALCULATOR font types.. and thought I had one that would work.. but it does not. I need a fixed width font..(in hopes) so that when I animate it..
00:00
00:01
00:02
00:03
00:04...etc
will keeps it positioning! and NOT change 'alingment' when (say) a 0 becomes a 1. this shifts the whole textField. my questions are:
1.) is there a fixed width type font or other trick? (using the spacing or A/V parameter) to keep the characters in their positions? or will I need to break everything up and use individual text fields..and parse/split the numbers from the string?
I have some dynamic text with a background box that needs to widen to match the width of the text, this is how I am doing it at the moment, by multiplying by the average pixel width of arial. However it doesnt seem to be that accurate
Code:
_root.caption1.textbg._width = _root.caption1.words.length*7.5
Is there a way to determine what the width of a Text Field should be if the string length and the font size are known. I realize that every font have different letter size but don`t know how to get to that value
View 3 RepliesI have a movieclip called "masterbar" and within that is one movieclip called "bar" (which is one pixel wide) and a dynamic text field called "varnumber" What I need to do is get "bar" to expand to the be the width of four times whatever number I type into "varnumber" I tried soemthing along the lines of the following but it isn't working.
[Code]...
I'm trying to embed a font in my project by using url("font.ttf") rather than local("Font Name"), but it doesn't seem to pick it up. The font in question is called "Gotham Bold". When i view the details of the font, the font weight is regular, however when i use local("Gotham Bold") in the css i have to specify fontWeight: bold or else it wont pick it up. But when I use url("folderGotham-Bold.ttf"), and specify fontWeight: bold, it says that font weight is not found for that TTF. If i remove the fontweight, there's no errors, but the font is not applied to the text.
View 2 RepliesProbably a dumb question, but is it possible to monospace(fixed width) a font which is not monospace? I hate all the monospace fonts and was wondering if it is at all possible. I know you can set letterSpacing, but it wouldn't matter unless I could find the width of each letter and set the letterSpacing for each individual letter based on its width.If it is not possible, does anyone know of any monospace fonts that looks close to Myriad Pro or Comic Sans MS? Closest I could find was Monaco (a font from Apple that I had to download).
View 2 RepliesI have an issue with font scaling of a dynamic text box.
Currently i have one input box named input_1 with a variable attached to it named "choc_1".
Also, i have a dynamic text box named dynamic_1 with variable "choc_1".
When the user types something on the input box then the dynamic box changes instantly and displays what the user has written.
auto scale-size the fonts to a smaller size if the user types many letters.
The input_1 box has a 13 character limit. My initial font size is 200, i want to scale down so when the user types 10 letters they fit the box and they don't go out of screen. I want to use one line, so wrap or multiline is not possible.
here's a code that i'm trying to fix but i can't get the dynamic box to change:
[Code].....
I have an issue with font scaling of a dynamic text box.
Currently i have one input box named input_1 with a variable attached to it named "choc_1".
Also, i have a dynamic text box named dynamic_1 with variable "choc_1".
When the user types something on the input box then the dynamic box changes instantly and displays what the user has written.
I've googled a lot, but i can't find a solution to auto scale-size the fonts to a smaller size if the user types many letters.
The input_1 box has a 13 character limit. My initial font size is 200, i want to scale down so when the user types 10 letters they fit the box and they don't go out of screen. I want to use one line, so wrap or multiline is not possible.
here's a code that i'm trying to fix but i can't get the dynamic box to change:
[Code]....
Scenario: main moveiclip with 4 other clips in it. I want the rolledover clip to scale up and all the others to scale down and blur.
Question: What is the most effiecent way to code this. Would it be a "for in loop"? I am trying to minimize the code and would rather not use a whole bunch of if then statements.
I want my flash content to scale when I scale my browser window.
View 5 RepliesHow can I convert the current scale of the instance to 100% so I can easily "visualize" and manage the instance when I modify its scale? Here's the actionscript, it works, but I just want the temp._xscale and temp._yscale to be in percentages, not real numbers.
Code:
USflag.onMouseDown = function ()
{
var temp = USflag;
onEnterFrame = function ()
[code]....
One last thing, what's the tag you have to put that is designed for boxing actionscripts? I'm suing [ code ][ /code ]
My Flash image will not scale.if you zoom in, it gets chopped up. if you zoom out, it has a big blank area.What should I change in order to have this Flash image scale just like the rest of the site? [URL]It is the Flash in the center.
View 1 RepliesI have imported a font into the Flash library in an FLA file this way in the New font symbol dialog box:
[Code]....
I'd like to assign this font to a TextFormat instance, but as you can see, something is wrong or missing. But what?
In my application, I allow the user to change the font of a text field. They use a combobox component to select the font. Can I change the font of each individual label in the combobox to match the font it is named? Like, Microsoft Word style.
View 2 RepliesI have a strange issue where a dynamic text field will not show a bold version of a font (Gerstner BQ) if the regular version is on the stage in a static text field.Remove the static text field and the dynamic text field displays the bold font correctlyI have created a test FLA to reproduce this and by turning the layer with the static text field on and off (Publish settings -> Flash -> include hidden layers [unchecked]), the issue is quite clearhis issue is so big for me that I have had to abandon a project in CS5 and start again in CS4 just to work around this.
View 19 RepliesI'm using Flex 4. I'm trying to apply a embedded font in all Alert components of the application, to get the same style that all the app, of course. I code in my CSS file:
[Code]...
The font-family worked to all componentes, but not to the Alert component. In alert the text message and title got unvisible. If I change to other font-family it works correctly, just the embedded font doesn't work on Alert component. Anyone got this problem? Obs: The embedded font worked in all the app, just the Alert no.