Using Actionscript 3, how do I code a button in a parent file to load at a specific frame in another swf file?

Using Actionscript 3, how do I code a button in a parent file to load another swf file at a specific frame?

You can either place the loading code in the desired frame of the parent file, or continuously monitor the currentFrame proiperty of the parent file and do the loading when the value matches the desired frame number.

Similar Messages

  • How to call swf file within another swf file using xml

    hii,
    I am facing some problem to call a swf file via xml when this xml file loaded it calls another swf file which includes a new xml file. now if i call this nested swf calling without xml it works but in case case of xml it is not showing the result. i m confused. how to nested xml file calling done in as2/as3. i need some logics. thanks in advance

    This is the AS3 forum and your posting involves AS2 code.  You should repost in the AS2 forum...
    http://forums.adobe.com/community/flash/flash_actionscript
    Aside from that, your problem might lie in the following lines...
    _root.createEmptyMovieClip("sub_container1", 1);
    loadMovie(sub_SWFPath[1].attributes.url, "sub_container1");
    You create the new movieclip, sub_container1,  in the _root, but you do not assign the loadMovie to load into that same movieclip (unless you have a _lockroot = true assigned in your sub-swf).  In any case, you should repost in the AS2 forum to pursue resolution.

  • How to load and unload more than one external swf files in different frames?

    I do not have much experience on Adobe Flash or Action Script 3, but I know the basics.
    I am Arabic language teacher, and I design an application to teach Arabic, I just would like to learn how to load and unload more than one external swf files in different frames.
    Thanks

    Look into using the Loader class to load the swf files.  If you want to have it happen in different frames then you can put the code into the different frames.

  • How to call method in another swf file

    Hi. I am at the moment making a website in Flash 8. The
    website consists of a main file with the buttons and then
    additional files for each page. Each of the buttons uses code
    similar to this:
    content.loadMovie("home page.swf");
    where content is the movieclip I am using to load the swf
    file into. In the main file I have a search box where a user can
    type some search terms. I have written some code that will search
    through the text field(s) on the page and highlight any words that
    appear matching the search terms. The only problem is that I cannot
    get to the text fields on the other files. So what I want to be
    able to do is attach some code to the search button that will call
    a method in another swf file using the parameters that I the user
    has specified in the search box. How would I go about doing this?
    Any help is much appreciated
    JM Young

    Place functions in the external swf. Then you can call them
    through the container clip
    content.yourFunction(args);
    Realize however, you cannot call code in an external swf
    until the frames with the functions are loaded. Timing would be an
    issue if the user can beat the loading clock or if you have code
    that is executed automatically after you start the load.
    So if timing becomes an issue, use MovieClipLoader and the
    onLoadInit method.

  • How to call a .swf file in another .swf file?

    Hi all,
    I am new to flash and ActionScript3.0. Presently, I am using
    flash CS3 and the code I need is in ActionScript 3.0.
    Suppose, I have a .swf file(viz., file1.swf). Now, i am
    developing one more .swf file(viz., file2.swf), in which I need
    to execute file1.swf when a CLICK event is listened on button
    present in second file(i.e., file2.swf).
    In how many ways, we can get this.
    And, please I need code very urgently.
    Help me.

    You use the Loader class to load external content like swf's
    or images. If
    you click the main entry for Loader Class in the AS3 help,
    there's an
    example of loading an external swf.
    Dave -
    www.offroadfire.com
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • How can I control a button from one swf file to another swf file?

    Hi,
    I have a main.swf file. From that file I am accessing the external.swf file which is an external file.
    Now, how can I write code on my main.swf file for the button which is on my external.swf file?
    Activities.MainPanel.close_btn.addEventListener(MouseEvent.CLICK, btnClickClose);
    Activities.MainPanel.close_btn (This buttons is actually on external.swf file, but I want to write code on main.swf file to execute it on external.swf) how can I control one swf button on other swf file?
    Thanks.

    Here's some example code that you should be able to adapt to your needs.
    // create a new loader object instance...
    var loader:Loader = new Loader();
    // make the download request...
    var request:URLRequest = new URLRequest("external.swf");
    // add a complete event listener to the loader
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
    // start the actual loading process...
    loader.load(request);
    // create a new empty movieClip instance, you will put the loaded movie into this movieClip once its loaded
    var externalMovie:MovieClip;
    // this function is called when the download has finished and the file is ready to use...
    function completeHandler(event:Event):void {
       // set the contents of the loaded movie to the new empty movieClip...
               externalMovie = MovieClip(event.target.content);
       // add this new movie to the display list...
       addChild(externalMovie);
    Now you can refer to the loaded movie with the instance name "externalMovie". So if, for instance, you want to address a button in the loaded movie, you could write something like this on the main timeline:
    externalMovie.addEventListener(MouseEvent.CLICK, btnClickClose);
    function btnClickClose(event:MouseEvent):void {

  • How do I target a specific frame of an .swf from an HTML document

    I am creating a site half of the site if Flash application and the other half is HTML based, I can link to the HTML pages from by Flash site, but I can't seem to find out how to target a specific withing my Flash site from the HTML, no matter what I do it only links to the 1st frame of the .swf. Can somebody help me please.
    I am using AS2 for the flash portion and Dreamwaver CS3 for the HTML (or CSS).

    Sorry, I don't know what AS2 is .
    If you're using Flash or Swishmax, the workflow would go something like this:
    Copy your original work file.  Delete portions you don't need.  Save as project 1. Export as project1.swf.
    Open original work file. Delete other portions you don't need. Save as project 2. Export as project2.swf, and so on.
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    www.alt-web.com/
    www.twitter.com/altweb

  • How to define the hyperlink command in the online help to go to a specific place on another page?

    Hi,
    I run my online help (WebHelp) in an application in Firefox. When clicking a link on a page, I want to go to a specific section on another page. In the hyperlink I am using the #<bookmark> to go to the bookmark on the other page. This works in IE, but not in FireFox. Do I need to use a different command or do I have to change some settings in my browser to make it work?
    Thanks!

    Does your page design use frames (classic frames or inline frames)?
    From past threads:
    Make sure your bookmark doesn't contain a #. In other words, if the bookmark is Chapter1, Firefox will require #Chapter1 on the link, but if the bookmark is #Chapter1, then Firefox will require ##Chapter1 on the link.
    If your page changes height after loading, for example, you use a script that collapses some sections, Firefox may go to the original location in the page instead of the updated location. The workaround for this would be to have a script in the page check the hash and scroll to the correct location after changing the height.

  • Hi Everyone, i have made a flash gallery using actionscript..how to add a loader to it?

    hi i am loading all thumbs and images in a container on a single frame using action script..but the size of the swf becomes 1.2 mb so i want to add a loader to it...the loader i am trying to add counts the frames but my file has just one frame so the loader doesnot show up..
    here is the script of my gallery..and the timeline has just one frame...
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    this.createEmptyMovieClip("container",1);
    var imagesNumber:Number = 18;
    var scrolling:Boolean = true;
    for (i=1; i<=imagesNumber; i++) {
    container.attachMovie("thumb"+i,"thumb"+i+"_mc",i);
    myThumb_mc = container["thumb"+i+"_mc"];
    if (i==1)
        myThumb_mc._x = (0.0)*myThumb_mc._width;
    else
        myThumb_mc._x = ((1.2*i)-1.2)*myThumb_mc._width;
    myThumb_mc._y = (Stage.height-myThumb_mc._height)/2;
    myThumb_mc._alpha = 100;
    myThumb_mc.largerImage = i;
    myThumb_mc.onRollOver = function() {
    this._alpha = 60;
    myThumb_mc.onRollOut = function() {
    this._alpha = 100;
    myThumb_mc.onRelease = function() {
    this._alpha=100;
    for (i=1; i<=imagesNumber; i++) {
    var myClip = container["thumb"+i+"_mc"];
    myClip.enabled = false;
    scrolling = false;
    _root.attachMovie("image"+this.largerImage,"large_mc",2);
    large_mc._x = (Stage.width-large_mc._width)/2;
    large_mc._y = (Stage.height-large_mc._height)/2;
    new Tween(large_mc, "_alpha", Strong.easeOut, 0, 100, 0.5, true);
    new Tween(container,"_alpha",Strong.easeOut,100,50,0.5,true);
    large_mc.onRelease = function() {
    scrolling = true;
    var myFadeOut = new Tween(large_mc, "_alpha", Strong.easeOut, 100, 0, 0.5, true);
    new Tween(container,"_alpha",Strong.easeOut,50,100,0.5,true);
    myFadeOut.onMotionFinished = function() {
    for (i=1; i<=imagesNumber; i++) {
    var myClip = container["thumb"+i+"_mc"];
    myClip.enabled = true;
    large_mc.removeMovieClip();
    container.onEnterFrame = function() {
    if (scrolling){
    this._x += Math.cos((-_root._xmouse/Stage.width)*Math.PI)*20;
    if (this._x>0) {
    this._x = 0;
    if (-this._x>(this._width-Stage.width)) {
    this._x = -(this._width-Stage.width);
    anyone knows how to add a loadre to this...?
    thanks..

    You'll need to repost in the AS2 forum.  That's all AS2 code and this is the AS3 forum.

  • How to assign code to buttons?

    the current code I have on the timeline now (where the buttons reside) is:
    stop();
    function playLifeboy(event:MouseEvent):void
    gotoAndStop(3);
    function playKrave(event:MouseEvent):void
    gotoAndStop(2);
    lifeboy_btn.addEventListener(MouseEvent.CLICK, playLifeboy);
    krave_btn.addEventListener(MouseEvent.CLICK, playKrave);
    These work fine the first time but when I return to them they don't work. (I was told I have to assign the code to the buttons, But how?)

    OK Thanks,
    I Have 2 buttons in MC named mcMovieTrans the AS for these buttons are in the MC's timeline, the code is:
    stop();
    function playLifeboy(event:MouseEvent):void
    gotoAndStop(3);
    function playKrave(event:MouseEvent):void
    gotoAndStop(2);
    lifeboy_btn.addEventListener(MouseEvent.CLICK, playLifeboy);
    krave_btn.addEventListener(MouseEvent.CLICK, playKrave);
    when the buttons are activated they go to there corresponding frames and Stop. As an example of what happens next I'll show you frame 3 which plays MC mcKraveMovie:
    The AS for this timeline on Frame 45 is:
    stop();
    function playReturn(event:MouseEvent):void
    gotoAndPlay(46);
    return_btn.addEventListener(MouseEvent.CLICK, playReturn);
    The AS for the timeline on Frame 90 is:
    MovieClip(parent).gotoAndStop(1);
    This is where the problem occurs because when this action takes place and it returns to the parent MC (mcMovieTrans) The buttons actions dont work anymore.
    Thanks

  • Using Firefox 5, how do I get the button that lets me skip back to past pages rather than having to repeatedly press the 'back' button?

    I want to skip through past pages.

    Click and hold down on the back button, the list you want will pop up.

  • How can I create a button that performs the function of a keyboard shortcut, specifically print scrn

    I need my presentation users to take a screen shot of a slide within my presentation.  I know that windows 8 has a new function that allows a screen shot to be taken and saved directly to the user's computer and I need a button that can be placed on a slide and perform this function.  The shortcut is (windows key) + (print scrn).  I want to save my userss some time and just have a button perform this task.  Any idea on how I can make this possible? I am using Captivate 7.

    I think Ajit may have misunderstood your need.  The command he told you about triggers the Print command to allow you to print the currently active slide (on a laser or inkjet printer). This does not have the same result as you would get by hitting the PrintScreen button on your keyboard (to take a screencapture and have it saved to the Clipboard for pasting somewhere else).
    You can add a button to your slide and set the PrintScreen key as the shortcut, but this will NOT mean that clicking the button will cause a screencapture to be taken.
    There are JavaScript libraries that will allow you to execute JavaScript code in a Captivate project that can take a screen capture:
    https://github.com/ariya/phantomjs/wiki/Screen-Capture
    However, to implement these solutions you would need to be quite knowledgeable with setting up JavaScript.  It's not for newbies.

  • How to make mouseover scroll buttons attached to textarea with external loaded text ?

    Hi,
    I am working in Flash CS3 and AS3, and I'm not good in
    scripting.
    I want to make a dynamic textarea with loaded text from an
    external textfile, and then I want custom made arrow buttons to
    start scrolling the loaded text on mouseover (not click) andt stop
    scrolling on mouseout. Ala like in this webpage:
    http://boomjinx.com/
    The part with the loaded text is fine, but I can't manage to
    script the arrow buttons to do what I've just described. Even
    though I have searched the Internet for recipes I just find how to
    scroll loaded text on click or with a scrollbar. This problem is
    starting to drive me crazy!! Is there anyone that have a recipe for
    this??

    Here's one approach:
    First you need to create a dynamic mutline textfield that has
    autoSize properties set to handle a varying amount of text.
    Then you need to embed the font because you are going to use
    a mask over the textfield to define the viewable area of it.
    Then you will use the buttons to change the textfield's y
    property to move the textfield up/down vertically. You will
    probably need to use an ENTER_FRAME event handler so that a
    continuous hovering of a button will cause the textfield to
    continue moving until it either reaches one end or the other or
    when the hovering ends.
    Before you try to tackle that though, just make it so that
    hovering a button will cause the textfield to move up or down one
    increment of distance. Just take it one step at a time.

  • How to load swf files within another SWF and still maintain actionscript

    Hi I was wondering how to embed an swf file inside another
    swf file, If i simply import it to the stage or the library it will
    become a symbol but the actionscript interactivity is lost, another
    question is can I have an actionscript 2 file play within an
    actionscript 3 file?
    The actionscript 2 code for embedding is something like this:
    don't mind the _mc titles
    this.cargame_mc.onRelease = function (){
    loadMovie ("Crusty Rusty's.swf", empty_mc)
    empty_mc._xscale=60;
    empty_mc._yscale=55;
    empty_mc._x=210;
    empty_mc._y=140;
    Please Help its for my uni portfolio, i want to use as2, but
    if i do i would lose the 3d possibility of as3, is there any way to
    export an as3 file and then embed in as2, using a program or
    anything? Thanks!I
    I would just like to say thanks in advance because everyone
    on here is so helpful!

    you can load an as2 file into an as3 file (using the loader
    class) and the actionscript will work in both.

  • Using Actionscript to create complete scenes

    Ok let me paint a picture. I'm designing an online flash
    application that will dynamically display tutorials stored in a
    MySQL database. These tutorials will be added via a php control
    panel for tutors to add new tutorials to the database.
    So my flash will load, dynamically create a new scene, add in
    some static elements i.e. logo and some other images and then list
    the tutorials for the user to select.
    The user then selects a tutorial and a new scene is
    dynamically created to display the contents of this scene i.e. a
    scrollPane for the text, video component for the video elements and
    the title etc.
    I recently read this tutorial so getting the data from the
    database into Flash shouldn't be a major problem.
    http://www.webmonkey.com/webmonkey/03/40/index1a.html
    Here's what I think I need
    I'm about to start digging through my flash bible so I'll
    edit this and let you know what I've found out myself,
    1. How to create a new scene using Actionscript,
    2. How to add a few images (jpgs) from the library using
    Actionscript,
    3. how to add a scrollPane (all using actionscript),
    4. how to add some text fields,
    5. how to add a video player to access a video from a folder
    on the server and lastly
    6. some kind of back button..
    Majority of these components will be loading content from PHP
    which will access my MySQL server.
    Any help would be greatly appreciated.
    Thanks
    Steve

    A tall order for a single thread! There are many possible
    answers to each question. Plus there are not enough specifics to
    guide you to the correct alternative. The good news it you can do
    what you are planning.
    1. How to create a new scene using Actionscript,
    Do not be confused with the technical feature of a scene in
    Flash IDE. It is not something you use in Actionscript. However
    from a design view, you can create any page oriented content
    application you want. The usually dynamic element for creating a
    page is a MovieClip or the as you mentioned the component
    ScrollPane which is MovieClip.
    Beyond that there are many many ways to go.
    In general you would create one or more template layouts and
    load the content in selecting the template.
    A shell Flash movie would handle the loading of the templates
    and the data or content that would show.
    As well there could be swf that are custom pages that simply
    load and handle all the needed content separately.
    2. How to add a few images (jpgs) from the library using
    Actionscript,
    MovieClip.attachMovie
    You also can load externally using
    MovieClip.loadMovie
    or if you need to manipulate it after loading then
    MovieClipLoad.onLoadInit
    3. how to add a scrollPane (all using actionscript),
    Explained at
    ScrollPane.contentPath">MovieClipLoad.onLoadInit
    4. how to add some text fields,
    The question implies to create the TextField dynamically and
    a central method is:
    MovieClip.createTextField
    5. how to add a video player to access a video from a folder
    on the server and lastly
    Use the FLVPlayback component that is delivered with Flash 8
    Pro. You need to encode the video as FLV format using the video
    encoder that comes with Flash 8 (also possible with import except
    you elected to make it external) or a third party encoder.
    You put the flv files on the server with the swf containing
    the FLVPlayer and use the
    FLVPlayback.contentPath
    method.
    6. some kind of back button..
    Again many many ways to go: You can use the Flash component
    button or create your own. You can make a button from a MovieClip.
    You can do these dynamically or at design time and in either case
    change their functionality and respond to their interactions at
    runtime.

Maybe you are looking for