ActionScript 2.0 :: GetBounds() - Get A Movie Clips Coordinate Bounds And Use The Minimum And Maximum Values Of X And Y To Draw Rectangle Around The Object
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?
I have a menu, that moves left and right using a move left and move right button that makes more of the menu come into view in the left and right direction.I want the object to stop moving when it's at the beginning and stop moving at the end.I thought I could set a 'max x coordinate' so that if previous was hit the object would not move anymore to the left but it still does.Here is the code I tried to use that doestn' work:
How do you set a max and min value for a variable? I have defined a variable, myVar, to have a default value of 10 at run time. The user can then use buttons to increase and decrease the amount. How do I set the limits?
I have an advancedatagrid that displays a table of values from an arraycollection coming from a webservice. I am wanting to highlight either the maximum or minimum value in a row or column.I'm not bothered how they are highlighted - be it the backround changed, the font colour changed or just making it bold - I just want that particular cell to be different to the others.What I'm struggling with is finding the cell with the maximum (or minimum) value and then changing it's appearance.In one grid I want to compare across the row, in another accros the columns.
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 need to change the starting and ending dates, so that the earliest date that can be chosen is January 1, 2011 and the latest date that can be chosen is April 30, 2011. Also, the user should only be able to select 30 days at a time.
I am trying to build my portfolio which is coming along fine.
I do however have a problem.. I want the site (SWF) to scale according to browser size.But, I want to implement a maximum and minimum width and height.
I dont want it to scale so that it is bigger than my stage size (1365px x 845px), and I dont want it to scale so that it can be smaller than for instance (800px x 600x). And I also want the SWF to be centered at all times.
If you need to see a working example you can see what I am trying to achieve on this site: [url]....Take a look at the slideshow when you enter the site, and try resizing your browser window. You'll notice that the pictures will shrink, but won't scale above their obvious 100% size. I tried looking at the page source, but I didnt understand much. Looks like they have used Actionscript for the resizing/aligning.
I'm building a photographer's gallery website and I need it to resize to fit in browser window. So far so easy...What I would really like to achieve is a maximum and minimum size that the gallery will go to.
So, if the images I am using are 1400x1000 (for example) when this size is reached by the user expanding the browser window i don't want the gallery to expand any more, just sit in the middle of the page.
Similarly I don't want the gallery to go below say 800x600... how to set a max/min?
I've noticed that AS3 doesn't seem to contain a way of defining a minimum amount of characters required but does have a maximum.Any way to do this with a textfield?
I am showing a stacked bar chart with Flex, and I am dynamically changing the data of the dataprovider. However, the minimum and maximum for the y-axis do not get reset with the new data. So if one dataset had a value of -100,000, but the next dataset has only positive values, the y-axis still starts at -100,000. How can I force the chart to redraw. I tried myChart.validateNow(), dataprovider.refresh(), etc.
On MouseDown I start a repeating timer to position the Scrollbar-Button(Slider).When it reaches minimum/maximum it jitters (switching between min/max and stage.mouseYŚ) How can I prevent that?
private function onTime(e:TimerEvent):void { if(this._scrollBtn.y < min)
I need algorithm ideas for generating points in 2D space with defined minimum and maximum possible distances between points.
Bassicaly, i want to find a good way to insert a point in a 2D space filled with points, in such manner that the point has random location, but is also more than MINIMUM_DISTANCE_NUM and less than MAXIMUM_DISTANCE_NUM away from nearest points.
I´d like to know if it´s possible to find a minimum y point (where the shape ends) of a shape, in a given x coordinate.
Example: I have a complex shape like a big "S". Suppose the "S" minimum x coordinate is 0. How can I find the minimum y point of the "S" (again, where the shape ends) in the x coordinate of 14?
Here is the image: I need to find the y coordinate (or point) of the blue point in the image.
I want to make it so when I release one of my menu buttons AS does the follow: on(Release) If Movieclip1 is on frame 2, the movieclip1 go to and play frame 3
If Movieclip1 is on frame 2, the movieclip1 go to and play frame 3
Really the only problem I am having with this is i don't know if i can say multiple if then statment on one trigger and I also dont know how to say "is on frame..." properly in an if then statement.
I want to make it so when I release one of my menu buttons AS does the follow:on(Release) If Movieclip1 is on frame 2, the movieclip1 go to and play frame 3If Movieclip1 is on frame 2, the movieclip1 go to and play frame 3Really the only problem I am having with this is i don't know if i can say multiple if then statment on one trigger and I also dont know how to say "is on frame..." properly in an if then statement
So, I'm just starting a bigger AS3 project. I'm still learning AS3, transitioning from AS2 and I keep getting caught up on dumb stuff. I'm creating two variables to store a maximum and minimum value for a random number generator. Here's my code.
I draw a rectangle i should see a little bold circle to indicate a perfect rectangle, I seemed to lost mine, can somebody please tell me how to get it back!
I have a simple MC on the stage. I want to create a simple conditional statement that would check if the mouse is on the rectangle using get bounds. something like [code]Basicaly...how do I properly use the getBounds in a situation like this?
I need t draw a rectangle on a movie clip(board_mc) by dragging mouse over it......It works fine till here but I want to put the movie clip(board_mc) in scrollpane. but after doing so the code doesnot work....can u plz guide me how to make this code work after placing the movie clip (board_mc) in scrollpane(say board_scp).
I am creating an app that has to load a image or swf on to the stage and dynamically place and position it on either sides of the stage i.e. (top, left, bottom or right).how can I dynamically calculate the remaining bounds of the stage using the bounds of the dynamically placed loaded image/swf. ?e.g if the bounds of the loaded clip isRectangle(x=10, y=10, w=250, h=800);What is the remaining Rectangle() to use ofRectangle(0,0,1024,800); ?
e.g if the bounds of the loaded clip is Rectangle(x=0, y=0, w=800, h=50); What is the remaining Rectangle() to use of
After researching the topic a bit more I was wondering why Kirupa uses a loop to return this value when you can simply use Array.sort and slice out the last (or first if reversed) elements.For all of you out there looking to do this not only for the max value but the top values (as many as you like until the end of the array) here is a simpler method:
Code: var values = ['2', '4', '4', '1', '3']; var count = 3;
I have a rectangle that I can calculate the corners of and I can detect a point within that rectangle, how do I determine the 2D-coordinate of that point if I were to try and project it on a non-distorted rectangle?
Code: | | | | |
[Code]....
I've tried many a Google search dealing with 3D Projection and and matrices, but I don't even know if I'm looking for the right things.
I've got five movie clips (called horse1 through horse5) and I want to sort them to find out which has the highest x value. I thought putting them into an array and sorting that would be the best idea but I can't seem to get even the array to work.
This is the code I have so far;
for (n=1; n<6; n++) { var hr = "horse"+[n]; myArray=[["horse"+[n], _level0.hr._x]];
I've got five movie clips (called horse1 through horse5) and I want to sort them to find out which has the highest x value. I thought putting them into an array and sorting that would be the best idea but I can't seem to get even the array to work.