I have a movieClip that changes position using code. How can control its speed also?

Posted on 2006-11-29
Last Modified: 2010-04-03
This is the code that goes on the movieClip:

onClipEvent (enterFrame) {
 _x = random(551);
 _alpha = random(101);

I just need to control its "position changing" speed, by changing a single value/variable.
I need the extra code!

alex nexus
Question by:alexnexus
  • 2
LVL 13

Accepted Solution

FLAASHER earned 500 total points
ID: 18041079
use this code in the frist frame of ur movie

function flaasher() {
      myMC._x = random(551);
      myMC._alpha = random(101);

where "myMC" is the instance name of ur movie
"1000" in setinterval line is one second ..... for more spped use 500 and for more use 200 and so on


Author Comment

ID: 18041246

It worked!
I tweak it a bit to make it work on a movieClip event.

The code ended up looking like this:

onClipEvent (load) {
      function flaasher() {
            _x = random(551);
            _alpha = random(101);
      setInterval(this, "flaasher", 100);

alex nexus
LVL 13

Expert Comment

ID: 18041272
U welcome

Thanks for the points


Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now