Search code examples
flashadobecs4

how to slide from one frame to another in flash CS4?


Hey, I'm making a choose your own adventure interactive novel game using flash CS4. I'm able to create the basic structure but I'd like to add some transitions between frames when a player makes a choice. I want to make it look like one frame slides to the left followed by the next frame sliding into view.

Please note that I have almost no experience with actionscript.


Solution

  • You can not change the X or Y of a "frame"
    Instead what you need to do is create an object and position that object.
    As per your request.
    There is a word of issue with doing just this. Like garbage collecting the mc object after it has been pushed off the stage.

    var mc:MovieClip = new MovieClip();
    mc.graphics.beginFill(0xFF0000);
    mc.graphics.drawRect(0, 0, 100, 80);
    mc.graphics.endFill();
    mc.x = 80;
    mc.y = 60;
    addChild(mc);
    
    
    var timer:Timer = new Timer(5);
    timer.addEventListener(TimerEvent.TIMER, onTimer );
    timer.start();
    function onTimer( e:TimerEvent ):void{
        mc.x = ++mc.x
    }