1
votes

How do I create a random movement animation in Adobe CS6 Flash?

Here is the code I used:

onClipEvent(enterFrame){
    this._alpha=Math.floor(100*Math.random());
    this._x=Math.floor(50*Math.random());
    this._y=Math.floor(50*Math.random());
}

It's not working in action script 3. I want to start my animation when I click the button, but it should be start in a different place.so how to do it?. my movie clip instance name is f1

1
It doesn't work in ActionScript 3 because it isn't ActionScript 3. - Chunky Chunk

1 Answers

0
votes

try this:

    addEventListener(Event.ENTER_FRAME, onEnterFrame)


    function onEnterFrame(e:Event):void 
    {
        f1.alpha = Math.floor(100*Math.random());
        f1.x = Math.floor(50*Math.random());
        f1.y = Math.floor(50*Math.random());
    }