How to swich between 2 contents of the Loader V3 using the MCTE V3



1. The Loader Pro V3 has a handy feature that allows you to switch between 2 images or movieclips (internal or external).

2. Before continuing with this tutorial please read the Loader Pro V3 tutorial.

3. First open a new Flash document and drag an instance of the Loader Pro V3 on the stage. If you don’t have the Loader installed on your system, please do so before continuing this tutorial. If you need help installing the Loader component, please read this tutorial. Don’t forget to name the loader instance name. I’ve called it “myLoader”

4. I’ve used 2 pictures img1.jpg and img2.jpg saved inside the “images” folder to show the transition from one to the other. My time line consists in 2 layers: one for the loader and another one called actions where I’m going to type some coding:



5. Add another layer to the timeline and call it button. With that layer selected drag a button from the Components panel :



I've also added the "Click to Switch Images" label and “myButton” instance name to the button.

6. On the actions layer type the following code :

import flash.events.MouseEvent;

myLoader.source = "images/img1.jpg";
myButton.addEventListener(MouseEvent.CLICK, clickHandler);
function clickHandler(evt:MouseEvent):void {
     myLoader.source = "images/img2.jpg";
}


The code sets the first source path for the loader and then changes that path for the one through img2.jpg on the button release.

7. Set the loader’s transitionType field to "fade" :



8. Now compile your movie (Ctrl+Enter). The first image should load and when you press the button, it should change to the second image :



9. Now let’s go even further and drag the MCTE component on the stage over the loader. The MCTE should automatically assign it’s _targetInstanceName as myLoader.

10. I've also installed the Flip Pattern pack so I’ve set the patternName field to "customPattern" and on the customPattern field I’ve typed “Flip”. This is how my component inspector for the MCTE looks like:



11. The only thing left to do is to set the transitionType field to MCTE on the loader’s component inspector:



12. Compile your movie again. After the movie loads the first image should flip once and when you press the button should flip to the second one. As you can see the MCTE V3 applied the Flip pattern to the Loader's content without having to write any extra actionscript, all you had to do was to change the source of the Loader Pro V3.




FlashEff 2.0
Create professional flash photo slideshows online

FREE Flash Stuff

Check out these free, fully functional AS3.0 Flash components by Jumpeye:

FlashEff 2.0 Free
(free for non-commercial use)

JC Panorama
(free for non-commercial use)

JC Play List
(fully free)

Basic Menu Pack V3
(free AS3 version)

MCTE V3
(free AS3 version)

JC Player
(free for non-commercial use)

JC Flash Map
(free for non-commercial use)

Flash Bookmarks
(fully free)

ActionScript Bridge AS2-AS3
(fully free)

JS Charts
(free for non-commercial use)

Free Trial Versions

The trial versions do have a major limitation. They will ONLY run into debugger flash player versions, such as the Flash IDE player and the activeX FP used by developers.

Switch from Free Trial version to Full version.

You can switch from Trial to Full versions in a blink of an eye.
See this tutorial in order to find out how.

We accept Google Checkout

Google Checkout Acceptance Mark

Secured by VeriSign