Fade in/out with external SWFs

Hi All.. I"m very new to AS in general..
I'm trying to have a simple slideshow with external SWFs that outomatic and onClick..I achieved it except the abrupt white space after the unloaded clip goes away... I have this code and I'm not getting any errors - but I mut not have it connected somehow because the fade out is still not there... Can someone please please help me with this... I really appreciate any help ahead of thime...
//Import classes for easier use
import fl.transitions.Tween;
import fl.transitions.TweenEvent;
import fl.transitions.easing.*;
//Timer
var slideDuration:uint = 8000;  // or use whatever
var slideTimer:Timer=new Timer(slideDuration,0);
slideTimer.addEventListener(TimerEvent.TIMER,autoAdvanceF);
slideTimer.start();
var btnA:Array = [one_btn,two_btn,three_btn];
var previousBtn:SimpleButton = one_btn // use class type of your buttons
function autoAdvanceF(e:TimerEvent):void{
nextButtonF(previousBtn).dispatchEvent(new MouseEvent(MouseEvent.CLICK));
function nextButtonF(btn:SimpleButton):SimpleButton{ // use class type of your buttons
for(var i:uint=0;i<btnA.length;i++){
if(btnA[i]==btn){
return btnA[(i+1)%btnA.length];
return null;
//Load external SWF into main
var Xpos:Number = 0;
var Ypos:Number = 0;
var swf:MovieClip;
var loader:Loader = new Loader();
var defaultSWF:URLRequest = new URLRequest("swfs/one_btn.swf");
var target_mc:MovieClip = new MovieClip();
addChild(target_mc);
var target_mc2:MovieClip = new MovieClip();
addChild(target_mc2);
//load swf to movieClip
target_mc.addChild(loader);
//variables that store current content clip and current content indes
var activeTarget:MovieClip = new MovieClip();
loader.load(defaultSWF);
loader.x = Xpos;
loader.y = Ypos;
addChildAt(loader,0);
//Btns universal function (whenver any button is clicked, the loader will be removed
function btnClick(event:MouseEvent):void {
    if (target_mc.alpha > 0) {
        target_mc.alpha -=10;
    if(target_mc2.alpha < 100) {
        target_mc2.alpha +=10;
slideTimer.reset();
slideTimer.start();
    previousBtn = SimpleButton(event.currentTarget);
    removeChild(loader);
    var newSWFRequest:URLRequest = new URLRequest("swfs/" + event.target.name + ".swf");
    var myTween:Tween = new Tween(loader, "alpha", None.easeIn, 0, 2, 1, true);
    loader.load(newSWFRequest);
    loader.x = Xpos;
    loader.y = Ypos;
    addChildAt(loader,0);
loader.addEventListener(Event.ENTER_FRAME, onEnter);
// Movie level enterFrame event handler that will fade down object 1 (if it's alpha ishigher than 0) and fade up object 2 (if its aslpha is less than 100)
function onEnter(event:Event):void {
    if (target_mc.alpha > 0) {
        target_mc.alpha -= 10;
    if (target_mc2.alpha < 1 ) {
        target_mc2.alpha +=10;
    loader.removeEventListener(Event.ENTER_FRAME, onEnter);
    trace ("the movie clip is faded in");
/// Button Listerners
one_btn.addEventListener(MouseEvent.CLICK,btnClick);
two_btn.addEventListener(MouseEvent.CLICK,btnClick);
three_btn.addEventListener(MouseEvent.CLICK,btnClick);

The Sound Factory Studio wrote:
Can I Fade in/out several tracks with the crossfade tool? I mean without selecting them and then add value...? just like in ProTools just selecting the regions and apply the fade tool???? VIP question
No.
To add crossfades or fade in/outs to multiple audio regions, you must do it from the fade parameter box, either entering numerically, or by clicking and dragging on the numeric value.

Similar Messages

  • Clickable slide show with external SWFs

    Hi... I would really apprecaite some help with the slide show please.
    I have a slide show that loads 3 external SWFs. (The External SWFs have buttons and action script of their own as well )
    I've gotten the SWFs to load and to switch automtically as well as on the button Click (going to next SWF in array). What  I would like to do is the following:
    - Have the buttons 1,2 and 3 go to respective SWFs (and not just a next button option)
    Also, as far as transitions (just basic fade in and out) is that something I should do within the external movie Clip?
    Thank you very much I appreciate all the help. Here's my code:
    // Array of external clips to use. Variable index refers to next clip to be displayed.
    var clips:Array = ["page1.swf", "page2.swf", "page3.swf"];
    var index:int = 0;
    // Stuff to load swf files
    var thisLoader:Loader = new Loader();
    thisLoader.contentLoaderInfo.addEventListener(Event.INIT, doneLoading);
    var thisMC:MovieClip = new MovieClip();
    stage.addChild(thisMC);            // Add empty MC initially so the nextClip function can be generic
    // Removes old MC and gets the next one, waiting until when it has initialized beore adding it to the stage
    function nextClip():void {
        thisLoader.load(new URLRequest(clips[index]));
    // Tell AS that the loaded file is a movie clip and add it to the stage.
    function doneLoading(e:Event):void {
        stage.removeChild(thisMC);
        thisMC = MovieClip(thisLoader.content);
        thisLoader.unload();
        thisMC.addEventListener(Event.ENTER_FRAME, runOnce);
        stage.addChildAt(thisMC, 0);
        thisMC.gotoAndPlay(1);
    // When thisMC has finished - the next MC starts
    function runOnce(e:Event):void {
        if(thisMC.currentFrame == thisMC.totalFrames) {
            thisMC.removeEventListener(Event.EXIT_FRAME, runOnce);
            index = (index + 1)%(clips.length);
            nextClip()
    // "Next button" just calls a function that goes to the next file name (mod the number of files in the list)
    MovieClip(parent).bttn1_mc.addEventListener(MouseEvent.CLICK, playNext);
    function playNext(e:MouseEvent):void {
        nextClip();
        index = (index + 1)%(clips.length);
    Thank you!!!

    Have you ever successfully saved anything to that external drive? My first two thoughts are that the drive isn't formatted for the Mac or that you don't have rights to save to the drive.

  • Control mc with external SWF?

    Hello everyone,
    Ok, lets say I have two SWF files.
    In “SWF 1,” I have a movie clip.
    The movie clip in “SWF 1” loads in an external “SWF 2” file.
    Is it possible for me to have something (like a button) inside the external “SWF 2” with the ability to control something (like a movie clip) in “SWF 1?”
    If so what would the path to that mc look like?
    Thanks

    if both are as2 swfs, then you can reference the load-target movieclip in swf1 (the loading swf) from the main timeline of swf2 (the loaded swf) by using:
    this.
    so, if that load-target is on swf1's main timeline, you can reference swf1's main timeline by using:
    this._parent.
    and if there's a movieclip mc on swf1's main timeline, you can reference it by using:
    this._parent.mc1.
    etc.

  • Problem with Error 5005 and with external SWF loading

    I am creating a relatively simple 10-12 minute animation. I've broken the animation into 34 different movie clips that I control on the timeline by using a timer delay.
    When I try to export them all together I get the error:
    ",Line 1: Error 5005: Unknown Error optimizing byte code."
    However, when I split the presentation into two halves with the same exact frames and code I don't have the problem.
    I thought loading an external SWF at the end of the first movie would be a good way to connect everything. However, the SWF continuously loads and won't play through the way it looks when you open the actual SWF file.
    This is my code for the external loading:
    var xpos:Number = 0;
    var ypos:Number = 0;
    var swf:MovieClip;
    var myLoader:Loader = new Loader();// create a new instance of the Loader class
    var url:URLRequest = new URLRequest("aamc-2e-slide1.swf");// in this case both SWFs are in the same folder
    myLoader.contentLoaderInfo.addEventListener(Event.INIT, doneLoading);
    myLoader.load(url);
    function doneLoading(evt:Event):void
              trace("doneloading");
              swf = MovieClip(myLoader.content);
              stage.addChild(swf);
              swf.stop();

    I have the same/similar issue whether the stop is there or not.
    Yes, it is all on one frame.
    Without the stop, the SWF just continously loops on top of itself.

  • Problem with external .swf, please help

    Hello.
    I'm new here so cheers to all. Sorry if I chose wrong forum for posting this question.
    I'm newbie in Flash and started building flash website with some tutorial. Now, I built navigation and content with this lines of code:
    var myMenyArray = [najave, onama, asesoar, kontakt, ponuda, klub, arhiva];
    for each (var btn in myMenyArray){
        btn.addEventListener(MouseEvent.CLICK, onBtnClick);
    function onBtnClick(event:MouseEvent):void{
        pages.gotoAndStop(event.target.name);
    and then added this one for loading .swf
    var Xpos:Number = 150;
    var Ypos:Number = 180;
    var swf:MovieClip;
    var loader:Loader = new Loader();
    addChild(loader);
    function btnClick(event:MouseEvent):void {
    removeChild(loader);
    var newSWFRequest:URLRequest = new URLRequest("swfs/" + event.target.name + ".swf");
    loader.load(newSWFRequest);
    loader.x = Xpos;
    loader.y = Ypos;
    addChild(loader);
    galerija.addEventListener(MouseEvent.CLICK, btnClick);
    Now, my gallery loads when I press "Galerija" in navigation like I wanted, but when I want to show Home or some other content from the nav bar, gallery.swf still appears in front of content.
    Can anyone help me with this? It's probably eas, I don't know, but I spent a whole night trying to fix that and I'm here now like last chance.
    Hope that I've explained right my problem.
    Thanks anyone who can answer me.
    Cheers

    use:
            var myMenyArray = [najave, onama, asesoar, kontakt, ponuda, klub, arhiva];
            var loader:Loader;
            for each (var btn in myMenyArray){
                btn.addEventListener(MouseEvent.CLICK, onBtnClick);
            function onBtnClick(event:MouseEvent):void{
            if(loader){
            removeChild(loader);
            loader=null;
                pages.gotoAndStop(event.target.name);
            var Xpos:Number = 150;
            var Ypos:Number = 180;
            var swf:MovieClip;
            function btnClick(event:MouseEvent):void {
    if(loader){
            removeChild(loader);
            loader=null;
            loader = new Loader();
            addChild(loader);
            var newSWFRequest:URLRequest = new URLRequest(event.target.name + ".swf");
            loader.load(newSWFRequest);
            loader.x = Xpos;
            loader.y = Ypos;
            galerija.addEventListener(MouseEvent.CLICK, btnClick);
    And for every frame stop(); where content should load.
    My gallery .swf is in the same folder with this .swf.

  • Problem with external swf loading

    this is the code I'm using that works
    onClipEvent(load){
    this.loadMovie ("2.swf", "b");}
    Text
    and when I use another swf to load, it won't work anymore.
    Any help would be apreciated

    you can't decrease the total time it takes for you external swfs to load.  you can start those swfs loading in the background (while on frame 1, for example) but you need to be careful to preload only 1 swf at a time and not restart its download if it's already been started.

  • Previewing slides with external  SWF's

    Hello.
    I recently have been having problems with Captivate 4 and importing AS3 animations, in which once published the film will auto play and start all animations, regardless of where they are in my timeline. I did a bit of reading, and found out the way to get around this huge error is to use a custom flash loader.
    So I developed a custom widget that allows me to specify the URL/filename of the animation and the size of the animation. When that widget is reached in the timeline, it loads and plays the animation automatically.
    This works great, however since i'm referencing the URL locally (i.e. the url is simply 'animation.swf') this will only work when animation.swf is in the same directory as the Published Captivate file. I can't just preview the slide, I have to publish out the whole file.
    So! my question is, does anyone know where Captivate stores its previewed published files? I'm hoping I can just throw my SWF's in there to have them play when I hit preview. Otherwise, any thoughts on a better way?

    Hi Isometric,
    I stumbled on this solution while  searching. Read this post on my  blog. Since you have a widget, the key is to use a linked widget. FYI ... the publish folder changes from project to project so it's not a reliable way to do this.
    Whyves
    www.flash-factor.com

  • Communication with external swf?

    hi
    im loading in intro2swf with the following
    btn_cont2_mc.visible = false;
    addChildAt(intro_container_mc, 0);
    intro_container_mc.x=-400;
    intro_container_mc.y=-300;
    stop();
    introvisit();
    function introvisit ():void{
    if (introlevel == 2){
    lvlLoader2 = new Loader();                     // create a new instance of the Loader class
    url2 = new URLRequest("intro2.swf");
    lvlLoader2.load(url2); // load the SWF file
    intro_container_mc.addChild(lvlLoader2); 
    now the swf loads correctly and in the correct place however i have a btn on the stage that i wish to hide and at a certain point in my loaded swf i want to unhide the button using an enter frame event
    intro_container_mc.addEventListener(Event.ENTER_FRAME, added0);
    function added0(event:Event):void {
    if (intro_container_mc.currentFrame == 1){
    btn_cont2_mc.visible = true;
    MovieClip(this.parent).e_mc.cap_talk_txt.text="Stormy";
    I need to do it this way so that I can change the text at various points in the story of the swf i can change the text
    but whenever i try it, the button will not show or the text change, having problems communicating with swf, i have tried
    intro_container_mc.addEventListener(Event.ENTER_FRAME, added0);
    intro_container_mc.lvlLoader2.addEventListener(Event.ENTER_FRAME, added0);
    intro_container_mc.lvlLoader2.storm_mc.addEventListener(Event.ENTER_FRAME, added0);
    all of which have no effect, the animation inside the swf is kept in a movieclip called storm_mc
    hope you guys can help me fix this
    thanks
    fonzio

    hi kglad and thanks for putting my mind at rest as well as keeping me sane
    currently trying to remove the children added at this point (or the loaded swf)
    but im running into problems, its giving me a lot of displayobject errors when i try to remove child
    after the animation has finished and the user clicks the button this should happen
    function removelistd():void{
    removeChild(loader)
    btn_cont2_mc.buttonMode=false;
    btn_cont2_mc.removeEventListener(MouseEvent.CLICK, continuey);
    btn_cont2_mc.removeEventListener(MouseEvent.MOUSE_OUT, conty2Out);
    btn_cont2_mc.removeEventListener(MouseEvent.MOUSE_OVER, conty2Over);
    swf2Main_mc.storm_mc.removeEventListener(Event.ENTER_FRAME, added0);
    loader.contentLoaderInfo.removeEventListener(Event.COMPLETE,completeF);
    wondering if it is the loader that i should be putting above
    have tried swf2Main_mc and loader in all sorts of ways however keep getting this
    ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
    at flash.display::DisplayObjectContainer/removeChild()
    at MethodInfo-360()
    at MethodInfo-357()
    just need help cleaning up and then its done
    thanks in advance
    fonzio

  • FadeOut External SWF

    Hi..
    I'm working on a slide show with external SWFs. I got everything to work (almost evrything ) ...
    Whwat I'm trying to do is have a nice transition.. I have the Loading SWFs Fade in... but there's still a split second of the white space under... so I was trying to have the Unloading SWF FAde out wile Loading SWF is Fading in... or something close to that.. Can anyone please either tell me out... here's the code I'm using - Thanks a bunch ahead of time!!!:
    //Import classes for easier use
    import fl.transitions.Tween;
    import fl.transitions.TweenEvent;
    import fl.transitions.easing.*;
    import flash.display.Stage;
    //Timer
    var slideDuration:uint = 8000;  // or use whatever
    var slideTimer:Timer=new Timer(slideDuration,0);
    slideTimer.addEventListener(TimerEvent.TIMER,autoAdvanceF);
    slideTimer.start();
    var btnA:Array = [one_btn,two_btn,three_btn];
    var previousBtn:SimpleButton = one_btn // use class type of your buttons
    function autoAdvanceF(e:TimerEvent):void{
    nextButtonF(previousBtn).dispatchEvent(new MouseEvent(MouseEvent.CLICK));
    function nextButtonF(btn:SimpleButton):SimpleButton{ // use class type of your buttons
    for(var i:uint=0;i<btnA.length;i++){
    if(btnA[i]==btn){
    return btnA[(i+1)%btnA.length];
    return null;
    //Load external SWF into main
    var Xpos:Number = 0;
    var Ypos:Number = 0;
    var swf:MovieClip;
    var loader:Loader = new Loader();
    var defaultSWF:URLRequest = new URLRequest("swfs/one_btn.swf");
    loader.load(defaultSWF);
    loader.x = Xpos;
    loader.y = Ypos;
    addChildAt(loader,0);
    //Btns universal function (whenver any button is clicked, the loader will be removed
    function btnClick(event:MouseEvent):void {
    slideTimer.reset();
    slideTimer.start();
        previousBtn = SimpleButton(event.currentTarget);
        removeChild(loader);
        var newSWFRequest:URLRequest = new URLRequest("swfs/" + event.target.name + ".swf");
        var myTween:Tween = new Tween(loader, "alpha", None.easeIn, 0, 2, 1, true);
        loader.load(newSWFRequest);
        loader.x = Xpos;
        loader.y = Ypos;
        addChildAt(loader,0);
    /// Button Listerners
    one_btn.addEventListener(MouseEvent.CLICK,btnClick);
    two_btn.addEventListener(MouseEvent.CLICK,btnClick);
    three_btn.addEventListener(MouseEvent.CLICK,btnClick);

    When I first test it, it doesn't give any error, and only shows the blank page. However, than I guess when the slides are switching and the timer takes affect, these are the errors that start popping up..:
    TypeError: Error #1010: A term is undefined and has no properties.
        at main_fla::MainTimeline/loadComplete()[main_fla.MainTimeline::frame1:76]
    ReferenceError: Error #1056: Cannot create property onMotionFinished on fl.transitions.Tween.
        at main_fla::MainTimeline/loadComplete()[main_fla.MainTimeline::frame1:78]
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at main_fla::MainTimeline/autoAdvanceF()[main_fla.MainTimeline::frame1:32]
        at flash.utils::Timer/_timerDispatch()
        at flash.utils::Timer/tick()
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at main_fla::MainTimeline/autoAdvanceF()[main_fla.MainTimeline::frame1:32]
        at flash.utils::Timer/_timerDispatch()
        at flash.utils::Timer/tick()
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at main_fla::MainTimeline/autoAdvanceF()[main_fla.MainTimeline::frame1:32]
        at flash.utils::Timer/_timerDispatch()
        at flash.utils::Timer/tick()
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at main_fla::MainTimeline/autoAdvanceF()[main_fla.MainTimeline::frame1:32]
        at flash.utils::Timer/_timerDispatch()
        at flash.utils::Timer/tick()
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at main_fla::MainTimeline/autoAdvanceF()[main_fla.MainTimeline::frame1:32]
        at flash.utils::Timer/_timerDispatch()
        at flash.utils::Timer/tick()
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at main_fla::MainTimeline/autoAdvanceF()[main_fla.MainTimeline::frame1:32]
        at flash.utils::Timer/_timerDispatch()
        at flash.utils::Timer/tick()
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at main_fla::MainTimeline/autoAdvanceF()[main_fla.MainTimeline::frame1:32]
        at flash.utils::Timer/_timerDispatch()
        at flash.utils::Timer/tick()
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at main_fla::MainTimeline/autoAdvanceF()[main_fla.MainTimeline::frame1:32]
        at flash.utils::Timer/_timerDispatch()
        at flash.utils::Timer/tick()
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at main_fla::MainTimeline/autoAdvanceF()[main_fla.MainTimeline::frame1:32]
        at flash.utils::Timer/_timerDispatch()
        at flash.utils::Timer/tick()
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at main_fla::MainTimeline/autoAdvanceF()[main_fla.MainTimeline::frame1:32]
        at flash.utils::Timer/_timerDispatch()
        at flash.utils::Timer/tick()
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at main_fla::MainTimeline/autoAdvanceF()[main_fla.MainTimeline::frame1:32]
        at flash.utils::Timer/_timerDispatch()
        at flash.utils::Timer/tick()
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at main_fla::MainTimeline/autoAdvanceF()[main_fla.MainTimeline::frame1:32]
        at flash.utils::Timer/_timerDispatch()
        at flash.utils::Timer/tick()
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at main_fla::MainTimeline/autoAdvanceF()[main_fla.MainTimeline::frame1:32]
        at flash.utils::Timer/_timerDispatch()
        at flash.utils::Timer/tick()
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at main_fla::MainTimeline/autoAdvanceF()[main_fla.MainTimeline::frame1:32]
        at flash.utils::Timer/_timerDispatch()
        at flash.utils::Timer/tick()
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at main_fla::MainTimeline/autoAdvanceF()[main_fla.MainTimeline::frame1:32]
        at flash.utils::Timer/_timerDispatch()
        at flash.utils::Timer/tick()
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at main_fla::MainTimeline/autoAdvanceF()[main_fla.MainTimeline::frame1:32]
        at flash.utils::Timer/_timerDispatch()
        at flash.utils::Timer/tick()
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at main_fla::MainTimeline/autoAdvanceF()[main_fla.MainTimeline::frame1:32]
        at flash.utils::Timer/_timerDispatch()
        at flash.utils::Timer/tick()

  • Target paths in external SWF's?

    Hi, Im having problems with a flash based website that I am
    creating. It is essentially a gallery, using a shell file for all
    the navigation with external .swf's being loaded in for each image
    set to keep the overall file size low. I have it all working fine
    except for one weird problem, within the external .swf's there is
    another layer of navigation to move forwards and backwards through
    the main timeline.. it works fine as an individual .swf but when
    loaded inside the shell interface none of the buttons work.
    The only thing I can think of is that the paths are wrong
    when it is loaded into another file, for example: does "on
    (release) { _root.play();" on a button inside the external swf
    refer to the root of the external file or the root of the shell swf
    itself? What path am i suposed ot use to refer to items on the main
    timeline of an external .swf file?
    I may not have explained this very clearly, but I would be
    extremely greatful for any insights, thanks for your time

    yes scott, the _root in this case refers to the main movie..
    try using the "on(release) {this.play()}" or
    on(release){_root._LEVEL##.play()}
    where ## is the level Number that the external swf is loaded
    into..

  • Drag & Drop Functionality Doesn't Work in External SWF?

    Hi all,
    I'm currently a TA for a Flash course at my school.  We're using AS 2.0 and working with external SWFs.
    I think this might be pretty simple to remedy.  Well, at least I'm hoping!
    A student is having trouble with drag & drop functionality when it  is used in an external SWF.  Basically, in our drag & drop section,  we have a sheet of paper ("paper" MC) and an object we drag into it  ("object" MC).  When the object is released in the paper area, we go to  frame 2 of "paper" MC, which consequently has an animation.
    This works fine and dandy in said drag & drop section, but once the  drag & drop section is loaded into our main SWF via a MC  placeholder, the drag & drop functionality stops working.
    Here is the URL to the drag & drop section by itself:
    http://www.phayzed.com/flashkit/drag_for_animation.swf
    and here is the URL to the main swf, which loads the drag & drop SWF into a movieclip and causes it to work incorrectly:
    http://www.phayzed.com/flashkit/main.swf
    Now here is the code on the draggable object ("object" MC):
    on (press) {
            startDrag (this, true);
    on (release) {
            stopDrag ();
            if (this._droptarget == "/paper") {
                    _parent.paper.gotoAndStop(2);
                    _parent.object._visible=false;
    If any more info is needed, I'm willing to upload both FLA files.   Although, something tells me that this is a simple issue to resolve.
    Thanks a lot for any help!!!
    Cheers
    T

    with as2 you must convert that antiquated as1 code:
    on (press) {
            startDrag (this, true);
    on (release) {
            stopDrag ();
            if (eval(this._droptarget) == _parent.paper) {
                    _parent.paper.gotoAndStop(2);
                    _parent.object._visible=false;

  • Fade in or out external swf

    I have been searching high and low for the answer to this all day, and I can't figure this out.  I am new to flash and trying hard to learn.
    So,  the site I am working on has five buttons, and most of them call in an external swf.  The way I have it set up is the button uses this code:
    about_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
    function mouseDownHandler(event:MouseEvent):void {
    MovieClip(root).gotoAndStop("ABOUT")
    which points to the "ABOUT" frame on the main timeline where I have this code in a movieclip that calls in the swf.
    stop();
    var fl_Loader_6:Loader;
    var fl_ToLoad_6:Boolean = true;
         if(fl_ToLoad_6)
              fl_Loader_6 = new Loader();
              fl_Loader_6.load(new URLRequest("about.swf"));
              addChild(fl_Loader_6);
         else
              fl_Loader_6.unload();
              removeChild(fl_Loader_6);
              fl_Loader_6 = null;
         fl_ToLoad_6 = !fl_ToLoad_6;
    This all works fine, but I want the external swf file to fade in and then stop, then fade out when I click on another button. How do I do that?
    I hope that I am being clear enough for someone to answer this.
    Thanks

    Add a Color Matte, set to white and then adjust the Duration, to suit. Add a Cross-Dissolve between that.
    The Color Matte is available from the New Icon. Not sure if a White Video has been added in PrE 8, like one has with Black Video, but Color Matte will work fine.
    Good luck,
    Hunt

  • Loaded external swfs with transitions

    I need help getting my loaded swf files to play the "out" transition before the next movie loads. I have a main swf with 5 buttons (movie clips) that load external swf onto the stage.
    package
        import flash.display.MovieClip;
        import flash.display.SimpleButton;
        import flash.display.Loader;
        import flash.net.URLRequest;
        import flash.events.MouseEvent;
        import flash.events.*;
        public class V2 extends MovieClip
            private var sections_array:Array;
            private var section_buttons_array:Array;
            private var loader:Loader;
            private var sectionHolder  : MovieClip;
            private var swf:String;
            private var currentSection:int=0;
            private var nextSection:int;
            private var id:int=0;
            private var homeLoc = "./swfs/home.swf";
            public function V2()
                init();
            private function init():void
                stop();
                stage.frameRate=31;
                preloader_mc.visible=false;
                preloader_mc.fill_mc.width=0;
                sectionHolder = new MovieClip();
                sectionHolder.x = 37;
                sectionHolder.y = 42;
                addChild( sectionHolder );
                sections_array = new Array('./swfs/section1.swf',
                './swfs/section2.swf',
                './swfs/section3.swf',
                './swfs/section4.swf',
                './swfs/section5.swf');
                section_buttons_array = new Array(btn1,btn2,btn3,btn4,btn5);
                addMenuListener();
                addMenuEvents();
                loadHome();
            private function addMenuListener():void
                for(var i:int=0;i < section_buttons_array.length;i++)
                    section_buttons_array[i].id=i;
                    section_buttons_array[i].addEventListener(MouseEvent.MOUSE_DOWN,loadSectionHand ler);
            private function loadHome():void
                swf=homeLoc;//sections_array[0];
                var request:URLRequest=new URLRequest(swf);
                loader=new Loader();
                initListeners(loader.contentLoaderInfo);
                loader.load(request);
                id=0;
            private function changeSection(m:MouseEvent):void
                id=m.currentTarget.id+1;
                loader.unload();
                sectionHolder.removeChild(loader);
                removeListeners(loader.contentLoaderInfo);
                loadSection(m.target.parent.id+1);
            private function loadSectionHandler(evt:MouseEvent)
                id = evt.currentTarget.id;
                loadSection(id);
            private function loadSection(n:int):void
                swf=sections_array[id];
                var request:URLRequest=new URLRequest(swf);
                initListeners(loader.contentLoaderInfo);
                loader.load(request);
            private function initListeners(dispatcher:IEventDispatcher):void
                dispatcher.addEventListener(Event.OPEN,start);
                dispatcher.addEventListener(ProgressEvent.PROGRESS,atLoading);
                dispatcher.addEventListener(Event.COMPLETE,completed);
            private function removeListeners(dispatcher:IEventDispatcher):void
                dispatcher.removeEventListener(Event.OPEN,start);
                dispatcher.removeEventListener(ProgressEvent.PROGRESS,atLoading);
                dispatcher.removeEventListener(Event.COMPLETE,completed);
            private function start(event:Event):void
                preloader_mc.visible=true;
            private function atLoading(event:ProgressEvent):void
                var n:uint=(event.bytesLoaded/event.bytesTotal)*100;
                preloader_mc.fill_mc.width=n;
               private function completed(event:Event):void
                sectionHolder.addChild(loader); 
                preloader_mc.visible=false;
            private function stopAll():void
                for(var i:int=0;i < section_buttons_array.length;i++)
                    section_buttons_array[i].stop();
                    sections_array[i].stop();
            private function addMenuEvents():void
                for(var i:int=0;i < section_buttons_array.length;i++)
                    section_buttons_array[i].mouseChildren=false;
                    section_buttons_array[i].buttonMode=true;
                    section_buttons_array[i].id=i;
                    section_buttons_array[i].isPressed=false;
                    section_buttons_array[i].addEventListener(MouseEvent.MOUSE_OVER,setOver);
                    section_buttons_array[i].addEventListener(MouseEvent.MOUSE_OUT,setOut);
                    section_buttons_array[i].addEventListener(MouseEvent.MOUSE_DOWN,setDown);
                    section_buttons_array[i].addEventListener(MouseEvent.MOUSE_UP,setUp);
            private function setOver(evt:MouseEvent):void
                if(evt.target.isPressed==false)
                    evt.target.gotoAndStop(2);
            private function setOut(evt:MouseEvent):void
                if(evt.target.isPressed==false)
                    evt.target.gotoAndStop(1);
            private function setDown(evt:MouseEvent):void
                nextSection=evt.target.id;
                checkState(evt.target.id);
                evt.target.gotoAndStop(3);
                loadSection(1);
                currentSection=evt.target.id;
            private function setUp(evt:MouseEvent):void
                if(evt.target.isPressed==false)
                    evt.target.gotoAndStop(1);
            private function checkState(n:int):void
                for(var i:int=0;i < section_buttons_array.length;i++)
                    if(i==n)
                        section_buttons_array[i].isPressed=true;
                    else
                        section_buttons_array[i].isPressed=false;
                        section_buttons_array[i].gotoAndStop(1);
            private function removeSWF(e:Event):void
                loader.unload();
                removeEventListener("removeMe", removeSWF);
                var request:URLRequest = new URLRequest(swf);
                loader.load(request);
            private function onClick(e:MouseEvent):void
            targetID = e.currentTarget.id;
            addEventListener("removeMe", removeSWF);
            MovieClip(loader.content).play();
            private function removeSWF(e:Event):void
            loader.unload();
            removeEventListener("removeMe", removeSWF);
    The loaded swf has a stop() an intro animation and on the last frame have.
    dispatchEvent(new Event("removeMe", true));

    your isse begins here ..
    loadSection()
    you use the same loader to not only load files but you are tyring to use it to target the movieClip you also want to play.
    The issue is loader.  The loader can only reference one load at a time.. otherwise you screw up your listeners and the ability to unload files properly.
    You should load all files in Your current system as its own variable so that while one loads you can still control a movie.
    So what type of end transitions do your files have?
    What exactly with this seems like youre getting an issue.. looking at it looks alright aside from the fact that some methods are not used at all by your class

  • Loading from library conflicts with loading external swf

    I'm very new to ActionScript, so this might be incredibly basic. However, I've Googled and read myself into a coma and I'm not finding a solution.
    I have a movie with 6 navigation buttons.  Four of them load external .swf slideshows, and they work fine - as each file loads, the previous one clears the stage, etc.  The other button that I currently have set up is loading, from the library, an image.  The problem I'm having is that the slideshows replace each other on the stage - they're not stacking, they're replacing - but when the user selects the button that loads the image, the image overlays the last-selected slideshow.  If the user selects the image first, the image is visible when two of the external files transition.  Because of that 6th button, which is not yet even started, it's not desirable to me to simply set up the single image as another external file; if it's at all possible, I need to be able to pull from a library file when I build that last button.
    What I'd like to do - because there is no logical order that the buttons should be selected in - is figure out how to tell every button to remove the image file on click.  I've tried using this in the four buttons that link to the slideshows, to deal with the image (that's the one called quoteImage):
         if(myLoader != null && contains(quoteImage)){
            myLoader.removeChild(quoteImage);
    which has the advantage of not giving me any errors, but doesn't actually fix my problem.  I've tried many, many other things, and I'm just really stumped on what exactly I need to do to make this work the way I want it to.  Based on the fact that the books and online resources I've been using don't really cover this specific example, I suspect it might be an incredibly idiot thing to do, but I'd really like it to work this way if that's possible.
    The code as it stands, with the global variables and the first two buttons (the next three are identical to the second button and the sixth button doesn't exist) looks like this:
    var myLoader:Loader=new Loader(); 
    var quoteImage:Bitmap;
    stop();
    // Loads quoteImage from library
    btnQuotes.addEventListener(MouseEvent.CLICK, showquote);
    function showquote(event:MouseEvent):void {
    var myBitmapDataObject:myBitmapData = new myBitmapData(500, 350);
    var quoteImage:Bitmap = new Bitmap(myBitmapDataObject);
    quoteImage.x=150;
    quoteImage.y=180;
    addChild(quoteImage);
    // Loads industrial.swf from external file
    btnIndustrial.addEventListener(MouseEvent.CLICK, showindustrialcontent);
    function showindustrialcontent(event:MouseEvent):void {
    var myURL:URLRequest=new URLRequest("industrial.swf");
    myLoader.x=150;
    myLoader.y=180;
    myLoader.load(myURL);
    addChild(myLoader);
    Help is very much appreciated.

    I see now how to import and display a library class object
    using:
    var MovieClipClass:Class =
    Class(loader.contentLoaderInfo.applicationDomain.getDefinition("myLibraryAsset"))
    var movieClip:Sprite = new MovieClipClass();
    addChild(movieClip)
    But this seems to only work for SWF's published for AS3 Flash
    Player 9.
    I need to do the same for SWF's published with AS2 Flash
    Player 7.
    Any ideas?

  • Loading external swf fonts created with fontswf, loaded with a Loader, compatible with iOS

    Let me immediately start out by saying that I do in fact have a current working solution for using embedded fonts, generated by fontswf and working in an AIR ActionScript mobile application, and also currently working fine with iOS.
    My current app needs CFF fonts, so I currently use the fontswf tool to pre-generate the .swfs using:
    fontswf -4 -a [SomeAlias] -o [SomeFont.swf] [SomeFont.ttf]
    and then I am currently embedding them in my app source code .as for compilation using:
    [Embed(source="/swf/SomeFont.swf", symbol="SomeAlias")]
    public static var SomeFontClass:Class;
    I then have no problem registering them using Font.registerFont(SomeFontClass) and everything works fine.
    However, I would prefer to take the use of these swf fonts one step further and load them dynamically using a Loader so that I do not have to take the hit of having multiple CFF font swfs embedded in the main compiled SWF and so that I could even load an unknown future set of fonts without having to supply them as part of the app build.
    Now I have seen and read many blogs and tutorials where people have exported font swf from Flash Builder where you add an explicit 'Class' name or even made standalone .as static files compiled into standalone swfs only including the two lines:
    [Embed(source="/swf/SomeFont.swf", symbol="SomeAlias")]
    public static var SomeFontClass:Class;
    so that you also have a 'Class' involved. Then people use some form of appropriate applicationDomain.getDefinition("className") as Class
    to pull out the class for the font registration.
    My question is, how does one perform the same font loading and registration of fonts using a Loader only loading the .swfs produced directly from fontswf?
    It seems only a DefineFont4 is tagged in the swf, there doesn't seem to be a 'Class' per se to call on.
    More importantly, iOS apps cannot load external swfs with code in them, so my understanding is any extra wrapped swf that would contain a custom Class technique would fail the iOS requirement of only having one main SWF with any ActionScript compiled code.
    Is there an alternative to the 'Class' technique by grabbing the DefineFont4 tagged resource from the swf and instantiating a proper working Font class from that? One that would still be compatible with the restrictions placed on AIR mobile apps running on iOS?

    Ironically, just after posting this, Adobe released AIR 3.5 beta onto labs, and added multiple SWF support for iOS.
    While this new support makes it easier to manage your content across multiple SWFs and technically allows you to use the class based separate .swfs for each font if desired, the system still requires that all these SWFs be present at compile time when making the final app .ipa for iOS.
    So this still doesn't solve trying to load fonts after the app is already built. For example, as part of a downloaded in-app purchase mechanism.

Maybe you are looking for

  • How to post images from camera to facebook???

    Hi. I've got Nokia E52. IMHO once you pay over 250EUR for the product, it has to be AT LEAST user friendly. However, some free services are more user friendlier than Nokia. Could someone tell me.. how can I: - Choose image from list - Click share - A

  • Itunes dropped the ball..

    no one can solve launch failures with itunes 7.5, 7.6... but i found a solution.. songbird! look it up... you wont turn back...

  • Remove tax code in billing document

    Hi    In sales billing, accounting entries for  account key ERL is as below PK Account    Account short text   Tx 01 10000001   Customer                  A0 50 40001001   Gross Sales - Trade  A0 The requirement is to remove tax code (A0) from posting

  • How to align the number to the right

    Hi, Can anybody tell me , 1. if the field is related to number, align the value to the right and complete it to the left with 0. 2. if the field is related to description, align the value to the left and complete it with "spaces". Please reply ASAP.

  • Error making zabbix agent on OSX

    I am installing the 1.4.2 agent on a OSX 10.4.10 Server machine that has XCode installed. I have also encountered the same problem on 10.4.8 Server, 10.4.6 Server, and 10.3.8 Server. I ran the ./configure --enable-agent and it checked out fine, then