Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


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

Posted on 2006-11-29
Medium Priority
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 2000 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

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…
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 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

688 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