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?
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 ?
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);
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
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 {
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.
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
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.
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?