Load external .swf and button top

Hello!

I have a problem here! I want to load a file (created from inDesign) external .swf and then on load a button at home (a small image that I created with the name "home_btn"), which refers to my home page to say frame 90

Any help it would be greatly appreciated,

Frank

I founded by myself, I just create a clip of this button and this is my code in case anyone has the same problem...

import flash.events.MouseEvent;

import flash.display.Loader;

import flash.net.URLRequest;

var loader: Loader = new Loader();

Loader.Load (new URLRequest ("MyInDesignSwf.swf"));

addChild (loader);

addChild (home_front);

home_front.addEventListener (MouseEvent.Click, playClickedExit)

Stop();

function playClickedExit(event:MouseEvent):void

{

removeChild (loader);

gotoAndPlay (90);

}

Tags: Adobe Animate

Similar Questions

  • Load external swf and stopping on the 1st frame.

    Hello everyone

    I use following code to display an external swf file on the iPad.

    var request: URLRequest = new URLRequest ("http://< server ip > / test.swf");

    loader = new Loader();

    Loader.Load (request);

    The file load passes through each image and closes the application.

    Y at - it will be a way to stop the 1st frame once the file is loaded and move between the ribs to the?

    Thank you

    If you listen to when the charger is finished, you can stop the swf file:

    var mc:MovieClip;

    loader.contentLoaderInfo.addEventListener (Event.COMPLETE, swfloaded);

    function swfloaded(e:Event) {}

    MC = e.target.content as MovieClip;

    MC. Stop();

    }

    Now you can do what you like in this clip. As:

    mc.gotoAndStop ('some ' label');

    or:

    mc.gotoAndStop (10);

  • Problem with loading external swf files

    Hello

    I am currently working on a project which is an interactive and dynamic elemtry school presentation to the Denmark. I finished my project and it works perfectly, but only locally on my computer.

    The final draft should be implemented on the site and public work. I tried to implement the project on the site and unfortunately, it does not work as expected.

    When all the files where transferred to the ftp server, only a single files are responding and appear correctly.

    Interactivity of the project is based on a structure of Action script, which is based on the smooth transition between swf files (load another swf file after the action is triggered by clicking on a button) do any work.

    After days of trying to figure out the solution, I'm totally lost. One thing is to publish the project so that all action script will work and answer between swf files, and the other thing is to make it user-friendly for the Android and apple products.

    The presentation is quite heavy because of its loading external swf content files, which are images and movies.

    I really hope you can help me with my problem. I will gladly share the files and codes if it would help solve the problem.

    Best regards

    Agata

    It could be a problem of location of file from loading.  When you place a swf file in an HTML base for targeting anything that the SWF load becomes the folder of the html page.  You may need to adjust the target so that the target of swf files, load it as if it were in the same folder as the html page.

  • Loading multiple SWFs and saving them (code works is not under Chrome and Firefox 23)

    Hey guys,.

    Anyone has an idea why this suddenly does not work? (It works under internet explore but not firefox and chrome)

    The code below is placed on my main swf to preload all my external swf and store them for not having to wait too long to get there.

    Thank you guys.

    I took the code by btw: http://www.beautifycode.com/the-finer-art-of-loading-2-handling-multiple-swfs#snippet

    I am running flash player 11.8.800.94... He used to work under Firefox and Chrome


    var _swfLoader:Loader;

    var _swfRequest:URLRequest;



    var _swfPathArr:Array = new Array)

    '00.swf', '01.swf', '02.swf'

    );



    var _swfClipsArr:Array = new Array();

    var _swfTempClip:MovieClip;

    var _loadedSWFs:int;



    startLoading (_swfPathArr);



    function startLoading(pathArr:Array):void {}

    _swfLoader = new Loader();

    _swfRequest = new URLRequest();



    loadSWF(pathArr[1]);

    };



    function loadSWF(path:String):void {}

    setupListeners (_swfLoader.contentLoaderInfo);



    _swfRequest.URL = path;

    _swfLoader.load (_swfRequest);

    };



    function setupListeners(dispatcher:IEventDispatcher):void {}

    dispatcher.addEventListener (Event.COMPLETE, onSwfComplete);

    };



    function onSwfComplete(event:Event):void {}

    event.target.removeEventListener (Event.COMPLETE, onSwfComplete);



    _swfTempClip = event.target.content;

    _swfTempClip.customID = _loadedSWFs;

    _swfClipsArr.push (_swfTempClip);



    If (_loadedSWFs < _swfPathArr.length - 1) {}

    _loadedSWFs ++;

    loadSWF (_swfPathArr [_loadedSWFs]);

    } else {}



    //

    }

    };

    I have no problem with ff and I don't see any problem in chrome.

    You probably have a typo in if:

    loadSWF(pathArr[1]);

    should be

    loadSWF(pathArr[0]);

  • Loading and unloading of the external swf with buttons

    Alright. Here's the deal. I have 7 buttons on my main page, on the left side of the screen. I want the buttons to the external swf on the right to load and unload then when you push a different button. Should I make a table? Do I need a clip vacuum film to load each swf in?

    ///////////////Buttons/////////////////////

    graphics - load the thumbnail scroll bar

    mixed technique - load the thumbnail scroll bar

    photography - load the thumbnail scroll bar

    illustration - charge the miniature scroll bar

    Words - list history of charges

    Contact - contact information of charges

    charges about - bio

    ////////////////////////////////////////////

    Thanks for any help.

    If you are unable to publish for flash player 10, you will need to use the instead of unloadAndStop() unload() method.

  • run the error when go to the "home" button after loading external swf

    I work to develop an Android app to learn Arabic, it's very simple.

    to explain the alphabet, I create and load files SWF external, first and second Chargers work well (loading and when click the buttons there is not any question)

    but the third charger charge well also, but the problem when I test project, I make me run error when press home.

    (it does not occur when you load other chargers)

    Here are the sisters Project.rar Android - Google Drive files

    Thank you

    the problem is in the way that you use to add the listeners to events for the buttons, you add a listener for them different click events each keyframe, so you need to remove the headphones before you leave for another frame.

  • AS2 button table to load external swf files

    Hey everybody.  Someone here recently helped me tremendously with a question I had on the creation of a back button in my flash file, allowing the user to click the button and view the file before swf.  I hope someone can help me make the next button now, too.

    I have a movieclip that loads an external swf files table.  I thought that the next button would be as simple as changing a selection just few things for the previous button.  However, this does not work.  When I try it, the movieclip doesn't even load the swf files.  Here's my AS2 code for my folder.  I have bolded the part at the end is for the previous button.  Does anyone know how to make the back button?

    var currentSwf:Number = 0;
    var swfs:Array = new Array ("EZSmartStand/SmartStand.swf", "EZSmartStand/Warnings.swf", "EZSmartStand/LCDDisplay.swf", "EZSmartStand/Operation.swf", "EZSmartStand/Harness.swf", "EZSmartStand/Transferring.swf", "EZSmartStand/800lbvid.swf", "EZSmartStand/Ambulating.swf", "EZSmartStand/Accessories.swf", "EZSmartStand/HarnessLaundering.swf", "EZSmartStand/ChargingBatteries.swf", "EZSmartStand/EmergencyLowering.swf", "EZSmartStand/EmergencyLowering2.swf");

    var listener: Object = new Object();
    var mcl:MovieClipLoader = new MovieClipLoader();
    mcl.addListener (listener);

    Function to load the film "next".  It uses the current value of currentSwf
    to access the table of sovereign wealth funds, then increments this value.  This version loops
    around at the beginning after the last of them.

    function loadNext (): Void {}
    mcl.loadClip (SWF [currentSwf], theTargetClip_mc);
    currentSwf ++;
    If (currentSwf > = swfs.length) currentSwf = 0;
    }

    When the SWF load, put in place to constantly check its current image
    against the total number of frames, and so those that match, the SWF is done playing.
    If this is the case, then load the following.

    listener.onLoadInit = {function(targ:MovieClip):Void}
    theTargetClip_mc.onEnterFrame = function (): Void {}
    If (this ._currentframe = this ._totalframes) {}
    loadNext();
    delete this.onEnterFrame;
    }
    }
    }

    loadNext();
    function loadNext (): Void {}
    If (currentSwf > = swfs.length) return;
    mcl.loadClip (sovereign wealth funds [currentSwf], theTargetClip_mc);
    currentSwf ++;

    }

    function loadPrevious (): Void {}

    if(currentSwf>1) {}


    currentSwf-= 2;


    loadNext();


    }


    }

    rewind_btn.onRelease = loadPrevious;

    You must change your code so that the value of currentSwf reflects the real current swf being viewed.  It makes it easier to manage in the aspect of thinking.  While I'm not show all your code, here's how I recommend you change functions, by adding one specifically for loading, and change the other just increment/decrement the value currentSwf.

    function loadNext (): Void {}
    currentSwf ++;
    If (currentSwf > = swfs.length) currentSwf = 0;
    loadSWF (currentSwf);
    }

    function loadSWF (nextSWFToLoad) {}
    mcl.loadClip (SWF [nextSWFToLoad], theTargetClip_mc);
    }

    loadSWF (currentSwf);

    function loadPrevious (): Void {}
    -currentSwf;
    if(currentSwf==-1) currentSwf = swfs.length - 1;
    loadSWF (currentSwf);
    }

    rewind_btn.onRelease = loadPrevious;

  • How to load external swf file and unload the swf file parent?

    I have a question. Let's say I have file1.swf, file2.swf and file3.swf, how can I link this 3 files together.

    Let's assume that file1.swf is the main content file, but as I load file2.swf, I want the file1.swf get replaced by file2.swf. How could unload file1.swf at that time, so that my file2.swf will become the main content file?

    and even once, when my current post file2.swf and I want it get replaced by file3.swf tinkle of a button. so that i can unload the file2.swf and let them file3.swf become the main content file...
    Anyone have ideas on this?
    Thank you..

    If you're publishing to fp 10 + use:

    var loader: Loader = new Loader();

    var urlR:URLRequest = new URLRequest();

    addChild (loader);

    Btn1.addEventListener (MouseEvent.Click, f);

    btn2.addEventListener (MouseEvent.Click, f);

    function f(e:Event):void {}

    {if (Loader.Content)}

    loader.unloadAndStop ();

    }

    {if(e.currentTarget==btn1)}

    urlR.url = "file2.swf";

    } else {}

    urlR.url = "file3.swf";

    }

    Loader.Load (urlR);

    }

    p.s. Please check the useful/correct, if there is.

  • methods used for loading external assets and SWFs

    Hello world

    My client wants to take all the Flash games on their website and put them on a portable device that is not connected to the internet. I need to ensure that sovereign wealth funds are completely autonomous, in that they do not need Internet load SWF files or other assets. The customer does not have all of the FLA, so my plan is to download the SWF and it decompiler to decompile with Sothink, and then look for the ACEs for these methods:

    URLRequest

    loadMovie

    loadMovieNum

    If the search returns the results then I'll assume that the game is loading something and this match will not be used. The customer does not want to put any time in this development, he will either on the laptop as is or not at all.

    Are there other methods that I should look for that I have not listed? Thank you!

    Here are the different charging methods so that you can look out

    URLRequest

    loadMovie

    loadMovieNum

    Loader.load()

    Sound.load()

    URLLoader.load()

    URLStream.load()

    FileReference.download()

    XML.Load( )

    hope this has helped.

  • Loading external SWF in as3 SWF Loader style?

    Hello

    I recently did the replacement of as2 as3 and am still struggling to get my head to a particular aspect. I managed to load an external swf into an empty file via the script

    Import LoadDisplayObject;

    var loader: LoadDisplayObject = new LoadDisplayObject ("button_01.swf", true);

    1. loader.addEventListener ("displayObjectLoaded", onComplete, false, 0, true);

    addChild (loader);

    function onComplete(evt:Event):void {}

    trace ("received full load");

    loader.scaleX = loader.scaleY is. 75;

    }

    ... but I'm struggling with the script to make a SWF to load into a space when one of my 3 buttons is activated...

    My page currently has three buttons (button_01, button_02 and button_03) and in a local folder three separate sovereign wealth funds with the same names that I want to load, when you press the appropriate button.

    I managed to get them to load using a tutorial... but what they charge on top of each course... far from ideal. Research on the internet I found a range of different script... goal, that I can't find anywhere that I can find the script to make it work... so why I turned here.

    Any help much appreciated... Thanks in advance.

    Simply call butt1Click (null);

  • Cannot load external swf

    Hello

    Im trying to load an external swf into my project, the code is simply:

    var loader: Loader = new Loader;

    Loader.Load (new URLRequest ("gallery.swf");

    I get an error that says the following when it debug.

    TypeError: Error #1009: cannot access a property or method of a null object reference...
    at gallery_fla::MainTimeline/frame1()
    Cannot view the source code at this location

    I have done this same thing before but never got this error message, I tried to load a swf file that is old and it worked fine.

    IM totally lost here, any help is very appreciated.

    Because the error is pointing Gallery fla, it can be that the problem lies in the SWF Gallery.  What you need to do, is to enter your Setings publish and select the option to enable debugging.  This will help by joining the line number of the code problemed.  You think it's a number of top line to no matter what you have in the file doing the oading that would probably make most issues that's the file you load.

    Just in case you have copied and pasted, the following line should have thrown an error of syntax by lack a parenthesis...

    Loader.Load (new URLRequest ("gallery.swf");

  • Help please! Problems with loading external swf files

    I'm scared, I'm new to both Adobe Flash and Actionscript 3.0.

    I'm trying to create a simple site using a couple of different external sovereigns loaded into a main swf file.

    For the moment, in the timeline panel, I have the following code in frame 1 of the layer actions:

    import flash.events.MouseEvent;

    Stop();

    navbutt.addEventListener (MouseEvent.CLICK, shownavbg);
    function shownavbg (myEvent:MouseEvent): void {}
    gotoAndPlay (10);
    }
    home_btn.addEventListener (MouseEvent.CLICK, showhome);
    function showhome (myEvent:MouseEvent): void {}
    gotoAndPlay (66);
    }
    aboutme_btn.addEventListener (MouseEvent.CLICK, showaboutme);
    function showaboutme (myEvent:MouseEvent): void {}
    gotoAndPlay (49);
    }
    gallery_btn.addEventListener (MouseEvent.CLICK, showgallery);
    function showgallery (myEvent:MouseEvent): void {}
    gotoAndPlay (76);
    }

    var bgLoader:Loader = new Loader();
    stage.addChild (bgLoader);
    ("var url: URLRequest = new URLRequest("Background/sitebackground/Main.swf ");
    bgLoader.load (url);
    stage.setChildIndex (bgLoader, 0);

    Then, in the framework of 76, I have the following code:

    removeChildAt (0);
    bgLoader.unload ();

    In section 77:

    var galleryLoader:Loader = new Loader();
    stage.addChild (galleryLoader);
    var galleryurl:URLRequest = new URLRequest("test/ZenGalleryDemo.swf");
    galleryLoader.load (url);
    stage.setChildIndex (galleryLoader, 0);

    Stop();

    The idea is that, when the file is loaded, the 'sitebackground/Main.swf"flash loads on the stage. Then I want to delete this flash and load a different one when I click on the gallery_btn. So, when I click on the gallery_btn, he plays frame 76, theoretically unloading the Main.swf and the loading of the ZenGalleryDemo.swf in its place.

    For the moment, the Main.swf loads perfectly and works great. But when I click on the button to the Gallery, he jumps to the frame 76 and plays the Main.swf. It does not load the file ZenGalleryDemo.swf...

    If anyone has any ideas, I would be really grateful!

    Thanks in advance

    It's just a glance and reading, but the problem may lie between these two lines... look closely...

    var galleryurl:URLRequest = new URLRequest("test/ZenGalleryDemo.swf");
    galleryLoader.load (url);

  • Quick Q re: loading external swf in flash

    There is probably an easy fix that I am right on...

    I am building a Web site where I have several external swf that I load it into my main movie through buttons (using release, container.loadmovie ("movie.swf"))

    There is a clip on the main timeline with several thumbnails, which act as buttons to load each swf. Sovereign wealth funds are loaded within the timeline of the movieclip (not the main timeline). When each swf is loaded, there is a 'return to the thumbnails' button for you back to the page of thumbnails on the main timeline.

    Everything works fine, except that when I click on the button "return to the thumbnail" and it brings back me to the miniature screen... the SWF is still visible as a reason any. The button is just redirecting to an image labeled on the main timeline where the miniature screen slides in... but he loses not the swf file and I can not understand how to make it go away.

    Thanks in advance for any help!

    You will probably need to use a unloadMovie command to get the swf to go away (container.unloadMovie ();).

  • Loading external SWF files: make things simple... Still need to help here =)

    Hi all! First of all, sorry for my English... I'm Brazilian and English is not my mother tongue.

    This is my first post , supposed to be my first post and I'm learning AS3. Didn't know this forum, but now I hope to have time to visit it a lot for help and be helped! =)

    Well, I am trying to import external files to my main flash with buttons file. Yes, this is a newbie question, but I'm learning... I click the button 1 and content 1 is loaded, click on the button 2 and content 2 is loaded and so on. So, I got two ways to do:

    edit: The code below works fine now...

    montreal.addEventListener (MouseEvent.MOUSE_UP, loadCity);
    dublin.addEventListener (MouseEvent.MOUSE_UP, loadCity);
    sydney.addEventListener (MouseEvent.MOUSE_UP, loadCity);
    ...

    var box: MovieClip = new MovieClip();
    addChild (box);
    Box.x = 20;
    Box.y = 20;

    function loadCity (event: MouseEvent): void {}
    currentCity var = event.target.name;
    remove all the children from the box
    While (box.numChildren > 0) {box.removeChildAt (0) ;}}
    var swfRequest:URLRequest = new URLRequest (currentCity + ".swf");
    var swfLoader:Loader = new Loader();
    swfLoader.load (swfRequest);
    box.addChild (swfLoader) ;}

    The problem with this first selection, is that whenever I click on a button, it repeats the content of the 'box'... instead, the loaded content is stacked on the last of them, and I know not how to clean it... The user Andrei toured with the statement "all" so that the code above works, but I don't know how to use tween with him...

    So here's the second option:

    Import fl.transitions.Tween;
    Fl.transitions.easing import. *;

    Montreal .buttonMode = true;
    dublin.buttonMode = true;
    sydney.buttonMode = true;
    rio.buttonMode = true;
    paris.buttonMode = true;
    london.buttonMode = true;
    home.buttonMode = true;

    var box: MovieClip = new MovieClip();
    addChild (box);
    Box.x = 20;
    Box.y = 20;

    var cityLoader:Loader = new Loader();
    var cityURL:URLRequest = new URLRequest ("montreal.swf"); I use it to show a city when the site is open
    cityLoader.load (cityURL);
    box.addChild (cityLoader);

    * Here I add headphones to button, each calling its own function as:

    montreal.addEventListener (MouseEvent.CLICK, loadMontreal);

    function cityTweens (): void {}
    var cityIn:Tween = new Tween (box, "y", Strong.easeOut,-350, 20, 1, true) ;}

    function loadMontreal(event:MouseEvent):void {}
    var cityURL:URLRequest = new URLRequest ("montreal.swf");
    cityLoader.load (cityURL);
    cityTweens() ;}

    function loadDublin(event:MouseEvent):void {}
    var cityURL:URLRequest = new URLRequest ("dublin.swf");
    cityLoader.load (cityURL);
    cityTweens() ;}

    function loadSydney(event:MouseEvent):void {}
    var cityURL:URLRequest = new URLRequest ("sydney.swf");
    cityLoader.load (cityURL);
    cityTweens() ;}

    function loadRio(event:MouseEvent):void {}
    var cityURL:URLRequest = new URLRequest ("rio.swf");
    cityLoader.load (cityURL);
    cityTweens() ;}

    function loadParis(event:MouseEvent):void {}
    var cityURL:URLRequest = new URLRequest ("paris.swf");
    cityLoader.load (cityURL);
    cityTweens() ;}

    function loadLondon(event:MouseEvent):void {}
    var cityURL:URLRequest = new URLRequest ("london.swf");


    cityLoader.load (cityURL);
    cityTweens() ;}

    function loadHome(event:MouseEvent):void {}
    var cityURL:URLRequest = new URLRequest ("home.swf");
    cityLoader.load (cityURL);
    cityTweens() ;}


    Well well, the second option "" works, but I have some problems with interpolation of... I have to wait the Tween to complete before you click another button or the interpolation will be bug... I know not how to disable buttons until the Tween is finished .

    Now, I used to have a Tween for each function, but now I got inside a function and just call it inside each function. Simple for you but I thought WOW, when I had the idea and put it into practice! But I repeat myself again a lot of code here with the "cityLoader.load (cityURL); but when I try to put it inside the function "cityTweens", it will just open the city of Montreal, maybe because I'm the appellant as soon as the site opens...

    I'm pretty sure I can make simple things, like mixing the idea of the first code (currentCity + ".swf") so I do not need to call a function for each button. I don't know how... ...

    Could someone help me? Also, I will be VERY happy if you give me a tip as good practices that I'm not following.
    Thanks in advance!

    Post edited by: newToAS3

    Adjustments to the code that deal with it below. This is not a complete code - make full changes yourself.

    import flash.events.EventDispatcher;
    // hold all the buttons in an array
    var buttons:Array = [montreal, dublin, sydney, rio, paris, london, home];
    // add listeners
    addListeners();
    // function that adds listeners
    function addListeners() {
         for (var k:String in buttons) {
              EventDispatcher(buttons[k]).addEventListener(MouseEvent.CLICK, loadSWF);
         }
    }
    // removes event listeners
    function removeListeners() {
         for (var k:String in buttons) {
              EventDispatcher(buttons[k]).removeEventListener(MouseEvent.CLICK, loadSWF);
         }
    }
    
    function loadSWF(e:MouseEvent):void {
         // remove listeners
         removeListeners();
         // the rest of code goes here
    }
    
    function tweenFinished(e:TweenEvent):void {
         // add listeners back
         addListeners();
         // make Tween instance eligible for arbage collection
         e.target.removeEventListener(TweenEvent.MOTION_FINISH, tweenFinished);
         // now you can remove tweened object from the box
         box.removeChild(e.target.obj);
         e.target.obj = null;
    }
    
  • Loading external SWF files: make things simple...

    Hi all! This is my first post and I'm learning AS3 =)

    I didn't know this forum, but now I hope to have time to come hear a lot, to help and be helped!

    Well, I am trying to import external files to my main flash with buttons file. Yes, this is a newbie question, but I'm learning... I click the button 1 and content 1 is loaded, click on the button 2 and content 2 is loaded and so on. So, I got two ways to do:

    * various buttons with the listeners to run the function 'loadCity '.

    var box: MovieClip = new MovieClip();
    addChild (box);
    Box.x = 20;
    Box.y = 20;

    function loadCity (Event: MouseEvent): void {}
    var currentCity = Event.target.name;
    var swfRequest:URLRequest = new URLRequest (currentCity + ".swf");
    var swfLoader:Loader = new Loader();
    swfLoader.load (swfRequest);
    box.addChild (swfLoader); }

    The problem with this first selection is that the content of the box is not renewed with each click, but he stacked one on the other, so I can't use it.

    Import fl.transitions.Tween;
    Fl.transitions.easing import. *;

    var box: MovieClip = new MovieClip();
    addChild (box);
    Box.x = 20;
    Box.y = 20;

    var cityLoader:Loader = new Loader();
    var cityURL:URLRequest = new URLRequest ("montreal.swf");
    cityLoader.load (cityURL);
    box.addChild (cityLoader);

    * various buttons with listeners to run its own functions, such as 'montreal.addEventListener (MouseEvent.CLICK, loadMontreal)';

    var box: MovieClip = new MovieClip();
    addChild (box);
    Box.x = 20;
    Box.y = 20;

    function loadCity (Event: MouseEvent): void {}
    var currentCity = Event.target.name;
    var swfRequest:URLRequest = new URLRequest (currentCity + ".swf");
    var swfLoader:Loader = new Loader();
    swfLoader.load (swfRequest);
    box.addChild (swfLoader); }

    The problem with this first selection is that the content of the box is not renewed with each click, but he stacked one on the other, so I can't use it.

    You can remove all the children from the box before placing another object inside:

    function loadCity (event:MouseEvent):void {
         var currentCity = event.target.name;
         // remove all the children of the box
         while (box.numChildren > 0) {
              box.removeChildAt(0);
         }
         var swfRequest:URLRequest = new URLRequest(currentCity + ".swf");
         var swfLoader:Loader = new Loader();
         swfLoader.load(swfRequest);
         box.addChild(swfLoader);
    }
    

    I see that you intend to use tween - in this case code above you does not have transitions gracefully...

Maybe you are looking for