AS3 :: Flash - Relative Points - Translate The X / Y Position Of The Crosshair?
Aug 21, 2011
So I have a Crosshair on the Stage and I have an Enemy with nested child limbs, when the below function is called I want to create a hit mark and attach it as a child to the Enemies Limb but how do I translate the X/Y position of the Crosshair to the Enemies Limb bearing in mind the Limb may also be rotated?
[Code]...
View 1 Replies
Similar Posts:
Jan 23, 2010
I have a tween set on a timer:
var manTimer:Timer = new Timer(1000,14);
manTimer.addEventListener(TimerEvent.TIMER, moveMan);
function moveMan(e:TimerEvent):void {[code]....
I just need to make the tween's position relative to it's current position, as opposed to starting at the stage's 0 position then moving the the stage's -40 position. It needs to start at its current position the move -40 from that position.
View 1 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
Nov 21, 2011
How to position Objects in flash so that they stay like 10px from left no matter the size of flash movie. Something like in flex.
And how to embed Flash movie in HTML so that it all worked correctly?
View 2 Replies
Oct 27, 2009
I have a movieclip thats inside another movieclip..lets call them mc1 and mc2..
the problem is that I want to get the position of mc2 relative to the stage...and not to mc1..is there any simple way to do this?
View 1 Replies
Dec 10, 2009
Imagine that I make a movie clip that looks like a chess board, and that inside that move board I place other movie clips that look like pieces.Now imagine that I tilt the chessboard so that you are no longer looking at it top down and rotate it so that the dark pieces are first in front of you and and this slowly changes until the white ones are, etc.In order to make this look right I have to rearrange the stacking order of the movie clips (which pieces are "on top" of which other pieces when they are drawn). But when the clip rotates, the mc.z value for all the clips does not change. Neither does the width or height which I thought I could use instead even though they are clearly looking bigger or smaller onscreen.I think that I might just be getting the z point relative to the other children of the rotating movieclip. Is there any way to get the z point relative to the stage?
View 3 Replies
Aug 10, 2011
way to position an array containing movie clips relative to the stage? Here's what I was trying...
import flash.display.MovieClip;
var one:MovieClip = new One();
addChild(one);
[code].....
View 5 Replies
Jan 6, 2010
I had coded a different file similar to this and had a movieclip move along the x axis relative to where the mouse position is.
The idea is the movie clip is a panoramic photograph (eg. 6000x900) and it would move dependant on where the mouse it. ie. if mouse is in the centre it will be stationary and when it moves left and right the image will move accordingly (faster when further away from the centre).
The code below works moving the movieclip's x position but when I try and do it with TweenLite (using the quotations for relative positioning) the movieclip snaps immediately to -107374182.4
ActionScript Code:
import com.greensock.easing.*
import com.greensock.*
[Code]....
There is obviously something fundamental I am missing but cant see it at the minute. I had this working previously but then tried to progress it and write my own class for the panning (that now turns out I do not have time for) but I saved over the code and cant not go back.
I have put together an example zip with a .fla and the greensock tweening platform.
View 2 Replies
Jan 6, 2011
To make this more clear I have a flash website coming near to the end of the design stage. I have a multi-layered scene with a resolution of about 700x1200 (so you would scroll down the page with the browser scroll bar). Basicly I want these layers to correspond to your scrollbar position as though the perspective changes. ie: scrolling down would push the fore ground at the normal rate but only pushing the background at a slower rate, (thus giving a 3D effect).I would imagine since the .swf would then need to talk to the scroll bar, there would be a need for another language as well as action script.
View 0 Replies
Feb 29, 2008
I have a movie clip that I have given the a "sliding" variable to move it across the X axis. So far I have been using a variable of
Code:
movieClip.newX = -250;
but what i need to do is have the movieclip slide to a position which is relative to an object inside of it.
As i need the slider to move to a position that centers the object which the slider contains on centered on the screen - i have tried:
Code:
movieClip.newX = movieClip.ContentsObject.Stage.width/2;
but with no response. I realise that code is incorrect, but need something that will work in that way. I presume i need some sort of listener to follow the _x position of the specific movie clip.
View 7 Replies
Feb 13, 2010
I would like to know if there is any way that when mouse leaves screen, the mouse coord from the Main Movie Clip (mouseX and mouseY) keeps updating! Is there any way to get the mouse pos relative to the screen pos?For example when mouse leaves screen and goes 30 pixels up, its position would be (X,-30)
View 1 Replies
Feb 20, 2004
I have a dragable movie clip that on release I want to scale, depending on the mouse position, the further the mouse up the screen (y) then the smaller the clip scales on release.
View 6 Replies
Jul 20, 2004
Here is my cool code....
Code:
onClipEvent(enterFrame)
{
_x -= (-20) - ((0.1 * _xmouse) - 60);
[Code]....
How can I make the easing start fast then go slow? Right now it starts slow and speeds up. Well not really, because it speeds up and then slows down once it gets closer to the mouse position. But becuase the mouse position is greater than that of the movement, it seems like it speeds up then just stops!
Here is the effect I am after....
look at the images inside of [URL]
View 7 Replies
Mar 1, 2011
I'm developing my first flash app. I'm trying to use classes because they'll be very important in my future app. I created a simple movieclip with a star. However, instead of putting it directly on the stage, I'm calling it from library, using the addChild method to place the star in the stage. To do that, I simple right click over the movieclip icon->properties->check export to action script->and I give a name to the class (for example: myMC)
Then, inside the class I wrote:
package {
import flash.display.*;
import flash.events.*;
public class myMC extends MovieClip {
var star:myMC=new myMC();
public function myMC() {
[Code] .....
As I am placing the two variables origin_x and origin_y inside the constructor, I'm expecting to get 250 and 200 respectively. After drop the star, I want to send it to it's original place, and that's why I need to keep this values. And here's the problem, origin_x and origin_y are both ZERO, instead of 250 and 200... The value is not relative to stage. I managed a little bit and I found this post : [URL]. Unfortunately I tried to replace by the suggested code, but both values remain zero. An interesting thing, is that if I put the star directly in the stage instead of calling it from the library as I am doing, I get correct values in origin_x and origin_y.
View 1 Replies
Aug 5, 2011
I have a Flash file for an xml driven menu. There is the document Class, called Main. There is also a Navigation class. In the Navigation class, I position the location of main buttons and sub menu buttons for the menu. I want to position the buttons in the Navigation class relative to the stage. Currently, they are just fixed at certain positions (like 20); To do this, I have read that because this is not happening in the document class.
I must add an event listener to the constructor that listens for the added to stage event. I am not sure how to do this, as when I try and add an event listener for added to stage in the Navigation class nothing happens, (or all menu items diaspear). How to position movie clips relative to the stage (i.e. stage.stageWidth - 50) from a class that is not document class? How to do so in the document class, too.
View 2 Replies
Dec 13, 2009
I am having problems changing text x,y position in a browser window as the browser is resized. Ultimately I plan on positioning an image but just using the text for now. I use the following code:
Code:
stage.addEventListener(Event.RESIZE, wResize);
function wResize(e:Event):void {
[code]......
View 0 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
Aug 19, 2006
I've recently taken Krilnon's tutorial on interactive image panning, and have a need for more complexity. My image to be panned (relative to user's mouse movement) has several 'hot spot' buttons placed within. Each hot spot, when clicked, is to smoothly zoom and shift within the mask, with pertinent info displayed next to each, once zoom and shift is complete. almost like I'm making a motion tween, where the final position is known, but the start position is wherever the BG image is when the user clicks the nested button. I need to determine the x-position at the moment of click of the button (different for each button), and then, I think, use a simple-math "stagger-step" method of moving and scaling, until I've reached my final dest. here's the link to the tutorial I originally referenced:Url...
View 8 Replies
Jan 10, 2007
I want to position a clip near the end of the browser window and to make it fixed there, no matter on which screen resolution my site is viewed. I've tried already doing it using the external movie with fscommand, as well as with Stage.align, but then it applies to all the loaded movies. The rest of the content should be centered.
View 1 Replies
Nov 10, 2007
im using MX 2004 although i do have Flash 9 atm if anyone has an example in that
Anyway, im trying to slow down and speed up an orbit of an mc relative to where the mouse position is. So basically i need some sort of radial "field" where when the mouse gets close to the outside of the orbit the movie clip stops and when it is farther away the movie clip speeds up.
[Code]...
View 1 Replies
Aug 19, 2006
I've recently taken Krilnon's tutorial on interactive image panning, and have a need for more complexity. My image to be panned (relative to user's mouse movement) has several 'hot spot' buttons placed within. Each hot spot, when clicked, is to smoothly zoom and shift within the mask, with pertinent info displayed next to each, once zoom and shift is complete. almost like I'm making a motion tween, where the final position is known, but the start position is wherever the BG image is when the user clicks the nested button. I need to determine the x-position at the moment of click of the button (different for each button), and then, I think, use a simple-math "stagger-step" method of moving and scaling, until I've reached my final dest. here's the link to the tutorial I originally referenced:If anyone knows of a tutorial or example out there, I'd love directions to it(them). or,
View 1 Replies
Oct 13, 2009
i'm making an accordion menu with tweenlite, the menu works, but i want to know how can i make the code simpler for the relative position of each movie clip, i create a variable and override the variable inside the function for each movie, there is a better way to do it?[code]
View 4 Replies
Jun 11, 2009
How can i find line number in events like mouse clicked, key down and key up. And also highlight that line with color. I used TextArea.
View 1 Replies
Jul 1, 2011
if there is a way to get by Actionscript the position of points in a polygon made using Pen Tool?
View 3 Replies
Aug 5, 2003
I always see these bezier curve things where you can like choose how to make the line bend and everything and today i started expirimenting with the drawing API and found out that it's incredibly easy to do. My question is how do you make it so that the position of the anchor points refreshes every frame? I have the basic idea I just can't quite figure it out.
View 7 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
Jul 6, 2011
im using flash professional cs5.5 Here's my issue: I'm trying to translate my flash site with a .txt (loadvariable)
Here's my code so far:
It loads automatically the english at start so..
Code: Select allloadVariables("english.txt", "_level0");
and then, on button160 I have this
Code: Select allon (release)
{
loadVariables("french.txt", "_level0");
}
So I can only translate it one time... then I cannot revert back. How do I do it ?
I tried doing:
Code: Select allon (release)
{
if (var == "english.txt")
{
[Code].....
View 1 Replies
Jan 26, 2010
Is it generally to position elements relative to other elements or in absolute values?
View 2 Replies
Feb 18, 2009
create a costumized crosshair replacing my mouse?here's the conditions
1. my mouse pointer will dis appear and get replaced by a semi transparent picture of a snipers crosshair
2. each time my crosshair pointed on any object in my screen it will change its color, lets say the original color is white, when i pointed at a button it will change it color to red.
View 3 Replies