ActionScript 3.0 :: Detect Converted Width Of String?
Nov 6, 2009
I'm setting up a menu system powered by an XML feed that will have everything created dynamically (graphics, textFields, etc), and I've started pondering something...Since the menu will essentially be in list form, with each button stacked on top of the other, and since the titles will be passed as strings out of attribs in the XML, I was wondering if there was a way (there has to be) to essentially define a width of the text box, but leave the height open, allowing for multiline = true;, and then to dynamically draw the button graphic based off of either the height of the textField or the number of lines the textField uses.
Will this just be a matter of ordering, in that I won't actually draw the box until the textField has been set up, and the title passed to it? That way, the get height method would return the height of the box with the text in it, and I can adjust accordingly? Or should I try to base it off of the number of characters that will be passed to the box, and just set a limit via modulo or something else to "catch" when it goes to the next line (The problem I see with this is that not all characters are == when it comes to width. "i" < "e" in terms of character width, but they are both just single characters).
I would prefer to set something up that auto adjusts, as this list will be changed in the future, and I have no way of knowing if the titles will be a uniform/won't exceed a certain length. I could try to just "go big" to make room, but then you end up with boxes that look empty, and if I undershoot, I've got to go back to code.
View 3 Replies
Similar Posts:
Aug 20, 2010
I have the input textfield with instance name vIn, and the variable _vIn. (The textfield is empty.)[code]i have five other variable/textfield pairs were this works ok. I don't get why this pair doesn't work also, my textfields won't accept the subtraction operator, - , even though they're all set to vIn.restrict = "0123456789.-";It doesn't even work in the output textfields were there's no restriction (Negative results are displayed positive)
View 3 Replies
Jan 2, 2011
I've tried a couple different hash classes for as3. Right now I'm using the com.adobe.crypto package from [URL] What I need is a way to return the raw data as opposed the the hex converted string, similar the the way python's hashlib functions have a digest() and hexdigest() method. In python the code would be
...
single = sha1('some text').digest()
double = sha1(single).hexdigest()
...
In as3 using the following code returns a different hash because the return from the first hash is converted to hex before being hashed again.
...
SHA1.hash(SHA1.hash('some text'));
View 0 Replies
Apr 28, 2009
I have a MovieClip that has a bunch of MovieClips inside it. I am trying to figure out how wide the MC is at a specific y value. Not sure if there is an easy way to do this.
For an example.
Code:
OOOOOOOO
O O
O O
[code]....
This is the shape of the MC. It is not solid all the way through, it has MCs strewn about inside this outline. I am trying to figure out how wide it is from, say the second 'O' from the bottom. Left to right. The actual MC.width would be 12 'O's wide. But at that bottom portion, it would be 10 'O's wide. I'm not sure how I can do this.
View 9 Replies
Oct 13, 2003
The problem that I'm facing is in regards to the width of a sliding menu that I've created. The menu slides based on mouse x position and width of the movie. I would like the menu to fit to the entire screen regardless of the users resolution. I wanted to know if there's a way to detect a users screen width and then adjust the variable for screen width within my actionscript.
View 10 Replies
Dec 19, 2009
I am loading an external swf file using the following code:
//add close button
var reqButton:URLRequest = new URLRequest(btn_close);
var loader2:Loader = new Loader();
loader2.load(reqButton);
addChild(loader2);
[Code] .....
Once the loader loads my image, and I click on it, nothing is happening. Am I supposed to be adding the EventListener to the loader or something else? How can I detect the height and width of the swf file in the loader?
View 1 Replies
Dec 2, 2010
I have objects placed on the screen using x/y coordinates. I want a way to update that based on changes in Screen Width/Height. So if used re-sized browser window x/y should change. How do I cick off a function every time the screen is re-sized.
View 3 Replies
Apr 26, 2010
I am loading images from XML and i want to detect its height and width [code]It shows 0 ... how can i trace the actual width and height of images?
View 2 Replies
Jan 11, 2006
i already finish my memory game. now i am working on this fish...i have a fish movieclip. i use actionscript to make it move.here is the code Movement Actionscript Tutorial
[code]...
this fish is inside the aquarium, so how can i make the fish detect the width of the aquarium so it won't go outside of the aquarium.
View 2 Replies
Feb 4, 2009
I am loading jpgs into an MC. I make sure I wait to run and modification to the MC by confirming the image is loaded first.If I comment out the IF statements within the function "RW_pic_modifications()" and I trace the width and height of the MC AFTER each photo is loaded, I successfully trace the correct W and H.
My issue, however is when I DO RUN IT THROUGH the conditions within the "RW_pic_modifications()" function. Then any modifications to the MC W and H seem to compound and apply it to each iteration of the next MCs.I confirmed that my code and logic is correct. I just dont understand why performing a resize to the MC with one jpg loaded into it is not reset to the NEW JPG loaded into it, after the new JPG is loaded.
NOTE - I have an MC that stops on a frame until all the code here is executed. Once complete, then this MC plays to allow the pic to stay on screen for a given amount of time THEN it calls on the RW_Pauser() function.I am way over deadline.
Code:
How_long_to_pause = 4000;
Maximum_Image_Width = 137;[code].....
View 5 Replies
Oct 1, 2009
I am trying to pull a link (or links) out of a text string. So if I had something like this:
Code:[URL].. I would like to be able to find the links in the text string and replace them with a single word or words that I would format to be an HTML link within a text box.
I've had some luck with string.indexOf, but I'm not sure how to detect the end of the link where the remaining text begins that I don't want linked.
View 0 Replies
Nov 16, 2009
I am trying to find the generic links in strings. I've found a very handy regex on RegExr, in the community expressions:
(https?://)?(www.)?([a-zA-Z0-9_%]*).[a-z]{2,4}(.[a-z]{2})?((/[a-zA-Z0-9_%]*)+)?(.[a-z]*)?(:d{1,5})?
I tried to use it and it returns null, although the same string tested on RegExr works fine:
var linkRegEx:RegExp = new RegExp("(https?://)?(www.)?([a-zA-Z0-9_%]*).[a-z]{2,4}(.[a-z]{2})?((/[a-zA-Z0-9_%]*)+)?(.[a-z]*)?(:d{1,5})?","g");
var link:String = 'generic links: www.google.com http://www.google.com google.com';
[code]....
View 2 Replies
Apr 28, 2011
How can I check if a string has any other character than the ones listed here: [URL]
I would like to know if the string was inputted in any other language than English. Is finding special characters in the string the best way to detect non-english characters?
View 2 Replies
Apr 18, 2002
I have made a form and want to check valid data i.e if alpanumeric value is req. user cannot enter numeric value and vice versa. I found no inbuilt fn. in flash which could detect whether the entered value is string or numeric.
View 4 Replies
Apr 10, 2009
in the flash i use at Zero Width Non Joiner caracter but this caracter UNKNOWN for flash.var str:String='‌';//only one Zero Width Non Joiner trace (str.length);////0no problem in this code
[Code]...
View 1 Replies
Dec 26, 2003
How to get a text string to fill a particular width i.e. with a specific character until it reaches the specified width or number of characters?
View 1 Replies
Dec 26, 2003
how to get a text string to fill a particular width i.e. with a specific character until it reaches the specified width or number of characters?
View 1 Replies
Jan 9, 2010
It seems that this is quite easy to do but ... I can't get it.
I have on the stage 3 Btns that set my:
Templates.data.templateTxt :
my Templates.as package is:
ActionScript Code:
package {
public class Templates {
public static var data:Object={};
[Code].....
View 3 Replies
Nov 13, 2006
Found an old file and tried to publish it in f7 - as you expected it wouldn't work checked for case sensitivity and all i suppose it's the 'with' line in the code [code]...
View 5 Replies
Oct 5, 2009
Where's the best place to get code converted between ActionScript 2.0 and 3.0?
If I just have occasional (very small) projects, what's the best way to get them done really fast by somebody who knows both 2.0 and 3.0?
View 1 Replies
Apr 15, 2003
My client changed his mind about v6 and wants the swf compatible with v5. Maybe I should have been more prepared for this, but I'm not. I've barely chugged along with a tutorial and figuring this out, and I'm completely lost with converting it to v5 code. get me started?Here's my code so far:
PHP Code:
onClipEvent (load) {
_global.rati = 0;
[code].....
View 6 Replies
Dec 22, 2009
I am trying to build a menu. I have created few texts and converted into buttons, which goto some url on click. Now, I have to add "fire burning" animation to these texts on mouseover. I have a movie clip of burning fire. I want to reuse the same movie clip. Also, when the animation plays, I want text to be visible on top of flames.
Can I reuse one mc or should I create multiple clips (or instances)? How to bring the text to foreground? Guidelines and if possible,
View 1 Replies
Dec 8, 2009
We are using Mike Davidson's SIFR implementation and so far so great, however we have noticed that it converts any white space into %20's, unfortunately that breaks any % signs we have in our product descriptions.
View 1 Replies
May 26, 2010
There's a ActionScript class which dynamically creates basic UI element.So I create RadioButton as
var rBtn:RadioButton = new RadioButton();
and then put it in a Panel Container.The problem is that it appears to be a Button. However it behaves like RadioButton.I have found this problem with one more guy who has posted it here.CheckBoxes and RadioButton looks like Push Buttons.
View 1 Replies
Jan 13, 2010
I have the problem that a video I imported in Flash is visible on my pc but not on any other. I converted the video into the flv format and dragged it onto the scene. So far so good. I created a folder which includes the main swf as well as the video in the flv format. Since this is a University project, I sent this folder to a professor and he could not see the video. I've tried it on any other pc - wouldn't work either.
View 3 Replies
Jan 5, 2004
Hi everyone, this is my first posting and I need some help on the getURL command. I typed in some text and converted into a button and on the action script I used "on (release) { getURL("http://www.site", "_blank"); }. When I publish it, no errors were stated. Everything work fine but when I clicked on the button to go to the website, it just pop out the browser and the last page that I was looking at. Another word when I clicked the button with the getURL AS, it just open up the browser and didn't go to the link specified in AS.
View 1 Replies
Jan 17, 2009
im using this code from the docs
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.text.TextField;[code].......
the problem is when i make the string longer - there are characters missing in the Bitmap - ive used the TestFormat to no avail
View 2 Replies
May 13, 2009
It's extremely problematic when you're trying to design something. It plays fine when tested, but you cant see anything that's converted to a graphic, button, or movie clip. I tried uninstalling and reinstalling, rebooting, etc.
Also, I got an error message about the classic view not loading correctly, and everything's been goofy since. I still can't edit anything in classic view.
View 6 Replies
Nov 17, 2009
All I'm trying to do is move one graphic (converted to symbol) from one side to another. However, when I try to put in the 'motion tween' it keeps saying "Multiple objects are selected, you must convert them to a symbol in order to tween them. Do you want to convert them and create a tween?" If I click 'Ok' it comes up with "The tween could not be applied to some of the selected frames. This could be due to the frame containing ActionScript, Multiple objects, non-tweenable objects or being on a layer that cannot be a tween layer"
View 1 Replies
Mar 2, 2010
I'm begining with flash (flash CS4 pro), I have created a fla file with a mxp filter which makes waves (I found the effect on "flash-filter.net"). I've done the setup for publishing (animated gif + swf)
When I publish the animated gif, I get a non-animated gif with the logo of "flash-filter.net" at the top of the image. ( I've also tried to download the swf with real player, same effect : I have a static video with the same logo )
View 3 Replies