I am wondering about the x, y position of objects. I place a shape at a the bottom of the stage, but then when i check its x, y coords its at 0, 0. Is this correct? so when i start to move it it starts from where i want it on the stage (at the bottom) but the x,y coords are starting at 0,0 also.
I'm trying to trace the path of an object by using setPixel on the object's position every frame in a BitmapData/Bitmap pairing. These pixels aren't showing up normally and I suspect I have a fundamental misunderstanding of the BitmapData class. Here's what I'm doing:
public var contrailBase:BitmapData; public var contrail:Bitmap; private var contrailColor:uint;[code].....
Using this code, the red pixels don't show up. If I initialize contrailBase to 0xFF000000 instead then I get a black screen on which the red pixels DO draw, but I need the bitmap to be transparent except for the contrail. What am I doing wrong?
I'm stuck thinking about the best way to go about setting a line segment's position, I have a class Line(length, angle, previous) being called from a class Polygon. Right now I have:
public class Line extends Sprite { public function Line(length:Number, angle:Number, previous:Line = null) { if (previous != null) { this.x = previous.end.x;
hey guys i have 6 moveable objects, what i want is to be able to click a button and a text field appears that displays the x and y co-oridinates off each object, is this possible and if so is there a way also i could have another button where the user inputs the numbers he wants from x and y and the objects will go to that posisition
The following code works fine when mouse is pressed at any position on the screen ,object moves that position...but what if I want the object move that position at a certain speed..say+10 using setInterval...I mean I want my object move slowly to any position I click on the screen..[code]...
I want to do something which is probably pretty simple but I've got absolutely no idea how to do it!What I want is for the Alpha value of an object (movie clip) to change depending on the x position of the mouse. So when the mouse is at 0 the alpha of the object will be 0%, and when it's at 100 the alpha will be 100%
I came across a problem where my flash timer keeps changing position as the browser window is resized or if the user scrolls down the page the timer will move with it?It also changes position on different monitor screens.Is there an easy way without too much code to position it at a certain position on my page :[URL]As you can see its too low and should be in line with 'Comming soon'Im also using Dreamweaver if that makes a difference.
I have built a site in AS2 and would like to know the position of a ball so that I can move a sign to it always.The whole website is in AS2, but I think I have written an incomplete code below for AS3. I need it for AS2 because the whole site is in AS2. The get position of ball is wrong, but I just wanted to throw in some ideas eg.
Code:
// get position of ball ball_mc.addEventListener(<what goes here?>, ball_pos); function signMove(Event:MouseEvent):void{[code]..........
I'm using sensors in a Box2D project. On a collision with a sensor, I'd like to know the sensor's position in the world. I'm detecting the collision with a contact listener, but the sensor's position is always 0 0.
From my code: (edit, added the whole class) public class MyContactListener extends b2ContactListener { public var onSensorEvent:Function; override public function BeginContact(contact:b2Contact):void { if(contact.GetFixtureA().IsSensor()) { var ud1:GameEntity = contact.GetFixtureA().GetBody().GetUserData(); [Code] .....
The following code works fine when mouse is pressed at any position on the screen ,object moves that position...but what if I want the object move that position at a certain speed..say+10 using setInterval...I mean I want my object move slowly to any position I click on the screen..
I started using Flash again after a "brief" hiatus (the last time I used it, Flash was on it's MX version ).I am trying to create an animation in which I can move across the stage a simple object (a circle, a square or a star, for example) using buttons (left, right, up and down)This was fairly simple using AS 1, even when I was no expert. The thing is that those simple ways are no longer working with AS 3.I spent a few hours doing some research until I found this nice tutorial on this same site:
Code: http:[url]....
I followed the tutorial, and all was working nicely, but when I attempted to do the animation from scratch, it simply didn't work .I even used the same names for all the objects and instances, but still nothiing.
i made a full flash site and ill be adding new stuff, so my plan is to make a button that sends you to a determined position, for example a menu; when you click in "About" section the whole page scrolls along with the scroller (vertical) to where "About" section is, i dont know if i can give an instance name to a movieclip or any object so when clicking the button the stage scrolls where the object or movieclip is, is this posible ?
I am trying to get this an object to go from position A to B and back, in infinity!!I only get the object to go from A to be B and then it stops. The code is in the MovieClip actions.
Here is the code.. onClipEvent (enterFrame) { this.onEnterFrame=goRight; goRight=function(){ if (this._y<250) this._y+=1; else this.goLeft; } goLeft=function() { if (this._y>50) this._y-=1; else this.goRight; }}
How can I get the absolute stage position of an object within a custom flex component that I exported from flash? In my Flex application I'm using the component and resizing it by setting its height and width properties. I want to place another component on the stage but I want it to appear at the same x and y coordinates of a text field in my custom component.
tarting a script to make my object move to the coordinates of where i click on my mouseand if possible i would like to make it animate to each coordinate like its moving there not all of sudden jumps there when you click somewhere.
im trying to keep a object in a certain position in the screen, without resizing it too (with the stage)
function Resize(e:Event = null):void { if ((stage.stageWidth)/(stage.stageHeight) > fundos.width/fundos.height) {
[Code]....
my stage is resizing all ok (keeping the aspect ratio) and im trying to add a nav img that would stay in the same position as i resize the browser screen
What I'm doing is taking an image and "folding" it into a cylinder. I am then placing smaller images at certain points in front of that image. The large image isn't big enough to make a decent-sized cylinder, so I had to use it twice, which is fine. So now I need to create doubles of every small image that goes in and place them at opposite points (from the top perspective) in the cylinder.
Here's my problem: I want my inputs to be a simply x and y representing where the object would be if it were overtop of the flat large image. I take those inputs and (attempt) to convert the x coordinate into an angle, with which I can calculate the object's x and z position, as well as its y-rotation. However, my input range seems to be much more limited than it should be. The problem seems to lie in my angle calculation, since the others are pretty standard. Here's what I'm using right now:
i'd trying to build an interactive tree that allows the user to move the tree's branches and nodes. the lines (branches) of the tree are drawn programmatically between points (nodes and tips). i'd like for the user to click on points to drag them while having connected lines and points move correspondingly. i've gotten this to work to some extent using the code below:
ActionScript Code: function startMoveOa(evt:MouseEvent):void { thisPtOa = Sprite(evt.currentTarget);
I'm often finding a need to get a stage-relative position of objects in my game, which are often buried several layers deep as children of children of children, etc, often with differently scaled/moved/rotated parents. The position i want isn't quite relative to the stage, but a main holder object i have on it called lvlHolder (see code below). I wrote a function to deal with it that recurses up the display list, accounting for each object as it goes, to get a global position. It's worked so far, but one thing it doesn't account for is rotation. I'm finding a need for that now, and i'm not sure how to account for rotation of objects, to rotate offsets from them,
My function is below. how i should enhance it to accomodate for the rotation of each parent object? Also any tips on optimisation would be good, as i'm using this a LOT (roughly twice per frame, per object, for physics calculations) I'm also wondering, in similar situations i've seen something related to transform matrices used
I am trying to find out a nice simple way to make an object decelerate / ease into position. I have seen that there are loads of different ways of doing it but I wondered if there is a good simple function that can do the job??
this should be pretty simple for most, but I would like an explanation more than just a quick code fix. I put all the script together for this object, here is the fla. What I want to do is move it up to the y position as it does, but I need the object to move faster and stop there. Since I have given most of script in the main movie, I don't know how to write the script for the button release. All I can get it to do is crawl up with targety=100; but I still have the problem with the mouse follow once my button is pressed.
I've always wondered if there was a way to retrieve and store the current position of an object. i am trying to develop a background slideshow using penners equations. but i get into trouble because you have to define the start position. so let's say you click button 1, and the object moves from x =0 to x = 200. Now when i press button 2, i want the object to move from x = 200 to x = 400. and if i then press button 4, i want it to move from x=200 to x=800 and so on. So i need to go from the current position to any of the new positions. i could do this simply using the normal inertia code.
i wanted to make an object to reset to the default position, like i move it around and when i hit a button he goes to his position for example x: 233 and y:431
I have some texboxes which I need to stay a fixed distance away from another object at an angle.so I need to say textbox_mc position is 10 pixels away from my_Object at an angle of 35 degrees.The angle is changing and the object is moving, I think I can handle that if I know how to position by angle and distance.
A simple moveTo(x, y) call before beginBitmapFill does not work :/ Neither does changing the x and y value of drawRect... (That just seems to have the same effect as an translation with the matrix...) Additionally I don't want do draw that thing in a separate Graphics-Object and add that one into the other...