Making an Object Move (Smoothly) in AS3
Hi again, I think I might of already posted this, but the forums are loading at about 400k a sec so I don't feel like wwasting another 25 minutes just look through the first page of threads or my history.
I have an object that I want to smoothly move along the x axis when the user clicks on the screen. I first made a prototype that would make the ball end at a location I specified by doing x = 450;. I then tried looping ball1.x += 1 with a for/do (I encapsulated it with a boolean so the if ball1.x got to 450 it would stop) statement and I couldn't see the ball transition, I just saw it stop at the 450 mark. Anyone know how to do this? I know you do because I've seen you it.
BTW, the reason I didn't just do a motion tween was because I have it set up so you can move it along the y axis by moving the mouse. Thanks in advance.
You can find all of the information about the Tween class in the help documentation.
Here's a line copied from the Tween constructor section.
public function Tween(obj:Object, prop:String, func:Function, begin:Number, finish:Number, duration:Number, useSeconds:Boolean = false)
Parameters
obj:Object — Object that the Tween targets.
prop:String — Name of the property (obj parameter value) that will be affected.
func:Function — Name of the easing function to use.
begin:Number — Starting value of the prop parameter.
finish:Number — A number indicating the ending value of prop parameter (the target object property to be tweened).
duration:Number — Length of time of the motion; set to infinity if negative or omitted.
useSeconds:Boolean (default = false) — A flag specifying whether to use seconds instead of frames. The function uses seconds if true or frames in relation to the value specified in the duration parameter if false.
Similar Messages
-
Making One Object Move, both players see it fine, but very slow.
Hi there,
I am simply trying to send one object (movieClip) move from the left side of the stage to the right side. I am able to accomplish this by using the following very simple code:
/////////////////////////////CODE///////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
//PRESSING RIGHT, MAKING BOX MOVE
public function pressingRightMakingBoxMove(e:KeyboardEvent) {
box.x += 3;
moveBox.sender = netGroup.convertPeerIDToGroupAddress(netConnection.nearID);
moveBox.user = "" + netConnection.nearID;
moveBox.xx = box.x;
netGroup.post(moveBox);
public function netStatus(event:NetStatusEvent) {
switch(event.info.code){
case "NetConnection.Connect.Success":
setupGroup();
break;
case "NetGroup.Posting.Notify":
receiveBoxMovement(event.info.message);
break;
public function receiveBoxMovement(moveBox:Object):void{
box.x = moveBox.xx;
////////////////////////////////////////////////////////////////////////////////////////// ENDCODE//////////////////////////////////////////////////////////////
It works fine, the box moves on both screens, but you can obviously tell there is latency. Should I be sending movements through an Object? Perhaps there is a quicker way, sending it through strings or text? Definitely not acceptable over UDP.
Thank youNetGroup.post() may have significant latency, and postings may arrive in a different order than they are made. it is not intended for time-critical communication.
to get the lowest latency (and most efficient transmission) for N:N communication (including 1:1), you should use the 1:1 P2P APIs (NetStream.DIRECT_CONNECTIONS and explicit peerIDs) and be sure NetStream.bufferTime=0. it sounds like this is the most appropriate for your application.
for 1:N or M:N (M << N, N > 4) communication, you should use P2P multicast. but P2P multicast may also have significant delays, especially while starting up. -
Object movies in dps how?
i want to add a quicktime object movie to an indesign dps which i want to save as an app or as a magazine but i cant seem to find out how - i have seen someone talk about it i think it can be done but dont have a clue how to do it can anyone help?
yo bob thanks - ive been making vr panos and obj mov for over 15 years but have no idea how to make one in these codecs - could you help me a litte further and suggest some software that will do it on a mac - say i have the images to make the obj movie but need something to stick them together maybe ad hotspots etc
i was also reading some were that you could add a html link to a DPS which was going to be an ap- which is where i want to go in other words the aim of adding my obj movie is so that i can save it out as a ap any help most gratfully recieved ! as garden gnome obj software on saves out to jpeg codec -
Objects move when adding pages
When I add/remove pages, or just move pages around in my document using the Pages panel, random objects on some pages move. They normally move just a slight amount, and stay with the page, but it is very annoying. I never know which objects will move, and I have to spend a lot of time trying to find the ones that have moved. Then if I move pages again, or add/remove pages, other random objects move. Does anyone else have this problem, or know how to stop it?
Thanks!Try sending one of these files through .idml and see if it makes a difference. See http://forums.adobe.com/thread/526991 You may also want to try replacing the preferences. See http://forums.adobe.com/thread/526990 If you don't know what layout adjustment is, it's not likely that you've turned it on, and it probably wouldn't do this anyway except to move objects snapped to guides on master pages that have different left/right layouts.
-
I see a line when an object moves fast
Ok, I shoot a Video with My CANON XHA1S AT: 1440 X 1080 30 fps, with the speed of 60. I created a new project as you can see in Capture Shot.
I don't know why, But I suddenly see a shakey - line when a hand or any object moves close to the camera. Inside my Timeline I Slowed Motion few Tracks to 32%, the rest is at normal speed, When I check the speed for other Tracks it shows 99.9 %.
Any answer please
Thanks
SimonTry rendering a small part (and exporting it) of your timeline and preview it. Is the line still there?
My experience now is that with the hacked Mercury, the preview is not always top notch but rendering is.
Are you using interlaced video (you seem to be)? If yes, and you are slowing down your footage the shutter speed you used will make a huge difference in your slows. Usually you want it to be double what you normally use. 60 would be the bare minimum. 250 would be great.
On my XH A1 (not your model) 120 works fine (increasing it to 250 would mean I have lots of light, like outdoors for example). BTW, try the 60i mode. It has *double* the frames, which is great for slows. -
Hey there, I want to ask and need your help. I just convert a MTS file to mov. And it suddenly ruin everything in my Macbook Pro. I was convert it to mov, but when I play it back on my Mac/windows, its lag and sometimes the picture like waving everytime any object move in video. And then start from that, all my video file become green screen. But when I play, it works, its not green but lag/waving picture. I tried to put in to my premier pro, and it starts affecting another footage file. After the render, all footages become waving. Do you have any Idea why it happens? I've been doing this for the last 10 months but this is the first time it happens to me and my video.
example like waving picture for a movement in videoall preview screen become green
Message was edited by: rizky ramadhanI prefer this
iPad Manager software, with the assistance of iPad Manager, you can make iPhone ringtone, connect your PC to iPad to backup iPad files to Computer directly, import computer file or folder to iPad.
Furthermore, it's easy to convert DVD/video to iPad.
This versatile iPad Manager can help you transfer videos, songs, photos from computer to iPad and from iPad to PC in fastest speed. Have a try with this tool and manage your iPad, iPod, iPhone in a much easier way.
* Convert DVD/video to iPad
* Backup iPad files to PC
* Import computer file or folder to iPad
iPod Manager
iPod Video Converter
DVD to iPhone Converter
iPod Mate -
Audio Selection in 3.0: How can I get the cursor to move smoothly?
I need to be very precise in editing clips in Multitrack View. Right now, the only way I can get the cursor to move smoothly (and not in that herky-jerky motion between zero-crossing points or whatever that it defaults to) is by holding down the CTRL key while using the Hybrid tool. Is there a setting for this somewhere so I don't have to do this every time? Thanks.
SteveRight click on the timescal at the bottom of the waveform display. You will get a drop down box that allows you to change DisplayTime Format, Snapping and Zooming. Go to the Snapping menu and turn on or off those that you want to use.
-
Lenovo G50 mouse does not move smoothly
Hello, I recently bought a Lenovo G50. Today the pointer of mymouse (touch pad) does not move smoothly. That's very irritating. Someone has an idea what the cause (and solution!) is? King regard, Marije
Hi Marije,
Welcome to the Forums
As per the query we understood that you are facing issue with touchpad in your Lenovo G50 laptop.
Try to increase the sensitivity of the touchpad and check for the issue, also boot the system into safe mode and check for the issue.
Click here for the driver for windows 7.
Click here for the driver for windows8.1
Hope this helps. Do post back if the issue persists.
Best regards,
Ashwin. S -
Photoshop/Premiere Elements 13...are either capable of making time lapse movies from still images? I heard this feature was removed from Premiere 13, after I purchased it =(
jorgeavanza
It am not understanding clearly what program is not closing
Photoshop Elements
or
Premiere Elements
There is the AdobePremiereElements.exe for Premiere Elements (video editing) and the PhotoshopElementsEditor.exe for Photoshop Elements (photo editing).
Right now you keep mentioning Premiere Elements, but I am seeing your description more like Photoshop Elements.
Please clarify so that we can focus on the correct program and try to resolve its problems.
Thank you.
ATR -
Need algrithim for constantly making new objects
How would I go about making an object and then remake the same object again but with a different name.
here is the problem:
for(int i=0;i<23;i++){
//But i want the second time to run around and create a Printer object
//named something else not printer.
Printer printer = new Printer();
any help would be appreciatedWell I my case I'm trying to get different names. So I guess the easist thing I can do is to make an array. But then it brings me to this question,
This is my class:
import java.awt.*;
public class Printer {
public void init(){
public void paint(Graphics g,String string,int x,int y){
g.drawString(string,x,y);
}if I wanted to make an array out of it like so:
Printer[] print = new Printer[xAmount];It says nullPointerException when I try to access the class's function by doing this:
print[0].paint(g,"test",2,3);What can I put in print[0] to make it not null? I mean you can put numbers and letters. (
Message was edited by:
jkhoa
Message was edited by:
jkhoa -
I'm trying to move to AS3. I have a simple animated loop, on
the last frame of the timeline I have a gotoAndPlay(4);
In AS2 the back ground loop plays seamlessly, but in AS3 it
pauses for a second, or a frame, so the loop is not smooth.
Why is that?
Thanks!When I publish this in Action-Script 2 the back ground loops
seamlessly. But when I publish it in AS3 it pauses. If I remove the
gotoAndPlay and shave a frame off at the end, it loops seamlessly
in AS2 and AS3. But often when making a game, or something, I rely
on making a loop with a gotoAndPlay somewhere on the timeline, is
this possible in AS3?
http://www.calicoradio.com/backgrnd_loop_test_fla.zip
Thanks. -
How Would One Go About Making an Object Rotate to Face in Direction of Mouse?
I'm just a teenager who happens to have Flash as part of CS4 Production Premium, which I got as a gift. I don't have any training or previous experience in Flash, and have only just in the past few month been looking into what ActionScript is. I've just been fiddling with Flash in my spare time, just as something to do, and am working on making very basic computer games. Currently I am trying to make a very basic top-down shooter computer game. I've gotten it to where I can move the player (a circle with an arrow on the edge) in eight directions using the standard FPS movement keys (W,A,S,D) and make it move faster for a limited time by holding down the SHIFT key.
But now I've come to a standstill. I am trying to make the player rotate in the direction of the mouse cursor (made to look like crosshairs) so that the player can move in any of the eight directions and aim in any direction at the same time. I've searched the Internet for hours on end, looking for anything that might help, but not a single Web page section relates to this kind of thing. So now I'm giving up on searching for a help article, and am making one instead. Is there anyone that's successfully done this kind of thing before? Or at least someone who actually knows how to properly use ActionScript 3.0 and can figure it out themselves, then tell me what they did? (In the meantime, I've made it so that the player rotates and faces in the direction he is traveling in.)
I've attatched all the code that I've typed to make the game work, so that anyone can look at it and tell me if I'm doing something wrong already. I've only been learning ActionScript by figuring it out on my own as I go (watched a few videos I have on a disc too), and in the case of this game, I've just been making is up as I go, so to all of you people who actually know this stuff pretty well, this code is probably going to look nasty.I pasted it to the bottom of my code on the main timeline (correcting it for my use), but I get this message in the Compiler Errors window:
Warning: 1090: Migration issue: The onMouseMove event handler is not triggered automatically by Flash Player at run time in ActionScript 3.0. You must first register this handler for the event using addEventListener ( 'mouseMove', callback_handler).
So what do I do about that? (again, I'm just a beginner, so I don't know what any of this means)
(attached is a snapshot of the various objects refered to in the code. also the original code is attached to the original post. in case these help at all.) -
Script for making an object the artboard size.
I am looking for some help on trying to make an object the exact size of the artboard. This is something I do on a daily basis for several different reasons and it would be very helpful if this can happen automatically for whatever size the artboard may be. As I understand it the only way is with a script but I have no experience with making illustrator scripts, im definately no programmer. I have set up quickkeys in the past to copy from the artboard inputs when you are on the artboard tool but these round to the nearest .01 and this is not accurate enough for what I am working with. Also if I do this with multiple pages open illustrator is very slow to respond to the artboard tool. If anyone has any idea where to start or has seen other such scripts I would greatly appreciate it. Thank you.
Below is a script that I saw on here that I believe may contain what I need but now knowing programming I have no idea where to start on editing. All I need is the part where an object is placed on the artboard that is the exact same size as the artboard. If anyone can advise on editing I would greatly apprecaite it.
#target illustrator
function main() {
if (app.documents.length == 0) {
alert('Open a document before running this script');
return; // Stop script here no doc open…
} else {
var docRef = app.activeDocument;
with (docRef) {
if (selection.length == 0) {
alert('No items are selected…');
return; // Stop script here with no selection…
if (selection.length > 1) {
alert('Too many items are selected…');
return; // Stop script here with selection Array…
} else {
var selVB = selection[0].visibleBounds;
var rectTop = selVB[1] + 36;
var rectLeft = selVB[0] - 36;
var rectWidth = (selVB[2] - selVB[0]) + 72;
var rectHeight = (selVB[1] - selVB[3]) + 72;
selection[0].parent.name = 'CC';
selection[0].filled = false;
selection[0].stroked = true;
var ccColor = cmykColor(0, 100, 0, 0);
var ccCol = spots.add()
ccCol.name = 'CC';
ccCol.color = ccColor;
ccCol.tint = 100;
ccCol.colorType = ColorModel.SPOT;
var cc = new SpotColor();
cc.spot = ccCol;
selection[0].strokeColor = cc;
selection[0].strokeWidth = 1;
var tcLayer = layers.add();
tcLayer.name = 'TC';
var padBox = pathItems.rectangle(rectTop, rectLeft, rectWidth, rectHeight, false);
padBox.stroked = false;
padBox.filled = true;
var tcColor = cmykColor(0, 100, 90, 0);
var tcCol = spots.add()
tcCol.name = 'TC';
tcCol.color = tcColor;
tcCol.tint = 100;
tcCol.colorType = ColorModel.SPOT;
var tc = new SpotColor();
tc.spot = tcCol;
padBox.fillColor = tc;
padBox.move(docRef, ElementPlacement.PLACEATEND);
artboards[0].artboardRect = (padBox.visibleBounds);
redraw();
rectWidth = (rectWidth-72)/72;
rectWidth = roundToDP(rectWidth,1);
rectHeight = (rectHeight-72)/72;
rectHeight = roundToDP(rectHeight,1);
var textString = rectWidth + ' x ' + rectHeight;
prompt('Copy Me', textString);
main();
function roundToDP(nbr, dP) {
dpNbr = Math.round(nbr*Math.pow(10,dP))/Math.pow(10,dP);
return dpNbr;
function cmykColor(c, m, y, k) {
var newCMYK = new CMYKColor();
newCMYK.cyan = c;
newCMYK.magenta = m;
newCMYK.yellow = y;
newCMYK.black = k;
return newCMYK;Thanks to CarlosCanto for the original script, it was very a very helpful starting point to optimize one of our workflows. We customized it a bit to maintain the aspect ratio (just takes the greater of the width / height and scales proportionally to the artboard size), and also center up the object in the middle of the artboard once scaling is complete. I hope it is helpful to someone:
#target Illustrator
// script.name = fitObjectToArtboardBounds.jsx;
// script.description = resizes selected object to fit exactly to Active Artboard Bounds;
// script.required = select ONE object before running; CS4 & CS5 Only.
// script.parent = carlos canto // 01/25/12;
// script.elegant = false;
var idoc = app.activeDocument;
selec = idoc.selection;
if (selec.length==1)
// get document bounds
var docw = idoc.width;
var doch = idoc.height;
var activeAB = idoc.artboards[idoc.artboards.getActiveArtboardIndex()]; // get active AB
docLeft = activeAB.artboardRect[0];
docTop = activeAB.artboardRect[1];
// get selection bounds
var sel = idoc.selection[0];
var selVB = sel.visibleBounds;
var selVw = selVB[2]-selVB[0];
var selVh = selVB[1]-selVB[3];
var selGB = sel.geometricBounds;
var selGw = selGB[2]-selGB[0];
var selGh = selGB[1]-selGB[3];
// get the difference between Visible & Geometric Bounds
var deltaX = selVw-selGw;
var deltaY = selVh-selGh;
if (sel.width > sel.height) {
var newWidth = docw-deltaX;
var ratio = sel.width / newWidth;
sel.width = newWidth; // width is Geometric width, so we need to make it smaller...to accomodate the visible portion.
sel.height = sel.height * ratio;
} else {
var newHeight = doch-deltaY;
var ratio = sel.height / newHeight;
sel.height = newHeight;
sel.width = sel.width / ratio;
sel.top = (doch / 2) - (sel.height / 2);
sel.left = (docw / 2) - (sel.width / 2);
else
alert("select ONE object before running"); -
Behaviours make objects move in jumps when they are put far from origin.
Hi, i am trying to represent the solar system in java3d, but i have a problem that when you put an object at a point eg.(10000000,10000000,10000000) using a transform3d then attach a behaviour like keyboardbehavior to it, it moves in big jumps instead of smoothly. It will mroe smoothly the closer you are to the origin.
Can anybody give me some help as to why this might be.
Also, Am i using the right type of universe e.g SimpleUniverse, or do I need to use one with a HighresCoord or something.
ThanksSearch Spherical Linear Interpolation.
Gives you smooth transitions between vectors and rotations.
v(t) = (sin(1-t)Q) / sin Q * v1 + (sin(t)Q)/sinQ * v2
where Q is the angle between the two vectors.
Q = acos(v1.dot(v2))
check out http://www.gamedev.net/reference/articles/article1824.asp -
Creating a Plane On Wich Objects move
Okay, for my final Computer Science project I am creating a bomberman game. Originally I was going to use the gridworld case study's grid to put everything on, and then we decided not to use it. We are going to use a contious plane and snap bombs, pillars, and enemy paths to central locations while allowing the characters to move freely.
Here is my question, in the applet is there a way to make a sort of array plane? A set of points on which things can exist and be drawn? Also with user input can just certain sections of the board be redrawn without the entire board being redrawn ever single move? We were thinking about a double buffer but that might slow things down. Yes I know Java is not meant to do video games in, and using DX would be better, but this has to be in Java, and it is a very cool project. I can do everything else. I just need direction in how to make a plane like that in applets? Or would it just be better to place everything, store everything in an array, and just check for collision?IntelliSense in a Java Development forum suggests a disconnect.
Java protocol is set/get prefix for object properties.
With .NET, it'll be just plain InfoObject.ParentID = <value here>
But I'm assuming you're not using .NET, since this post is in the Java Development fourm.
Sincerely,
Ted Ueda
Maybe you are looking for
-
Who has changed the Custom Field value?
Dears, Need to know the information regarding how to fetch that who has changed the Custom field value from PWA/MPP. Example: There is a PDP (say ProjectInfo): There is a Custom Field added to that PDP (say Project Status = In Progress). Now for Proj
-
I'm using RH 9 and generating chm outputs on my Win 7 64-bit computer. I have a core chm help file and several sub chm helps that get merged into it. I have a batch file that regularly compiles our help files locally and then copies them into a commo
-
My wife and I have different taste in music and I have been using her apple account to buy all my music. Well needless to say we are filling up our ipads, ipods, and iphones with each others music. I just got a new computer for my birthday (thanks to
-
Why won't Photoshop CS5 use available memory before scratch?
I've given PS CS5 access to 80% of machine memory (about 8.5 out of 12 GB). Yet, it only seems to use (at most) 3.5 GB of ram, while using 1 or more GB of scratch disk. I had hoped that with lots of memory, I'd avoid using scratch. Am I misinterpre
-
Oracle 8i Stored Java Procedure and OAS 4.0.8
Hi, I'd like to call a Java Stored Procedure from the OAS, like an ordinary PL/SQL package. The Java Stored Procedure should generate HTML-code to display in the browser. My first try was, to use the SQL wrapper function and the PL/SQL cartridge of t