Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 218
  • Last Modified:

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

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!


Thanks
alex nexus
0
alexnexus
Asked:
alexnexus
  • 2
1 Solution
 
FLAASHERCommented:
use this code in the frist frame of ur movie


function flaasher() {
      myMC._x = random(551);
      myMC._alpha = random(101);
}
setInterval(_root,"flaasher",1000);



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





FLAASHER
0
 
alexnexusAuthor Commented:
Hi FLAASHER!

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);
}

Thanks!
alex nexus
0
 
FLAASHERCommented:
U welcome



Thanks for the points











FLAASHER
0

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!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now