Changing the speed of MovieClip

Hi, I am new to Flash and Actionscript and am currently working on some code pulled from another post to try and learn from what others are doing or have done. I have created a star movieclip and am attempting to move it randomly accross the stage in a relatively slow speed. When I run it, it moves randomly but way too fast. I have spent the last 6 hours playing with the code, researching help files and also looking up other discussions but nothing seems to be helping. Here is what I have so far. My apologies if the code looks like a hack. This is being done in CS4 if that matters at all. If anyone could shed some more light on how to handle controlling the speed or rate of random movement with some insight, I would be greatful.
Thanks,
Ather
//-- import the flash classes first for tweening
import fl.transitions.Tween;
import fl.transitions.easing.*;
//-- the ENTER FRAME event is needed to animate and move objects via script and moves it through frames
addEventListener(Event.ENTER_FRAME, starMove);
//-- this function keeps moving the star across the screen
function starMove(e:Event):void {
    var Speed:Number = 5;
    var Sx:Number;  // x speed
    var Sy:Number;  // y speed
    var dx:int = Math.random();
    var dy:int = Math.random();
    star_mc.x = (Math.random() * stage.stageWidth);
    star_mc.y = (Math.random() * stage.stageHeight);
    Sx = Math.random() * Speed;
    Sy = Math.random() * Speed;
    star_mc.x += Sx * dx;
    star_mc.y += Sy * dy;

The problem is that you recalculate all the parameters inside enterFrame event listener and I don't see any algorithm that makes sense in terms of these calculation. Here is an example how it can be done in principal (replace star Sprite with you object):
// replace it with your star
var star:Sprite;
// speed along x
var sx:Number;
// speed along y
var sy:Number;
// direction along x
var dx:Number;
// direction along y
var dy:Number;
// maximum speed
var maxSpeed:Number = 5;
init();
function init():void
     star = new Sprite();
     var g:Graphics = star.graphics;
     g.beginFill(0xff0000);
     g.drawRect(0, 0, 20, 20);
     g.endFill();
     addChild(star);
     // position it so it is always visible at start
     star.x = stage.stageWidth * .25 + Math.random() * stage.stageWidth * .5;
     star.y = stage.stageHeight * .25 + Math.random() * stage.stageHeight * .5;
     // initital parameters are random
     sx = Math.random() * maxSpeed;
     sy = Math.random() * maxSpeed;
     dx = Math.random() > .5 ? 1 : -1;
     dy = Math.random() > .5 ? 1 : -1;
     // start animation
     addEventListener(Event.ENTER_FRAME, moveStar);
function moveStar(e:Event):void
     star.x += sx * dx;
     star.y += sy * dx;

Similar Messages

  • How do I change the speed of a video clip after making it a Smart Object?

    In order to apply the same Camera Raw filter to every segment of a clip I was going to split multiple times, I converted the whole clip to a Smart Object, applied my Camera Raw filter settings, and then split the clip and deleted some portions.  Now I want to make certain portions of those clips slow-motion, but even if I right-click on the right side of the layer and select "Clear Smart Filters", all I see when I right-click on the clip in the timeline are the motion options; I can no longer change the speed or the audio.  Is there a way to do this without having to make all the cuts in the beginning, changing the speed and the audio, and then having to go back and convert each individual segment into a smart object and then apply the same ACR filter to each one?

    Brett,
    Thanks for addressing this question.  I tried it and see that the embedded file is the entire clip that I started with, not the trimmed version that I turned into a SO, but at least I could go back and make a change that way in a pinch. 
    If you wouldn't mind looking at this video between :50 and 1:40, and tell me if you think that AE or PP would give me significantly better results in the jumping segments where I slowed it down to 25%:  2014-06-26 And the last thing I expected to see jump out of the box was Albert Einstein! on Vimeo.  I am trying to keep my expenses down by only using PS CC for video editing, and love the Camera Raw filter capabilities.  By using PS CC it also lets me lay down my audio and edit to the audio w/o, as Mylenium suggested, outputting my file from PS CC into either AE or PP to do the slow-mo part. 
    Thanks again for your help!
    Tara

  • How do I change the speed of the Final Cut Pro X "Ticker" Title option?

    I am moving from iMovie to Final Cut Pro X.  I used to use the "ticker" title option all the time in iMovie, but when I utilize it in Final Cut Pro X, it scrawls really slow and only shows the first line of text before the video ends.  How do I adjust the speed of this option?

    This Motion template effect isn't very useful at the moment.
    Sadly, the only way of changing the speed is to modify the effect in Motion.
    The speed is designed to get the word 'Information' at the default size and default typeface across the screen over the duration of the clip. If you add more text, or change its size, the text will not move off the edge of the screen by the end of the duration of the generator.
    Alex4D

  • How do you change the speed of a detached audio clip?

    I have a piece of detached audio.  Video Frame rate is 23.98.  The piece of Video above it is Video Frame Rate 24.
    How do I change the speed of this detached audio clip?

    Nope, the Automatic Speed did not work.  I exported the XML, and then ran it through X2Pro to try and get my AAF, and it still spits out conform warnings/errors on those same spots.  Automatic Speed apparently did nothing helpful to my situation.  (Can Anyone explain Automatic Speed?)
    Will have to try going through Cinema Tools per the similar issues noted in this conversation: http://forums.creativecow.net/thread/344/28007
    Curious to see what FCPX would do with this media, importing the 24p file to a 25 Project cause a noticeable shift in both time and pitch.
    I imported the time coded audio separately, and played it against the obviously speed and pitched changed video with embedded audio. The files did not sync.
    The audio remained in time and pitch, while the video didn't. So the audio tc doesn't seem to effect playback in FCPX, but video definitely does, and it seems rather buggy.
    So, if your video is 24.0 and your audio is 23.98 and you are in a 23.98 timeline, FCPX might be changing the speed of the video without really reporting it. Resetting speed doesn't do anything, hitting "automatic speed" screws it up a bit more (it goes the wrong way). Changing the speed to something like 96% (FCPX reports 96% but I know it's really ((24000/1001)/25) which is just short of 96%. Turning off the "preserve pitch" checkbox actually pitched the audio back to normal.
    I didn't create the 24.0 vs 23.9 media that you have, but perhaps you are having similar issues, or a different combination/permutation therein.
    But to answer your question, the time coded audio was not changed, only embedded audio.
    and
    But here some notes which makes things hopefully clearer.
    Resampling and changing playback speed are two totally different things.
    Samplerate for audio is the same as fps for video (not dpi for video) so let's call it sps.
    You can record audio at any sampling rate. But let's take 48 kHz and 32 kHz here.
    Record 60 seconds. Once recorded both files as stand alone files will play 60 seconds.
    But forced to play back in a NLE timeline with a fixed sps of 48 the first file will playback correctly. The second one will play at 2/3 of the time (32/48). The other way round the 48 sps file will play longer in a 32 sps timeline.
    Now for those poor guys who have to work with NTSC:
    A real world second is not a second in NTSC video world. Its 1001/1000 seconds.
    So selecting a 48k sps audio preset in a timeline preset means that a real world audio of 60 seconds is only 1000/1001x60. That means that those 60 seconds are only 59.94 seconds long. Its too short.
    One way - if you stay strictly in NTSC - is to record audio with 48048 Hz. This way a real world 1 second audio will match a 1 second NTSC video.
    Next option with BWAVE files is to change the playback settings in the BEXT header of the file. This won't resample the file!!!
    Now about the TC. BWAVE doesn't have a TC in a way you're used when handling video. It has a timestamp in the header. This timestamp contains the Samples after Midnight. Based on that the NLE will convert this to TC which can be displayed. So in NTSC world this might give a wrong interpretation.
    For example if you have a "Start TC" of 00:10:00:00 (thats what you see on your audio recorder) it means that using 48kHz the timestamp is at 600x48,000 = 28,800,000 samples. Since the real sampling rate in the timeline though is 48048 Hz you have to divide the source stamp by this number. This results in 9.99000999000999 minutes. So for a 23.976 fps project this is a TC of 00:09:59:10.
    So setting the Bext header and/or iXML chunk to the correct playback speed will keep everything intact. Again this is without resampling!
    Using an AIFF there aren't these options.
    So you can edit all the stuff without resampling when using BWAVE. But resampling will happen when you export a final movie.

  • How to change the speed of a slideshow

    How to change the speed of a slideshow

    In my test, all I need do was right click the clip and make sure Frame Blend was not checked.

  • How can I change the speed of a video clip?

    hi, I'm a new user of iMovie 08.
    I fail to find the function button that can make a video clip slow down or faster, such as change the speed to 60% of the normal speed,etc.
    I know iMovie 06 has this function,it's in video FX,duration,speed...but I can't find the menu in iMovie08.
    Is there anyone knows where it is?
    many thanks!

    Upgrade to iMovie 06.
    Slow / Fast Motion is easy with iMovie 06.
    iMovie 06 is a free download to iLife 08 owners. (THEY WANT YOU TO HAVE IT!)
    http://www.apple.com/support/downloads/imovieHD6.html
    Much has been written about the differences between iMovie 06 and iMovie 08. I have found the below link to be helpful.
    http://www.geethree.com/slick/imovie8.html

  • I am trying to speed up my video clip in imovie 09 but it doesnt give me the option to change the speed on my video adjustments clip tab..Help me please..

    I am trying to speed up my video clip in imovie 09 but it doesnt give me the option to change the speed on my video adjustments clip tab..Help me please..

    If you right click on your clip, does it offer to Optimize Video? If so, after you optimize you can change the speed.

  • Changing the speed of the ethernet card

    Referring to this topic I posted earlier: http://discussions.apple.com/thread.jspa?threadID=568098&tstart=0
    I called my ISP, and they could only think of one thing: that there is a conflict between my MacBook's fast ethernet card and my old DSL box (that is capable of only 10 Mb/s).
    So, they suggested I try to change the speed of my ethernet card to 10 Mb/s.
    The problem is, how do I do it?

    I think your ethernet builtin is downgrade compatible, which mean it will run on 10 mbps too without you have to changed the speed.
    It is the first time I hear that we should adjust the transfer rate to lower setting.
    If your ethernet card max is 10 mbps and you want to use 100 mbps, than you must change the ethernet card or use other external ethernet card, not the other way around.
    Good Luck

  • Changing the speed of Ethernet Link of the PC to 10 or 100 MBPS

    Hello,
    I need to change Ethernet Speed of the PC programmatically that is change the Speed to either 10 or 100 mbps.
    Is it possible, If yes , then please let me know the procedure. 
    Or atleast I should be able to read the PC Ethernet speed in LabVIEW.
    Thanks
    Solved!
    Go to Solution.

    You dont need .net 4.0 for this (.net 2.0 is good enough) or anything else installed.
    I have attached a VI with the control.
    PS: If you need to load .net 4.0 assemblies in to LabVIEW, you need to follow instructions in this link:
    http://digital.ni.com/public.nsf/allkb/32B0BA28A72AA87D8625782600737DE9
    Beginner? Try LabVIEW Basics
    Sharing bits of code? Try Snippets or LAVA Code Capture Tool
    Have you tried Quick Drop?, Visit QD Community.
    Attachments:
    network info.vi ‏7 KB

  • Hi i am currently editing clips in premiere pro cc but everytime i go to change the speed not the duration of a clip it will not let me select it - also when i go to effect controls it will not let me select time mapping? please help

    Hi i am currently editing clips in premiere pro cc but everytime i go to change the speed not the duration of a clip it will not let me select it - also when i go to effect controls it will not let me select time mapping? please help

    savannahp
    What version of Premiere Elements and on what computer operating system?
    Please review the following that I excerpted from an older post here regarding Adobe's PRE_help comments about Hollywood Effect and mention of
    Red Noir. Does any of the following apply to any of what is happening to you.
    - Whenever I try to add an effect from the Hollywood Looks menu, it brings up a warning that all my previous effects on that clip will be deleted. However it will let me add those same effects *after* applying Hollywood Looks.
    This is because of how the Hollywood Looks are designed to be used. Since these are effect presets (multiple effects in combination) that result in a specific "look"; they are best applied in isolation. If any previous effect is applied and we still allow a Hollywood effect to be applied, we will not be able to see what the effect does clearly. For e.g. if you already have a Gaussian Blur effect applied to your clip, and then we allow you to apply the "Red Noir" Hollywood effect, the fact that the "Reds" in the scenes will be highlighted and the others converted to B/W will not be clearly seen since the content is already blurred out. So any previously applied effects was designed to be removed. This holds good even if you apply a Hollywood look "on top of" another one. The previous one will be replaced. Having said that, you can customize the look further by either tweaking an already applied filter or by adding a newer effect on top. That is the reason you can apply an effect on top of the Hollywood Effects and not vice versa.
    Please review and consider and then we can proceed from there if necessary.
    ATR

  • Can i change the speed of the track?

    I got one track that instrumental and other one is vocal..and i hope someone can teach me how to change the speed of the vocal in garageband.thanks!

    "in every track you have the option to check or uncheck the 'follow tempo and pitch' option"
    This does not appear anywhere in the interface.
    "you have to change the region's color to purple first)."
    The suggested (obscure) key combo does nothing.
    If you delete all tracks and then drag a wave file from Finder into your project, GarageBand messes up both the playback speed and pitch. Furthermore, the so-called track "track info" on the right makes no sense. It always displays "Real Instrument" and "Master Track", even when this is not the type of track you're working with.

  • How to change the speed of a clip without frame blending?

    Hi,
    I changed the speed of a clip to 200%. I expected Premiere to drop every second frame. Instead, there is some frame blending making my progressive footage interlaced. For some reason, the frame blending cannot be disabled by using the Use Frame Blending option.
    How can I make Premiere simply dropping every 2nd frame?
    Thanks in advance!

    In my test, all I need do was right click the clip and make sure Frame Blend was not checked.

  • Change the speed of the Directions.HD Template

    I want to use this template (Direction.HD) but it goes way too fast for my project. I can't find where to change the speed of any of the elements - particularly the arrows. The only items that I can find a speed on are in the Video Group - the clone layer and the drop zone - but nothing on the arrows. Is there some timing I can do to make the arrows move slower?

    you will have to get dirty and dig into all the layers and change their timings. Having not seen this template I don't know if it uses behaviours. If you're not that familiar with Motion this is a great way to learn. You may have to move keyframes to later in the timeline, therefore slowing down the animation, or you might have to fiddle with values in a Behaviour.
    hth
    adam

  • I'm on FCPX 10.1.1.  Is there a way to change the speed of a keyframe effect?  I have still images zooming onto the storyline, but I can't find any way to speed up or slow down the zoom time.  Any help would be greatly appreciated.

    Is there a way to change the speed of a keyframe zoom effect on still photos?  Clip duration doesn't seem to change the zoom speed at all.  Any help would be greatly appreciated

    Open the video animation (Control-v). In transform>All click and drag the X and Y keyframes (which should be together) – left to speed up the scale change and right to slow it down . It may take a little practice to get this to work (I seldom get it right the first try).
    You could do this individually for each clip, or you wanted to adjust multiple clips you can copy and paste attributes to your other other clips.
    Russ

  • Best way to change the speed of a sequence of linked short clips?

    I have a sequenced project of about 150 short 1 second clips linked together via a crossfade transition... I would like to make the timelapse faster. What is the best way to change the speed of the sequence or the clips themselves? I would rather change the sequence for it would be less labor intensive I would imagine!!
    Thanks
    RD

    Or...select all the clips in the timeline, control-click (or right-click) on them and select 'Duration'. Change the duration to whatever will fit/fill the timespan you need, then hit OK.
    If you're needing to change the dissolve as well, you should remove all but one of them first, then drag the remaining transition into the browser. Dbl-click it into the viewer, set the duration of what you want, then use the hand icon at top right and drag it back into the browser. Rename it relevent to it's new duration, then control-click on it and select "Make Default".
    Now, set an inpoint at the first frame of your clips in the timeline, then drag all the shortened clips from the timeline into the canvas and release where it says 'Overwrite with Transition'.
    That's another way to accomplish this.
    K

Maybe you are looking for

  • Header excise duty getting multiplied by 10 and tds also,

    During MIGO while capturing excise invoice it display the Excise duty amount multiplied by 10. for instance, basic price is Rs.100 and Excise Rs.8,in line items it gives rs.8 but in header Rs.80/= and after posting the document in Part 2 entry with r

  • Invoice GL Date vs Journal Accounting Date

    I created an invoices in AP. The invoice date and GL date for the invoice is 12-JAN-10. I ran create accounting process. A journal was created in GL. The accounting date for this journal is 31-JAN-10. Why the accounting date for the journal is not th

  • Moved iTunes folder to a shared folder and lost all of my playlists

    Any way to recover, I just moved the iTunes folder to the Shared Music folder so that my wife's account on the PC could use the musica as well...any way to find/recover the playlists? If i sync, will it remove them from my ipod?

  • Please Advise: iPod mini 1st gen. questions and issues

    Hi all, thanks for your attention! I have, what I believe, is a 1st generation iPod mini - I purchased it in early/mid 2004. I love it, and don't want to just trade it in for one of the newer ones, that do 5 million more things than I really need. I

  • Set request timeout for distributed cache

    Hi, Coherence provides 3 parameters we can tune for the distributed cache tangosol.coherence.distributed.request.timeout      The default client request timeout for distributed cache services tangosol.coherence.distributed.task.timeout      The defau