IDE :: Set The Co-ordinates Of One Object Relative To Another?
Jun 28, 2009
How should I set the Co-ordinates of one object relative to another?
Eg: Balloon, Monkey
If I need the Monkey co-ordinates fixed relative to the Balloon only and my Global or Stage Co-ordinates fixed at the Top - Left hand corner should not affect my Monkey's movements.
i.e Monkey's co-ordinates computed with respect to Balloon's only.
View 1 Replies
Similar Posts:
Apr 15, 2011
explain why the lines drawn between the circles in the code below are not aligned with the centre of the circles? It seems the x and y properties of the circles are not up to date with their actual positions but how can this be?
import flash.display.Sprite
import fl.transitions.*;
import fl.transitions.easing.*;
var mcs=[];
[Code]...
View 1 Replies
Feb 16, 2012
I've seen code where an object can be added relative to another but I can't get it to work. I'm just trying to draw a rectangle and then add another smaller rectangle relative to the first
public var rectangle:Sprite = new Sprite();
public var other:Sprite = new Sprite();
rectangle.graphics.beginFill(0xFF0000);
[Code].....
Both rectangles just end up rendered relative to the stage.
View 1 Replies
Feb 20, 2007
check this code out:
[Code]...
I was wondering, is there a way to change if (myClip_mc._x < 400) { to a relative position of myClip_mc. I mean, i want myClip_mc to move 100px from it's current position everytime the button is clicked. Instead of only moving it if it's x position is less than 400. So it needs to somehow check it's current position everytime the button is clicked and then make it shift from that position. I know this is a long winded way of doing it but i want it this way so i can use it for something different.
View 8 Replies
Jun 26, 2009
I have made a class file player and another class file landscape. The player class file has methods that allow the player to move. Where would I put code to make the landscape move with the player? Would the code go into the player class file or the document class file? I don't know how I could link the landscape movement with the player movement
player.as class file
Code:
//the package
package actionscript{
import flash.display.*;
import flash.events.*;
import flash.media.*;
[Code] .....
View 2 Replies
May 17, 2011
If I have a rectangle on the stage, how do I find its top left tip (x,y) and the bottom right tip (x,y) in relation to the stage?
View 2 Replies
Jan 28, 2010
I have an flash file which is 740px wide and a movie object inside it which is 1100px wide. What I want to happen is for the movie to scroll left or right depending on the mouse position and to stop when it reaches the start or end of the movie object. It all works fine except when it gets to either end, the _x position is outside the boundaries I have set in the if statement so it wont scroll back again.Code is below:
ActionScript Code:
onClipEvent (load)
{
[code]....
View 2 Replies
May 9, 2009
I have made a tooltip class for my project and I want to position the tooltip relative to the object that triggered it.e.g.
Code: Select all_button = new CustomButton("CLICK ME");
_button.addEventListener(MouseEvent.ROLL_OVER, showTooltip);
private function showTooltip():void
{
[code]...
How can I access the _button without hardcoding it like that?
View 9 Replies
Jul 6, 2009
I am new to Flash and ActionScript 3.0 environment. I don't have any knowledge in depth with Flash and ActionScript 3.0. I am using the flash(.swf file) in my Java application. Now, this .swf file is to be placed in the server system. While I am working with these, I faced an error. Here, my issue/problem(s) starts....
1.)With the help of URLRequest & URLLoader classes, I am loading a jpg file dynamically onto the stage using the following code:
[Code]...
View 1 Replies
Apr 26, 2009
allowing a user to enter there own x and y co-ordiantes and then a rectange gets position in the x and y co-ordinates declared
View 4 Replies
Jul 20, 2010
I have 52 (pack of cards) movieclips on stage all turned invisible When selected they turn visible. and need to display in one of five set positions (e.g. x and Y co-ordinates). If the first slot if full the card should be displayed in slot two. IF slot two is full the next dard displays in slolt three. I card two is then removed and a space left the next card chosen should go in there.
View 3 Replies
Jul 25, 2011
Am updating a 2D game I made to have an isometric view, problem is am having issues when converting the 2d coordinates of given movieclips into isometric ones. The way I converted my game into an isometric one is just by rotating rectangular graphic 45 degrees and increasing its width such that its 2 times the height.I having problems converting all my 2D coordinates into isometric ones.Is there a function to convert them, or a mathematical formula I could use? by the way the game am making is not tile based, so functions that use tiles to convert the coordinates are not going to work unfortunately.
EDIT: I managed to fix it, I just changed the alignment to be the upper left corner, i.e. though the game is isometric and has a demimonde shape, I imagined that it is contained in a box, and that box's upper left edge is where it is aligned...this way both x and y coordinates r the same ones in both 2D and "isometric" view.
View 2 Replies
Apr 22, 2010
There is something i do not understand, i'm making a Tetris like game and i want borders (limits) but when put an height and width to my MovieClip nothing appears.
Code:
public class Thugtris_V2 extends MovieClip
{
var ts:ThugtrisShapes;//ShapeManager.GetInstance().CreateShape(ThugtrisShapes.RLSHAPE);[code]....
I have second problem, i check my coordinates of my dropping shapes and my shape disapeared from the screen,fell completely down, and it's last coordinates were : pos = (x=-6, y=371).My bottom is suppose to be at 440? The entire screen does not "measure" 400 pixels? How can u get a negative coordinate,are'nt the coordinates suppose to be like texture coordinates, only positive and (0,0) is at the top left corner?How do u measure the pixels limits of the top DisplayObject? How are the coordinates actually "setuped"? Like cartesian but only the upper part?
View 5 Replies
Nov 7, 2010
I am hoping to tween a movieclip from the outside of the stage to the centre. I have been trying but am unable to get it to stop in the centre. Attached are my files that I have been working with.
View 1 Replies
Feb 8, 2010
Lets say you have a sitation where you have
Code:
stage
--container1 {30, 30}
[code].....
View 1 Replies
Jun 20, 2011
Is it possible to change the x y co-ordinates of various levels within a movie.I havecreated a movie that references a lot of other movies on different level and loads them when required, from buttons etc. I have since created another movie that is basically border/interface around the original parent movie. The original parent movie loads exactly where I want it to, but the subsequent movies still load with x:0 y:0 so they are all out. I figure the easiest way would be to change the x, y co-ordinates of the levels in the riginal parent movie but I can't seem to find a solution.
View 3 Replies
Oct 14, 2008
How it is possible to draw a square in Flash if co-ordinates are is in XML?
View 3 Replies
Aug 8, 2010
I've set a movie to appear in my flash library using attachMovie. In the movie(Red), on release of a button there is a command that removes the movie Red/game_mc from the _root and code to make it an new file. I've given co-ordinates to other clips loaded in this way and they appear where they should.
[Code]....
The _root.game_mc being removed is an instance of a different movie clip loaded earlier. The problem is that the clip that loads at the origin (0,0) of the main document rather than the _x and _y co-ordinates from the clip.
View 4 Replies
Feb 18, 2009
I am generating some dynamic movieclips [reading polygons from SVG] and then adding them to a container movieclip [it happens to be a movieclip/class which was exported from FlashMC]. Now all these new movieclips are generated at runtime and I am not assured of their X and Y coordinates; I want them to be at a place where parent MC's co-ordiante falls.... say x:10, y:10.
Now the issue is i can not use MouseEvent.localX / stageX as I want the placement to happen soon after the MCs are generated. I hope I have described it to major extent...
View 6 Replies
Jan 12, 2009
I've got a clip on the stage at (100, 100) and I execute the following code:
[Code]....
Given that circle1 is on the stage, shouldn't localToGlobal leave the co-ordinates unchanged? I think the result of its call is wrong!
View 2 Replies
Oct 23, 2008
I have attempted to make a movieclip scale in the y axis using _yscale but I can't seem to make it scale to the exact mouse co-ordinates.
Its within a rotating movie clip (controlled by the position of the mouse) and that works fine.
Here's the code I'm using at the moment.
Code:
onClipEvent(enterFrame){
var disty = this._y - this._ymouse
var dist = Math.sqrt(disty*disty)
this._xscale = 100 + dist;
}
View 6 Replies
Oct 12, 2009
I'm not an expert in actionscript but I know a thing or two, but basically I've been given a task in a new web-based piece of software whereby users can drag and drop objects onto a background bitmap. The amount of objects and the co-ordinates of each object will then need to be saved for each user, so when they log back in (regardless of what machine they are using, they'll see where they have left off.)I've seen mentions of using the shared object, but this won't do as the user will not always be using the same machine.
View 1 Replies
Feb 17, 2009
I have just started with creating Drawing Pad, which can save and reload the image drawn once. I have completed the basic interface which includes drawing and erasing part. I am storing the co-ordinates in a text file. I am using MultiDimensional Array to store X,Y co-ordinates. But now I am facing a problem that how to load these variables into the flash back and using these redraw the image. I tried using 'loadvars', but it didn't helped me as it doesn't return string data. Can somebody help me in this so that I can load co-ordinates from text file and redraw the image.
View 1 Replies
Dec 29, 2008
How to access x and y co-ordinates when a mouse's left button is clicked upon a JPG file whichis placed on a stage, so that we can view the jpeg contents on the stage?
View 7 Replies
Feb 13, 2009
I'm looking to create something like the link below, [URL].. however I need it to work on both x and y,I've been trying for days to figure out a way to pull this off,
can anyone point me to a tutorial or an example of something along those lines?
View 5 Replies
Jul 14, 2009
In my flash project, I make a call to an xml file using url... and it works fine as long as the userhas entered url... in the url. If the user enters url...without the www my xml file wont load.I can't use a relative path here because I share the widget on other sites. Any ideas, how I can let both users that enter the www and no www see the widget load properly ?
View 3 Replies
Nov 6, 2009
I can't seem to get an FLA to properly import a SWC folder using a relative path to the project.
View 1 Replies
Nov 6, 2009
Is there a way for me to handle relative properties? For example I have a circle in a box. The box is being moved, resized, rotated etc. How do I move, resize, rotate etc. the circle as if it were inside the box? Or must I remember the properties of the box, resize, move etc. it to default, move the ball then move, resize, rotate etc. the box again?
View 3 Replies
Feb 13, 2009
I'm looking to create something like the link below,
[URL]
However I need it to work on both x and y.
View 2 Replies
Mar 12, 2010
I have this FLV player that plays movies in a library style.
Where you get thumbnails for all different videos with the ability to add different categories. I have a fla and XML file as my source files. xml has all the information about the list of movies titles description and all that and my fla file has info about the way player looks. I want to be able to add a tab called related videos, kind of like YouTube where when you play a certain movie it show a list of similar videos.
View 1 Replies