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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
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.

624 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