ActionScript 3.0 :: Shape And Reg Point Inside A Parent?
Nov 24, 2009
draw a shape on the stage, make it into a movieclip, registration point wherever, tl is fine, name it mc, and put his code:
trace(mc.getChildAt(0).y);
now get inside a movieclip and move that shape around (away from registration point) for example above registration point, or wherever and output will always be 0.
Is there any way to get the positions of points in a shape on stage at runtime? for instance a triangle, is there any way to get the positions of the 3 points that make the triangle?
to draw them. Each shape has a different color for fun (different beginFill).How can I get the color of the shape under the mouse pointer as I move the mouse around the shapes?I see two choices so far but don't know how to do either of them: Get color under the mouse point get the color from the shape properties (preferred)how to do either of these...
Given a MovieClip containing a vectorshape (loaded from the library) - is there a way to check whether a line (from point(x1,y2) to point(x2,y2) intersects this shape?
var shape1:Shape; shape1=draw(); addChild(shape1); shape1.rotation=50;
[Code]....
Then I want to rotate the shape at it's center point(200,202) by using shape1.rotation=50,but I find the shape don't rotate at the the center of it's shape. How to realize the function which make shape rotate at its center point?
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 need to have 2 kinds of masks, one with a registration point in the top left so that when I tween its height it expands downwards, and one with a registration point in the bottom left so that when I tween its height it expands upwards?how do i do that, with code ofcourse?i have made something but i dont know if its the right way:(this expands downwards, but i dont know how to get it to expand upwards)
Code: import gs.TweenLite; var subMask:Shape = new Shape();
I have a single point and a set of shapes. I need to know if the point is contained within the compound shape of those shapes. That is, where all of the shapes intersect.But that is the easy part.If the point is outside the compound shape I need to find the position within that compound shape that is closest to the point.These shapes can be of the type:squarecirclering (circle with another circle cut out of the center)inverse circle (basically just the circular hole and a never ending fill outside that hole, or to the end of the canvas is there must be a limit to its size)part of circle (as in a pie chart)part of ring (as above but lineThe example below has an inverted circle (the biggest circle with grey surrounding it), a ring (topleft) a square and a line.
If we don't consider the line, then the orange part is the shape to constrain to. If the line is taken into account then the saturated orange part of the line is the shape to constrain to.The black small dots represent the points that need to be constrained. The blue dots represent the desired result. (a 1, b 2 etc.)Point "f" has no corresponding constrained result, since it is already in the orange area.For the purpose of this example, only point "e" is constrained to the line, all others are constrained to the orange orange area.
I want to make an editor like this site. [URL] If you browse this link you will find "Button. If you press this button you will navigate to a editor to design your layout. After draw a rectangle or circle or line you can resize that or can rotate that. When you finish if press the "you will back to the previous page where your desinged layout display. If you press the "" again then you will navigate the editor with the previously designed layout. I want to make a site like this. I want to use the flash cs4 to make the editor. Anybody knows how to draw a rectangle or circle shape with mouse and how to scale by setting the point and how to rotate by setting the rotation point also by using flash cs4 and as3?.
This should be a bit of simple geometry: How do I calculate the points to draw the lines in the code below so that it makes a 2D cone or wedge shape?
import flash.geom.Point;
//draw circle var mc=new Sprite()[code]...........
UPDATE:I should have mentioned my aim is not to draw a wedge shape, but to draw a line from a random point to the edge of an existing circle.If you're more comfortable with algebra than actionscript,
Alright, so I've been struggling with this one since last night. When I create a new object (a new unit), and draw it to the screen (Flash does all the work there), the point at which it's first placed is considered its origin. That is, getX and getY will return the distance from that point... Why is that? Or how can I stop this?
I just have a simple question how do i point to the parent directory from where i curently am in URLRequest string parameter?in other words my folder structure:
my_site/flash/button.swf
How must string look to tell flash to locate solarij.html that is in my_site folder one folder up(parent) from current swf position.?
ActionScript Code:
var link:URLRequest = new URLRequest(""); navigateToURL(link, "_self");
I just recently been using a lot of prototype javascript stuff, and was wondering there was anything like the "bind" method, for use in AS3. It's proved quite useful to be able to look both at the event.target as well as the class object the handler function might be associated with.
I have a class; "Game".I have a bitmap in the library; "Grass"I want to be able to run a function from the main timeline that uses the bitmap inside of a movieClip.My current attempt is as follows; I make an instance of "Game" and have an .as file for Game that has:PHP Code:
Experimenting with adding a square shape inside a rectangle, in the following code, the compiler bounced the error: "Call to a possibly undefined method addChild through a reference with static type flash.display:Shape".
I'm facing another problem, this time I wan't to move a object around inside a shape.The red/orange rectangle is the supposed to be dragged around inside the gray shape,the rectangle shouldn't ever be outside the shape.
i want simulate Billiard ball in my project. but my code does not work good. when start with (for example) 34 degree , when hit with wall(stage in this example) return with true degree. in flash , as3
is it possible for the same actionscript 2 script to be working if its inside the frames frame frame when you get down to the point where it says LEFT RIGHT UPP DOWN?
Recently I worked in a project using Flex. Its a Photo editing project. I have took a Canvas and take a image in that canvas using the code canvas.addChild(image) . Now i can move the image freely by using moving code. The image move inside the canvas and outside the canvas. I want to move the image/child only inside the canvas not outside. How can i do this?
I have recently experienced problems with attempt to remove DisplayObjects that were placed at design time.I have some class "Locator" inherited from Sprite. Several instances of it are placed at the stage at design time.Locator constructor fills parent variables and tries to remove the instance itself from parent:
ActionScript Code: public function Locator() { // give parent some important data
[code]....
All instances now process constructor, but only one of them processes event handler.
I have this question and need for your opinion. Im new to AS3.I have 2 movieclip.. there are stage1_mc and stage2_mc.When the stage1_mc hit the last frame, there will be coding put in last frame to ask stage2_mc to start playing.
AS2: // coding put in stage1_mc last frame stop();
stop(); this.addEventListener(MouseEvent.MOUSE_DOWN, active); function active (e:MouseEvent):void { this.gotoAndStop(2);
[Code]....
this is adding mem1 to the parent,
now on the next frame i want to remove that movieclip, how would i go about doing this. i tried just putting MovieClip(parent).removeChild(mem1); but it says accessing undefined property
I have a Movieclip (MC1) with and moving object (OBJ1) inside it and using AS3. I want to do a hit test on it with another object (OBJ2) that is on the stage. Normally I would just do MC1.x + OBJ1.x to get my coords for the hit test. But how do I do it if MC1 has been rotated?
i need to check if a point is within a rotated rectangle. I have to do this mathematically, as none of the objects are on the stage so i can't use hitTestPoint. I know the position and rotation of the rectangle, and if necessary can get the four corners as points as well.
I kind of feel silly asking this, because i am pretty sure it's not a hard thing to do, i just can't work it out and so far any google searches just bring up hitTestPoint.
I'm trying to test of a point is inside of a Quadrilateral, as defined by four points.I found some script on another site in another language and tried converting it, but I doesn't seem to work. It might be that I don't understand what their "sign()" method does. I thought it was Math.sin().
I am trying to get a circle shape and a text-field sit inside a square sprite, using addChild() method. Both the children seem not to agree sitting in the lap of their parent; and are sitting at a distance, instead. If I create a square symbol on the stage and run the application, everything is fine.