How can I load an external .swf into my step by pressing a button?

Hello world...

I have to add an external swf in a specific position in my scene by pushing a button.

Comeon can help me?

Thank you.

using as3, assuming you have a button named "myButton":

var myLoader:Loader = new Loader(); something to load the swf file

myButton.addEventListener (MouseEvent.CLICK, loadSWF); Earphone for your button click

function loadSWF(event:MouseEvent):void {}

listener for when the charge is complete

myLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, addSWF);

load the SWF - using your url of course

myLoader.load (new URLRequest ("yourSWFsURL.swf"));

}

function addSWF(event:Event):void {}

var mySwf = myLoader.content; the thing charge charger

mySwf.x = 100; anywhere in x

mySwf.y = 100; anywhere in there

addChild (mySwf); Add it to the stage

}

HTH,

-Ted

Tags: Adobe Animate

Similar Questions

  • How can I load an external SWF into a clip that is inside another video clip?

    Hello.

    I create my first flash (actionscript 3.0) Web site, but I'm stuck with a visual effect, I want to create.
    I have a window on my website called contentWindow. Whenever you click on a button, this window is supposed to leave the scene, loading the requested content and back on the scene.
    The sliding window is a clip with 83 frames, 21 to enter the stadium, 21 to leave the scene once again, 20 for anything (it's just to simulate the load time) and 21 to the back on the scene.

    Now, my goal is, when the user clicks a navigation button, the window leaves the scene, loading an external SWF with the content and then returned to the scene.

    I have the clip of 'window' with an instance name of "contentWindow". Inside there is an another film clip with an instance name of "contentLoader. The content that the user has requested must appear inside the 'contentLoader.

    Now, when the contentWindow leaves the scene, I get this error message:

    Quote:
    TypeError: Error #1009: cannot access a property or method of a null object reference.
    at rwd_fla::MainTimeline/trigger()
  • How can I load multiple RAW files into the same workspace (in layers)?

    I want to load several raw files from my windows files in a workspace to manpulate together. How can I do this?

    You can place in the RAW files as layers of smat object. I also think that you can also use the script load Photoshop files in a stack. Other Scripts cal also be downloaded and used >

    Photo Collage Toolkit

    Scripts for Photoshop is powerful and I think that this package demonstrates this a video showing a collage of 5 model PSD image fills with images:

    The package includes four simple rules to follow to make Photo Collage Template PSD files so they will be compatible with my Photoshop scripts.

    1. Models of photo collage for the desired print size - width and height of the size and DPI print resolution.
    2. Photo collage templates must have a background layer in Photoshop. The content of this layer can be anything.
    3. Photo collage templates must have alpha channels named "Picture 1", "Picture 2"... "Picture n".
    4. Photo collage templates layers above the background layers must provide transparent areas to reveal the images which will be placed below them.

    There are fifteen scripts in this package, they provide the following functions:

    1. HelpPhotoCollageToolkit.jsx - online help
    2. TestCollageTemplate.jsx - used to test a model of Collage of Photo while you're doing it with Photoshop.
    3. CollageTemplateBuilder.jsx - can build models that are compatible with this toolkit scripts.
    4. LayerToAlphaChan.jsx - used to convert a stack of the Prototype Image layers in a document template.
    5. InteractivePopulateCollage.jsx - used to fill interactively model Any Photo Collage. Offers more user control insert images and text.
    6. ReplaceCollageImage.jsx - allows to replace an object layer dynamic image collage populated with another image resized and positioned correctly.
    7. ChangeTextSize.jsx - this script can be used to change the size of text Image stamps when the size used by the filling did not work well.
    8. PopulateCollageTemplate.jsx - used to fill a Photo Collage template and leave the populated copy automatically opened in Photoshop.
    9. BatchOneImageCollage.jsx - used for the models automatically batch fill Collage that have only a single image inserted. The Collage or picture may be stamped with the text.
    10. BatchMultiImageCollage.jsx - used to model automatically batch fill any Photo Collage with images in an image source folder. Easier to use than the interactive script. Recorded collages can be twisted.
    11. PasteImageRoll.jsx - paste Images into a document to print on roll paper.
    12. BatchPicturePackage.jsx - used to model automatically batch fill any Photo Collage with an image in the image source folder.  Rotation of images for a better fit.
    13. BatchPicturePackageNoRotate.jsx - used to model automatically batch fill any Photo Collage with an image in the image source folder.
    14. PopulatePicturePackage.jsx - used to fill a Photo Collage fill with the same single image model and leave the populated copy automatically opened in Photoshop.
    15. PCTpreferences.jsx - edit this file to customize Collage fill preset scripts and add your own layer styles.

    Documentation and examples

  • LOAD AN EXTERNAL SWF INTO A CLIP

    Hello.

    I work in a project that load several SWF into a main movie. I use this code and works fine:

    btn_que.addEventListener(MouseEvent.CLICK, presionado); 
    function presionado(Event:MouseEvent){
       //Crea una variable llamda cargador para que cree un cargador//
       var newMedia:Loader = new Loader();
       //Crea una variable para generar un clip vacio (anteriormente host)//
       var cont:MovieClip = new MovieClip();
       //Ruta donde esta la pelicula a cargar//
       newMedia.load(new URLRequest("que_es.swf")); 
       //Posicion X que va a tener//
       cont.x = 0;
       
       stage.addChild(cont);
       cont.addChild(newMedia);
    }

    But I want to load the swf file into a clip (called host), when the person in the button click (really my button is a movi clip).

    What should I do?

    Thank you...

    See the code below (read comments):

    btncerrar.visible = false;
    // declare variable in this scope
    // so that it is visible by other functions
    var newMedia:Loader;
    // container should be in upper score too
    // Sprite is more efficient
    var cont:Sprite;
    
    btn_que.addEventListener(MouseEvent.CLICK, presionado);
    function presionado(Event:MouseEvent){
       //Crea una variable llamda cargador para que cree un cargador//
       newMedia = new Loader();
       //Crea una variable para generar un clip vacio (anteriormente host)//
       cont = new Sprite();
       //Ruta donde esta la pelicula a cargar//
       newMedia.load(new URLRequest("que.swf"));
       btncerrar.visible = true;
       //Posicion X que va a tener//
       cont.x = 0;
       stage.addChild(cont);
       stage.addChild(btncerrar);
       cont.addChild(newMedia);
    
    }
    
    btncerrar.addEventListener(MouseEvent.CLICK, cerrar);
    function cerrar(Event:MouseEvent){
         btncerrar.visible = false;
         cont.removeChild(newMedia);
         newMedia.unload();
         newMedia = null;
    }
    
  • How can you write a table to a file when you press a button in Labview 8.5

    I am new to LabVIEW, so I don't know if it's hard or not or can even be done. I have data I am gather and store it in a table in LabVIEW but I want to be able to take all the data table and write in a text or excel file. Another part I want is whether when a user presses a button, in which case they screwed up. Any help would be appreciated. Thank you!

    It is not hard to do. If you have a main loop that collects data continuously, so you can wire just up the Boolean value control to a case structure, so when the button is true you write to the file. It is supposed to be a one-off, or are more than a rocker (which means that you connect so that the button is true)? You can also use a structure of the event. See the "New handler" example that comes with LabVIEW (help-> find examples).

  • How to correctly load an external swf file in iosAir app? I get a blank screen.

    So this code works flawlesly we Air for Android, it works very well when I test the movie in Flash, but once I have the export, I get a blank screen. I've done a swf with a place withotu any code, and flash is still unable to load. It's weird cause everything works well when using the shell to the debug option, but when I goes to the white screen of standard debugging appears on my ipad. I read somewhere that it caused by the way flash saves the link to external files. So after the file is compiled Flash is unable to find the files added prefiously, which results in a blank screen. There is clearly something wrong with the way in which the process of compiling the application.

    Tried this:

    var Xpos:Number = 0;

    var Ypos:Number = 0;

    var loader: Loader = new Loader();

    var link: URLRequest = new URLRequest ("Untitled - 1.swf");

    Loader.Load (Link);

    addChild (loader);

    And this:

    var ldr:Loader = new Loader();

    LDR. Load (new URLRequest ("Untitled - 1.swf"));

    ldr.contentLoaderInfo.addEventListener (Event.COMPLETE, loaded, false, 0, true);

    function loaded(event:Event):void {}

    addChild (event.target.content);

    }

    But nothing works. I still get a blank screen. Is it possible to add the SWF manually in the file descriptor cause flash most likely he mess up? I don't really want to use via the command line.

    Read this article, especially the little loadercontext and currentdomain:

    http://blogs.Adobe.com/airodynamics/2012/11/09/packaging-and-loading-multiple-SWFs-in-air-apps on ios.

  • How can I load all my music into a folder

    I have 400 songs on a micro sd .every artist has it's own folder.my bridge will have access only a folder randomly play.want to access all songs randomly thanks lynn

    I have 400 songs on a micro sd .every artist has it's own folder.my bridge will have access only a folder randomly play.want to access all songs randomly thanks lynn

    ==========================================
    If you perform a search from the SD card to format (extension)
    the files of music... for example... MP3... When all the files
    lie... type Ctrl + A to select all the and Ctrl + C to copy
    them...

    Now... Right-click on an empty space on your desktop and choose...
    New / folder... Right-click on the new folder and choose... Dough.
    This should copy all MP3 files into the new folder.

  • How to speak with mcs external swf to the main fla file

    Hello

    I have a main fla file that loads an external swf into a holder mc, let's call it "swfloaderholder", when you click a menu item.

    Inside the external swf fla, I have a mc holder, call it, 'jpgloaderholder' that loads different JPEG files.

    Is there a way to "talk" to the "jpgloaderholder" since the main FLA to breast?

    Thank you

    R

    I can go below, and it will be probably more useful to you if you show the code that you use for the charger.

    You must wait until the file is loaded before you try...

    MovieClip (yourLoader.content) .gotoAndStop (someFrame);

  • Load an external swf as a different size?

    Hello - it seems that it would be quite easy, but I couldn't understand the research in the Flash help documentation.

    I am using Flash CS3 and AS2.0.  I use the loadMovie function to load an external swf into an empty movieclip.  The problem is that the external swf file is bigger that the image I am load, so I would load it with specific width/height settings (essentially to load it in and resize it down).

    What would be the command loadMovie to do it with?

    Thank you!!!

    You will have to wait for the movie to load before you can change its size.  To know that the film is loaded, you want to override the method MovieClipLoader.loadClip, loadMovie.  The loadClip method supports having a similar earpiece so that you can know when the file is loaded and ready to use.  If you are looking for the MovieClipLoader.addListener method in the help documentation, there is an example that should help you through most of it.  He uses an onLoadInit event listener which is what you want to use because you have to wait as the SWF to be loaded and ready for use before trying to influence it.

  • files and folders: How can I load all my files and folders to my new account of my external hard drive?

    Who can help, I just put a new account on my computer and deleted the old account. I backed up the old files on my external hard drive. I want to know is how can I load all my files and folders to my new account of my external hard drive? I thank you for your time and knowledge have a very nice evening, Shawn

    Because it's a new account (even if with the same name), the restore procedure is unable to put files and folders in the same place, they came (because this place technically no longer - if yes, then the process is done and the transfer is complete). It can create a set of separate files (maybe even under a new user name, if it has been stored in this way).  If so, all you need to do is copy the data as you would copy any other files and folders (not the main files of the user profile themselves but the data in them) on the new files in your user account and who will take care of the transfer. Here is more information about the restore procedure which may help you in the process.

    Here is an article on the restore procedure:http://www.vista4beginners.com/How-to-restore-files to make sure you do this right.  It's a selective restore of a full or selective backup (not a full restore from a full backup) - but since you did a full backup, it matches your process more closely than would a full restore.

    This is a GREAT article on the backup and restore processes in Vista http://technet.microsoft.com/en-us/magazine/2007.09.backup.aspx , but he won't go into detail about the restoration process - considering almost as easy, of course.  But it teaches you a lot about what is possible and how to do it.  It also focuses primarily on the full backup process, but he did mention the full backup and restore process as well.

    Here is an article on the advanced use of restoration (during normal restore does not work):http://www.mayankraichura.com/post/2009/08/06/Avdvanced-Restore-via-Windows-Vista-Backup-and-Restore-Center.aspx.

    Restore files from a backup
    http://Windows.Microsoft.com/en-us/Windows-Vista/restore-files-from-a-backup

    Back up and restore: frequently asked questions
    http://Windows.Microsoft.com/en-us/Windows-Vista/back-up-and-restore-frequently-asked-questions

    I also found the following (but don't know if it of true or not):

    1. after the start of "backup and Restore Center."

    2. I chose "Advanced Restore"

    3. I was did not an administrator password... maybe because my account is an administrator account.

    4 choose "files from a backup made on a different computer.

    5. in the dialog box indicating "Select the location of the backup to restore", select "hard drive, CD or DVD...". »

    6. under the drop-down list box, select your drive/partition and continue

    7. If all the backups on your drive, it will show a list of them.

    8. in my case, he showed a backup, but in the backup location, it will show "backup location is not available."

    9. I was frustrated, but then I somehow just select this backup (Yes... even if he said that thebackup location is not available " ")

    10. and you press "next".

    11 guess what... no error!

    12. a window appeared asking me if I wanted to do a full restore, or I want to select specific folders or files.

    13. I selected the folders I wanted to restore and bingo... it their restored smoothly.

    14. so that the next time see a mistake, try to continue with him... ;)

    I don't know if this will help, but it does not provide much information about the process (when it works).

    I hope this helps.

    Good luck!

    Lorien - MCSA/MCSE/network + / has + - if this post solves your problem, please click the 'Mark as answer' or 'Useful' button at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • How to pass parameters to external swf with the loader?

    Hello everyone

    I am loading an external swf file using the charger. It's a pdf file converted to swf format.

    How do I pass parameters to the file so that I can highlight certain words in the file?

    Thank you

    Hello everyone

    I solved this problem.

    Thank you

  • How can I load my photoshop CS6 cd to a new Macbook that has no cd slot and does not support the cd drive external mac.

    How can I load photoshop CS6 on a new macbook, which doesn't have a cd slot and does not support the cd drive external mac? I have the original cd of the program.

    Jake

    Download & install instructions https://forums.adobe.com/thread/2003339 can help

    -includes a link to access a page to download the Adobe programs if you do not have a disk or drive

    -you will need to enter your original serial number during the installation for non-Cloud programs

    - or kglad links in response to #1 here can help https://forums.adobe.com/thread/2081216

    Also go to https://forums.adobe.com/community/creative_cloud/creative_cloud_faq

    - and also read https://forums.adobe.com/thread/1146459

  • Loading external swf into an Air application

    Hi all

    I have build an Adobe Air app for desktop PC and have problems to load an external swf. Whenever I try to load, I get:

    SecurityError: Error #2070: security sandbox violation... cannot access stage owned by app... blah blah

    The file is loading is in a local directory, but I understand its in an another "sandbox" that represents a security risk.


    Is there a way to get around this?


    Any help would be appreciated


    Thank you very much


    Matt

    That's why I added these comments on domain of the swf file.  for locally loaded SWF files, use:

    SFMltd wrote:

    Hi Kglad, thanks for the example.

    If I run my class with securityDomain = SecurityDomain.currentDomain; then it throws this error: SecurityError: Error #2142: security sandbox violation: local SWF files cannot use the LoaderContext.securityDomain property.

    The e-mail of swf file trying to load is stored locally, so I guess that this error is logical. However if I comment on this line, I get the same error "cannot access stage owned by app"?

    See below for the class:

    package {}

    import flash.display.MovieClip;

    import flash.filesystem.File;

    import flash.events.Event;

    import flash.net.FileReference;

    import flash.events.MouseEvent;

    import flash.display.Loader;

    import flash.net.URLRequest;

    import flash.system.LoaderContext;

    import flash.system.ApplicationDomain;

    import flash.system.SecurityDomain;

    public class assetPreview extends MovieClip {}

    private var loader: Loader;

    private var mainSWF:MovieClip = new MovieClip();

    public void assetPreview() {}

    addEventListener(Event.ADDED_TO_STAGE, initialise);

    }

    public void initialise(e:Event):void

    {

    removeEventListener(Event.ADDED_TO_STAGE, initialise);

    var allowSWF:LoaderContext = new LoaderContext (false, ApplicationDomain.currentDomain);

    allowSWF.securityDomain = SecurityDomain.currentDomain;

    loader = new Loader();

    Loader.Load (new URLRequest (settingsXML.pathToSWF), allowSWF);

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

    }

    public void viewPreview(e:Event):void

    {

    addChild (mainSWF);

    mainSWF.addChild (loader);

    }

    }

    }

  • Load an external SWF file without overwriting my container SWF (AS2) file

    Hello world

    I want to load an external SWF with AS2, but file without overwriting my container file. How can I achieve this? What is the correct code?

    Here is the code I use :

    loadMovieNum ("external.swf", 0);

    countdown = function() {}

    trace ("OK");

    }

    countdownIt = setInterval (countdown, 1000);


    It works well, but as I said, it overwrites my container SWF file. If I load into level 1, my container file works but not the one I try to load... .



    Can someone help me with this, please?

    Try to use the loadMovie method... meaning container.loadMovie.  See below for an explanation: Load external in another SWF SWF

    If the loaded file does not work when you load it, it is probably because you have references to _root in there who do not find the expected _root.  You must set the file loaded _lockroot property to be true.

  • Problem with loading an external swf of in an external swf...

    OK, everything was going well on a Web site project, I worked, until yesterday. I will try to explain the whole scenario first, and I'll put the code here too so anyone can try to understand what the problem is. Here is a breakdown of the site:

    1) there a MAIN SWF file that plays an intro and then stops on the last image with the Navigation buttons 'hand'.

    2) in the root folder where the MAIN SWF resides, there is another folder called "sovereign wealth funds", which contains six main external navigation pages, but also another folder called "galleries" which contains additional external SWFs for six pages in the gallery.

    3) on one of the layers of the MAIN SWF, there is a clip called 'mySWFLoadingClip' that the buttons of Navigation of the 'hand' loading and unload pages external to swf. It all works perfectly. The beginning of the problem to the next step. This is the code I used for the buttons of navigation on the MAIN SWF scenario:

    var Xpos:Number = 0.0;
    var Ypos:Number = 0.0;
    var swf:MovieClip;
    var loader: Loader = new Loader();

    var defaultSWF:URLRequest = new URLRequest("swfs/home_page_swf.swf");

    Loader.Load (defaultSWF);
    Loader.x = Xpos;
    Loader.y = Ypos;
    this.mySWFLoadingClip.addChild (loader);
    ////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////

    Function universal BTNS
    function btnClick(event:MouseEvent):void {}

    this.mySWFLoadingClip.removeChild (loader);
    var newSWFRequest:URLRequest = new URLRequest ("SWFs /" + event.target.name + ".swf");
    Loader.Load (newSWFRequest);
    Loader.x = Xpos;
    Loader.y = Ypos;
    this.mySWFLoadingClip.addChild (loader);
    }
    Listeners of BTN
    home_page_swf.addEventListener (MouseEvent.CLICK, btnClick);
    portfolio_page_swf.addEventListener (MouseEvent.CLICK, btnClick);
    services_page_swf.addEventListener (MouseEvent.CLICK, btnClick);
    about_page_swf.addEventListener (MouseEvent.CLICK, btnClick);
    team_page_swf.addEventListener (MouseEvent.CLICK, btnClick);
    contact_page_swf.addEventListener (MouseEvent.CLICK, btnClick);


    4) one of the external navigation SWF pages is called "portfolio_page_swf" and gets loaded into the moveclip of 'mySWFLoadingClip' on the MAIN SWF. This is where the problem begins. The "portfolio_page_swf" has six buttons facing an additional external swf in the file galleries. Now when I open the file "portfolio_page_swf" to test if the buttons work, they work perfect. When I click the buttons, the external swf gallery files appear as they should. But the problem is that when I open the "MAIN SWF" file to test the site, I can click on the main Navigation buttons and they work. I click the portfolio button on the time line of Hand SWF and place of 'portfolio_page_swf' on the stage as it should, but when I click the buttons located in the 'portfolio_page_swf' galleries are not displayed. The page "portfolio_page_swf" buttons work only if I open the file 'portfolio_page_swf' directly. The following code is used in the "portfolio_page_swf":

    var Xpos:Number = 0.0;
    var Ypos:Number = 0.0;
    var swf:MovieClip;
    var loader: Loader = new Loader();

    var defaultSWF:URLRequest = new URLRequest("galleries/gallery_print_swf.swf");

    Loader.Load (defaultSWF);
    Loader.x = Xpos;
    Loader.y = Ypos;
    this.mySWFLoadingClipGALLERY.addChild (loader);
    ////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////

    Function universal BTNS
    function btnClick(event:MouseEvent):void {}

    this.mySWFLoadingClipGALLERY.removeChild (loader);
    var newSWFRequest:URLRequest = new URLRequest ("galleries /" + event.target.name + ".swf");
    Loader.Load (newSWFRequest);
    Loader.x = Xpos;
    Loader.y = Ypos;
    this.mySWFLoadingClipGALLERY.addChild (loader);
    }
    Listeners of BTN
    gallery_print_swf.addEventListener (MouseEvent.CLICK, btnClick);
    gallery_packaging_swf.addEventListener (MouseEvent.CLICK, btnClick);
    gallery_web_swf.addEventListener (MouseEvent.CLICK, btnClick);
    gallery_video_swf.addEventListener (MouseEvent.CLICK, btnClick);
    gallery_others_swf.addEventListener (MouseEvent.CLICK, btnClick);
    gallery_logos_swf.addEventListener (MouseEvent.CLICK, btnClick);

    If anyone can help understand me this I would really appreciate. This is a very important project and the deadline is coming up very soon. Please help me understand how to load an external SWF on the main timeline and then charge an additional external swf within the first external swf. I'm puzzled.

    If I'm following the structure you describe, it's probably a problem of targeting.  If you load a swf into another swf I think the scenario is the same that if you load a swf in a web page...  The charging base is the document down the chain, which is your main swf if you test Flash (otherwise it would be so stable web page in a web page).  So when your portfolio is responsible in the hand, it's like living in the folder of the hand, so your swf portfolio should probably include sovereign wealth funds in targeting... as in...

    var defaultSWF:URLRequest = new URLRequest("swfs/galleries/gallery_print_swf.swf");

Maybe you are looking for