ActionScript 3.0 :: GetBounds Function - Does It Work With TextFields?
Mar 10, 2009
I'm trying to get the height of the (external) text in textfields to display them vertically on top of each other with a space in between. At the moment I am adding the textfields with predefined heights, so if item1 is 2 lines and item2 is 4 lines then there is a lot of space between item1 and item2
ActionScript Code:
var my_tf = new TextField();
my_tf.text = "Hello";
my_tf.appendText(" world!");// my_tf.text == "Hello world!"
my_tf.x = 100;
addChild(my_tf);
[Code] .....
View 1 Replies
Similar Posts:
Mar 6, 2009
I am trying to adapt an As2 function to As3. It is perfect collision with 2 rectangles. (also works with rotation ) the code below works very well, but it look like some of the properties doesn't work in As3 ? (like xMin, xMax etc...). Here is what i have in As2.
[Code]...
View 7 Replies
Oct 19, 2007
I've got 4 input text fields used for inserting numbers. (i'm making a math addition app for children) When each column is added up and the number inserted in the text box in the same column (working from right to left) it compares that number with the actual number and will display either a tick or cross.
[Code]...
View 1 Replies
Apr 19, 2010
I've got a couple of TextField initialized in code (as3). They use my embedded font (aharoni), and that just works. But the fonts that i've written directly into the movieclips in flash cs3, just don't work.
When i play the swf on another computer that doesn't have aharoni, the coded TextFields are aharoni, but the textFields in the movieclips that i've written directly are Times new Roman, because that computer doesn't have Aharoni.
I've set the text font to my embedded font.
View 5 Replies
Sep 4, 2011
I need two text fields to be removed when a certain function runs, but they will not always be there. When I tell it to remove child on those text fields it throws errors sometimes because they are not there, and then doesn't run the code beyond that point in the function.
View 4 Replies
Oct 26, 2010
I'm trying to complete a check function for a input.textfield in AS3.In the textfield the user is allowed to type the whole alphabet (swedish alphabet) and after he/she has completed it he/she is supposed to click a correction button to check if it's right. If it is all the letters are supposed to turn green.If not the wrong ones are supposed to turn red and the correct ones green.I've already tried just simply turning all green if correct and all red if incorrect, but I didn't get this to work.
[code]...
View 9 Replies
Nov 9, 2009
I have write a simple example that adds a canvas and draw a rectangle with stroke size 20 scale mode none. The problem is that if I call getBounds() first time I will get a correct result but after I call scale(); the getBounds() function will give me a wrong result. It will take in cosideration the stroke but stroke has scalemode to none and on the screen nothing happens but in the result I will have a x value smaller. Can sombody tell me how can I fix this ?
[Code]....
View 1 Replies
Mar 24, 2011
I'm having a problem that involves scrollRect and getBounds. In short, getBounds is reporting an old value not accounting for scrollRect changes during that frame. Example:
ActionScript Code:
var shape:Shape = new Shape();
shape.graphics.beginFill(0);
[code].....
View 3 Replies
Jan 14, 2012
I'm trying to get bounds of an object for more specific testing. but it's not functioning very well.The relevant code here, with some debug outputs:
Code:
private function getCorrectionVector(object:Array, block:Array):Array
{
var ret:Array = new Array();
[code]...
The debug output from running this , is this:
Code:
GCV: Checking objects: 95.7 344.2 0.35,1.35
GCV: Checking objects: 48 48 0,0
[code]...
View 2 Replies
Jul 19, 2011
I've been working on an AS3 project. One of my classes in this project is a collision object that extends MovieClip. It is used to be placed in other movie clips as hitboxes.My problem with the code lies in its hittest function. Occasionally, it causes an infinite loop that crashes the program. Flash tells me the problem lies with the getBounds function, but I don't understand why that is so. Can anyone tell me what might be wrong with it?
Code:
public function HitTest(other:CollisionShape,offsetX:Number = 0,offsetY:Number = 0):Boolean {
[code]........
View 2 Replies
Aug 19, 2010
I have two display objects dispObj1, dispObj2. dispObj2.stage is null. (i.e. it is not added to stage anyhow)What should be the output of dispObj1.getBounds(dispObj2)?Is it well defined, or could it be arbitrary?Once I got x of boundingRectangle close to 6710785, which I guess is a symptom of an integer overflow somewhere.
But other times I got a reasonable value for x,y,width,height.
View 1 Replies
Mar 3, 2011
So I've been building a colour picker, where you click an icon and a tooltip fades in revealing the colour picker. You make a selction and then click an "ok" button to close the tooltip(or mouse away from a couple of seconds and the tooltip closes)...Developing this was really smooth, untill I pushed the Button Component into the colour pickers containing Sprite. The problem seems to lie with getBounds. I use this to draw a background on the Colour Pickers container sprite. Now I have a button in there the first time I open the toolip I get a width and height of 250 - 100. Although the buttons dimensions are 25 - 18. The second time I click the colourPicker its getBounds() properties are correct and all is good.
If I add the Colour Pickers containing sprite to the stage before opening it then it opens with the correct dimension. Although this means the container is on stage. So I tried to just add and remove it in the one step but I get the same result as above.I'm thinking this has something to do with waiting for the button to be added to display list/stage or something but I can't work around it
View 1 Replies
Nov 27, 2009
I have a set of Cue Points in an FLV I'm playing. It's an interactive quiz, so the idea is that flash will change a variable, theAnswer, to a different letter depending on which question it is. The answer to question 1 is B, question 2 is D, etc. Either the cue point event listener isn't working, or else it is working and Flash isn't declaring the variables. 1120: Access of undefined property theAnswer. I literally can't find a single problem with my code. I have an almost identical Event Listener further down which works.
[Code]...
View 4 Replies
Jan 3, 2012
I am working with AS3 to build a very simple mp3 player on my site. So far the play and pause button work fine, but when I try to move the slider then click the pause button, it doesn't pause, and then clicking the play button again causes it to play a new file.I'm assuming that for some reason when I call the playMp3 function from my MouseEvent, it's within an object or something and not at the root, so it's like loading a new sound file, but I don't know how to fix that.URL...
View 2 Replies
Aug 2, 2011
The following piece of code works in the timeline:
var ball:Sprite = new Sprite;
addChild(ball);
ball.graphics.beginFill(Math.random()*0xff0000);[code].....
Is the stage accessed differently with the getBounds method in an external file than in the timeline?
View 3 Replies
Apr 11, 2007
I'm having a little difficulty getting to grips with the getBounds() Movie Clip function. I assumed the getbounds() method simply got the boundary coordinates for the movie Clip, that one could use to draw a rectangle. This is what I'm trying to do;I'm trying to get a movie clips coordinate bounds, and use the min and max values of x and y to draw rectangle around the object. Simple right? But in my case, I'm getting some unexpected results. I wonder does ther registration point of the object determine the coordinate values? Also are the coordinate values local to the clip instance or global to the stage?
[Code]...
View 5 Replies
Dec 15, 2009
how do use a function from a doc class.... to call a function to work on in
[Code]...
View 2 Replies
Dec 30, 2010
I've written the function below which is called when a button is clicked. I want to change the character image being displayed and change the number_txt variable each time the button is clicked.This works in the first instance (if char 1 is visible it hides it, makes char 2 visible and changes the variable as required). But having done this it wont work the other way (hide char 2, make char 1 visible, change the variable as required)I can only assume I'm missing something in the way the Else IF function should work? If there is a better way of scrolling through 4 or 5 'character' images and updating the variable each time.[code]
View 2 Replies
Nov 21, 2008
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="[URL]"
xmlns:ns1="com.something.*"
creationComplete="init();">
<mx:HBox>
<ns1:MyButton label="ok" click="ok_()" id="OKBtn"/>
[Code] .....
View 2 Replies
Feb 12, 2011
this is my code..RollOver and Out works great, but I can't seem to get function DOUBLE_CLICK to work.
home_mc.doubleClickEnabled=true;
home_mc.useHandCursor = true;
home_mc.buttonMode = true;
this.home_mc.addEventListener(MouseEvent.DOUBLE_CLICK, click_home_mc);
[code]...
View 3 Replies
Feb 19, 2011
When I tell Flash to go back frames the buttons cease to work, in other words, the button only works once. I've tried tracing it to find the problem and when I tell it to go back frames it won't run the function. I'm using actionscript 3 on Flash CS4.[code]
View 5 Replies
Sep 22, 2011
I try to get the addCallback function to work but I don't get a working result. I allways get a js error 'callback is not a function'. I tried to put it on my local-webserver, to fake a domain name (www.localhost.de in hosts file).
Here is my code (the move has the textfield
import flash.events.Event;
import flash.events.MouseEvent;
import flash.external.ExternalInterface;
[Code]....
View 8 Replies
May 30, 2010
For some reason my TweenLite function won't work. Doesn't give any errors, but it just doesn't do anything and thus the onComplete function won't work to continue the script.
[Code]....
View 3 Replies
Mar 16, 2010
The Function is:
Code: Select allfunction Click_Die () {
this.gotoAndStop(die111+die11+die113);
[code].....
View 3 Replies
Jun 1, 2004
I was reading Kirupa Chinnathambi's function tutorial and I was trying to make my own function, but it's not working! Here it is:[code]
View 9 Replies
Jul 1, 2004
hive just started actionscripting instead of tweening so be gentle. i use mx 2004 but i cant get the trace function to work.., here is the code form a kirupa tutorial...
_global.myvar=5;
trace (_global.myvar);
why does this not work?i thought it shud display 5.
View 2 Replies
May 5, 2011
By chance does anyone know if there is a way to make a set function for my class that will run regardless of what variable is being set? like if someone does..anInstanceOfMyClass.anyVariable="whatever";it will always run function X.I want my code to have a function that runs every time someone tries to set the value of a variable in my class, or create a new variable that does not even exist yet in the class.
View 8 Replies
Aug 30, 2004
I tried using this code because I need some mc to scale, others to fade, and others to move; but it won't work. It only allows the last function to work (in this case alpha).
[code]...
View 5 Replies
May 20, 2007
what exactly "getBounds" does? I've been reading about it and I don't understand. I learned about it from this line of code:
if (_root.walls.hitTest(getBounds(_root).xMax, _y, true)) {
(The rest of the if statement isn't important)
Also, can someone tell me how to add cheats to games? For example, if I want the game to spit out an extra life when you type "extralife", what would I do?
View 7 Replies
Apr 10, 2009
I'm making an educational software by AS3.I call "part1Act()" from frame1 and everything works very well.But when I call the same "part1Act()" from the frame 58, flash throw me this error.
TypeError: Error #2007: γγ©γ‘γΌγΏ child γ― null δ»₯ε€γ§γͺγγγ°γͺγγΎγγγ at flash.display::DisplayObjectContainer/addChild() at L_oni_fla::MainTimeline/loadSnd()[L_oni_fla.MainTimeline::frame2:699] at L_oni_fla::MainTimeline/part1ActT()[L_oni_fla.MainTimeline::frame58:6 7]
I only called the same function from different time frame.The script I wrote is following.
//--------------------- code ---------------------------------//
var progressBar:progressBarL=new progressBarL();
var context:LoaderContext = new LoaderContext();context.applicationDomain=appDomain;var ldSnd0:Loader = new Loader();var ldSnd1:Loader = new Loader();var ldSnd2:Loader = new Loader();var ldSnd3:Loader = new Loader();
[code]....
View 9 Replies