Actionscript 2 :: Flash: Change Text Size According To How Big A Word Is
Mar 16, 2012
I made a flash application that gets the geolocation of a viewer ( city, state) and I'm trying to figure out how I could make the font smaller to fit in the container that I have it in depending on how big the name of the city is. For example, "Detroit" may fit, but "Los Angeles" may need to be a smaller font.
When I click the type tool and drag a text box out and type a couple words at 235pt size it looks fine. as soon as I click off the text box, the text size jumps down. I have no idea why this is happening and I can't get it to stay. When I click the type tool on the box again the tet appears at the 235pt size. But when I click off of it and play the movie it is at the incorrect size.
Is it possible to create a for loop, that looks at the number ofcharacters in the symbol, take the current character and raise its size by 2pt, and the previous and next characters by 1 point? And as it continuess to put the original size of each character back?I'd only started working on this, but (a) I'm new to ActionScript, and (b) it may not be possible to create such a routine.I started with this before posting:
Code: for (L=0; L<pageTitle.letters.length; L++) {
I have an MC with a single-line dynamic text box in it. I am placing the MC on stage using attachMovie. Then I am loading text into the dynamic text box in the MC I just placed on stage. I am trying to figure out code that will make the dynamic text box either scale up or down to fit the text that I am loading into it.
is it possible to set the text size for ALL the textfields in the movie with one script? Even if they have no instance names, even if they are created dynamically,...
Maybe some prototype which activates after the textfield is "created"?
I'm trying to change the text size in a dynamic text area within a (movie clip) button. For a couple of buttons I'd like to make certain text smaller, for example, to make the "vs" smaller in "A VS B". My buttons have dynamic text in them and the font is embedded and set at size 10 initially. The code I've got in my movie is as follows:
Code: // define new text formatting var minimenutext_txt:TextFormat = new TextFormat(); minimenutext_txt.size = 8; avsb_txt = "A VS B"; avsb_txt.setTextFormat(3,4,minimenutext_txt); // assign formatting to button dynamic text btn1.btext.buttext.text = avsb_txt;
The text "A VS B" shows up in my button, but I can't seem to do anything to change the format. I've tried making it bold, italic, that kind of thing too - but no luck. Does the setTextFormat command only work with input dynamic text boxes? Is it being overruled somehow?
I have an MC with a single-line dynamic text box in it. I am placing the MC on stage using attachMovie. Then I am loading text into the dynamic text box in the MC I just placed on stage. I am trying to figure out code that will make the dynamic text box either scale up or down to fit the text that I am loading into it.
I'm using evt.target.borderColor = 0xff00000 to successfully change the color of a dynamic text filed that is the target Now I'm trying to change the border size. borderSize isn't being accepted, so I was wondering if there is an attribute to change the border size of a text field? My internet searches are coming up with nothing that works.
I have a class for MarqueetextField, I am trying to change the text inside a marquee tag and the color of the marquee using as3.I Don't Know how to Change the Color and Size,[code]But the Size is Very Small,How Can i Change the Color and Size of Marquee Text?
I've got a bunch of text boxes that I need to be able to change the text size of with the click of a button. All the text needs to be embedded so I tried to use a tlf text field and target it but to no avail. This is what i have.
ActionScript Code: import flash.events.MouseEvent; fifteen_btn.addEventListener(MouseEvent.CLICK, changeSize); function changeSize(evt:MouseEvent):void {
I'll try to be brief. I've built a teleprompter projector file app in Flash CS4 and it works great on PCs & MACs. Only one bug. the program works in three phases: Welcome & instruction screen / Text input screen / Prompter screen.Problem occurs when you first enter prompt screen
basic navigation and functionality includes:
BUTTONS: button to return to INPUT screen, a BEGIN button, a MIRROR text button, and a SAVE prompting position KEYBOARD: SPACE begin prompting, LEFT & RIGHT ARROW increase & decrease font size, UP & DOWN ARROW increase & decrease scrolling speed, HOME returns script to top, PAGE UP & PAGE DOWN moves script by 600 pixels.
MOUSE: MOUSE_WHEEL increases and decreases scrolling speed *(would like to add a ctrlKey modifier to change font size on mouse wheel - another day perhaps)
THE PROBLEM: When you enter the prompt screen and hit PAGE DOWN the script correctly moves down 600 pixels, but does not redraw on the stage. If you then hit PAGE UP it correctly moves up and the text is back on the stage. Hit PAGE DOWN again and it moves but does not render. You can repeat this continuously. I have a Y position reference that shows the Y coordinates of the text field, so I'm confident that the MC is correctly moving, it's just not rendering. If you hit PAGE DOWN and hit BEGIN the text renders in the correct place. Once you start the prompter, you can stop it and use PAGE DOWN and it renders correctly, but if you change the font size larger > 100 and hit PAGE DOWN the font again does not render. Again if you hit BEGIN the font renders correctly in the correct position.
WHAT I THINK: I've been trying to find a way to update or refresh the text field that is being manipulated on PAGE DOWN and font increase; no luck with updateAfterEvent or redraw. I've tried to start and stop the prompter programmatically in one frame at the end of the PAGE DOWN function & font increase.
POSSIBILITIES OR NEW STRATEGY? I'm a media production specialist with a school district in Florida, and I'm hoping to release this app to all our schools and to sourceforge.net. It's a small bug, but I'd rather not have to explain it if I can find a way to fix it. The following code block only contains the functions related to the navigation and prompter text box manipulation.
//Begin button toggle code.Toggle between begin and stop.startBtn.addEventListener(MouseEvent.MOUSE_OVER, startOver);function startOver(e:MouseEvent)[code].....
A Visual Basic & ASP.NET programmer I work with looked at the bug with me, and he believes the error is somehow related to the actual CLICK of the BEGIN button. As I noted earlier, we tried a workaround by using code to start and stop the prompter in one frame after the font size change, but that did not correct the issue. Yet when you physically click begin with the mouse it renders the text.What is it about clicking the mouse that causes the text box to render? Is it a focus issue? Like the keyboard has focus, but when you click BEGIN it returns focus to the text box and it redraws then?
I am kind of new to javascript/html5. normally I would do that kind of stuff inside flash/as3. but since the iPad doesn't support that I need to switch the horse...I want to build a website where words are floating in position and size and if the mouse comes over one word it should draw some lines to all the other words. are there any frameworks one could use? the whole should look like a tag cloud with lines between the tags.
I used to have a little text panel (that sat with the color, swatches, and align panels) that I was able to open up and edit text size, color, underline, etc with. It had a much better text editing ability then the properties panel, seeing as the properties panel does not even bother to allow me to underline text or to highlight and edit a single word in a whole text box. Now I don't have it, I can't find the damn thing anywhere, and I want it back. How can I get it?
is there a way i can extract a MC and a text field from flash and insert into MS word? i have to insert it as a picture and text seperately. is there a way to do it?
I want to reduce the size of Swf using the size mentioned in the object tag of html. Same swf file size can be different for different request.
The problem is this if we reduce the size all control in swf reduced according to the change in swf size. But we want the buttons and one more graphics remain same size for any change in size of swf file. How can we make it ..
I have a flash file with the stage size 800x600Now I change the stage size to 1024x768 but all the constant ( movie clip, images, buttons..) do not fit with the new stage size.
I have a list of 98 countries. I have a world map that I have animated by storing all the movieClip names in an array. Below the world map I have the country names listed out in a few text boxes. I know I can turn these names into movieClips and then change their color that way. But I was wondering if there was a way for ActionScript 3 to "read" my paragraph and find the text name then change its color?
I'm trying to make it so that when a user inputs the correct word an event happens. It almost works except that the event doesn't fire until the NEXT keystroke. Is there a way to test for the word AFTER the keystroke has become part of WriteInOneText.text, without adding a separate button or anything? Here's the code:
Attachment 54101my problem is in bitmap explained:1. after loading external text into dynamic text field,2. how to call/make visible "button over text" on the Scene by pointing a mouse over specific word in loaded external text?3. javascript, html, actionscript (asfunction, variable)
I created a simple program that displays the current time on the screen.
When I embed this object on a web page, it takes the whole screen leaving a lot of blank space. To avoid this I tried setting the height and width using two methods:
1) I did <embed src="time.swf" **height="100"** **width="100"**>
2) I tried stage.scaleX=.5; stage.scaleY=.5;
But both of these solutions also decrease the size of my text.
So, my question is that is there a way to decrease the dimensions of the swf file, without scaling the text and other components in flash
I'm totally new to flash, and I'm trying to build a very simple app. I have one as file in which I defined my class which inherent from Sprite, with the name mySprite. I have a fla which is of the mySprite class, and a size of 400x400(I must assign a size when define the fla). my question is, when this flash is launched, I want to read some data from outside (width&height) and change the flash windows size to these specified size. I tried many ways, but can't succeed. Every time the flash is launched, window size is 400x400.