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

Industry Leaders: 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

Suggested Solutions

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
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…
Suggested Courses

759 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