My account
Shopping cart
Knowledge base
Support

Knowledge Base

Important! All new questions are usually answered within the next business day.

MCTE V3 (MovieClip Transition Effect V3)

(views: 36174)

A transition effect component with lots lots of flash animation effects already included and lots of patterns sold separately. Here are all known common issues for MCTE V3, the custom patterns are treated here too. If you have any questions that you think we should discuss here please let us know. Write to support.



Multiple transitions using ActionScript code

(2009-01-06 - views: 9837)
Q: How can I use MCTE to to show and hide sequential images with transitions using code ?
A: Here is the AS3 code for doing it. You can use the same images as the AS2 example and drag the AS3 MCTE component from the Components panel into the Library.

/************************************************************************************

Please note that all the image movie clips have linkage ids set, so they can be
attached to the Stage via ActionScript code.

************************************************************************************/
import com.jumpeye.Events.MCTEEvents;

var intervalID:Number;
// The list of patterns that will be used, each one on a single image.
var patternList:Array = new Array("Waves", "SquareScale", "Stripes", "AlphaBars");
// The list of images attached from the Library.
var imageList:Array = new Array("Image1", "Image2", "Image3", "Image4");
// The index of the current image and the current pattern.
var index:int = -1;
// The target movie clip into which the images will be loaded from the Library. The
// The transitions will be applied on this target clip.
var target_mc:MovieClip = new MovieClip();
target_mc.x = 25;
target_mc.y = 25;
target_mc.name = "target_mc";
this.addChild(target_mc);

// Create the MCTE component instance.
var mcteTransitions:MCTE = new MCTE();
this.addChild(mcteTransitions);
// Initialize the transition type to hide, so when the startNewTransition
// function will initialy be called, the function will enter in the
// first "if" branch and attach the first image.
mcteTransitions.transitionType = "hide";
mcteTransitions.addEventListener(MCTEEvents.TRANSITION_END, transitionEndHandler);

// Each time a show or hide transition ends, the startNewTransition
// function will be called after 1 second.
function transitionEndHandler(evtObj:MCTEEvents):void {
    var timerObj:Timer = new Timer(1000, 1);
    timerObj.addEventListener(TimerEvent.TIMER, startNewTransition);
    timerObj.start();
}

// The initial call of the function - this initiates the first transition
// (the "show" transition of the first image in the list).
startNewTransition(null);

// This functions attaches each image when it is the case, sets up the
// MCTE component instance and executes the transition.
function startNewTransition(evtObj:TimerEvent):void {
    //clearInterval(intervalID);
    // If the previous transition was a "hide" transition, then the next
    // one should be a "show" transition.
    if (mcteTransitions.transitionType == "hide") {
        // Remove the previous image clip on which the transitions were
        // applied.
        if (target_mc.numChildren > 0) target_mc.removeChildAt(0);
        mcteTransitions._targetInstanceName = "";
        // Attach the next clip for the transition and set the next
        // pattern for MCTE.
        index++;
        if (index > 3) index = 0;
        var ImageName:Object = getDefinitionByName(imageList[index]);
        var img:DisplayObject = new ImageName();
        target_mc.addChild(img);
        trace(index+" - "+imageList[index]);
        mcteTransitions.transitionType = "show";
        mcteTransitions.patternName = patternList[index];
        mcteTransitions._targetInstanceName = target_mc.name;
    }
    else {
        mcteTransitions.transitionType = "hide";
    }
    mcteTransitions.autoPlay = false;
    mcteTransitions.preset = 1;
    trace(mcteTransitions.patternName+" :: "+mcteTransitions.transitionType);
    
    // Set the gain and tween duration for each of the patterns.
    switch(mcteTransitions.patternName) {
       
        case "Waves": {
            mcteTransitions.gain = 50;
            mcteTransitions.tweenDuration = 20;
        }break;
       
        case "SquareScale": {
            mcteTransitions.gain = 50;
            mcteTransitions.tweenDuration = 20;
        }break;
       
        case "Stripes": {
            mcteTransitions.gain = 25;
            mcteTransitions.tweenDuration = 15;
        }break;
       
        case "AlphaBars": {
            mcteTransitions.gain = 25;
            mcteTransitions.tweenDuration = 50;
            // In case of "AlphaBars" preset 8 will be used to show the image
            // and preset 7 to hide it.
            if (mcteTransitions.transitionType == "show") mcteTransitions.preset = 8;
            else mcteTransitions.preset = 7;
        }break;
    }
    // Execute the show/hide transition.
    mcteTransitions.transitionEffect(mcteTransitions.transitionType);
}


Back