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.

Similar Messages

  • HANA Server site JavaScript how to call functions in another .js file? thanks

    In HANA Studio, I have created a .js file and a server site javaScript .xsjs file. The .js file and .xsjs file are in the same path .I create function F1() in js file. Then I want to call function F1 in xsjs file. But it always through an error “f1 was used before it was defined”. Any suggestion? Thanks very much
    .js file:
    .xsjs file:

    Hi Jim,
    Now I have found the method how to use external library. If we want to outsource some of xsjs functions to an external library, XSEngine provides a special format for this, called “.xsjslib”. Then in xsjslib file, we define functions need to be outsourced.
    In .xsjs file, we can import a library using the following code:
    $.import("<Package_Library_was_deployed>","xsjslib File Name");
    The Package_Library_was_deployed please refer to:
    Access functions inside library by this path:
    $.Package_Library_was_deployed.xsjsFileName.FunctionName();

  • How to call method in another mxml component

    HI to all friends out there. I am stuck at some point . I need to call public method which is in other mxml component file in another mxml component.
    So please tell me how i achieve this . I need to call inside event method which activate when user click on mu advancedatagrid item.
    So please tell me how to acheive this.
    Thank you in advance.

    If the functionality you need is self-contained within the component, you can dispatch generic event to the main application, and over there define the handler function.
    If you need more specific interaction triggered by the component, you have to create custom event Class and then dispatch custom event.
    I believe there are some clear tutorials in Flex in a week: http://www.adobe.com/devnet/flex/videotraining/?devcon=f2
    HTH,
    FTQuest

  • 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.

  • Call a external SWF by press the button within another SWF file but the second SWF file play Externely

    Hello Guyz.
    i am working on Macromedia Flash 8 and i just want to call a external SWF when i press the button within another SWF file.......but the second SWF file play Externely............can any one knows the code.... AS2

    try this
    http://www.actionscript.org/forums/showthread.php3?s=&threadid=28123

  • 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.

  • FAQ: How do I load an external SWF file into a parent SWF file?

    A ton of Flash users visit Adobe’s we site every month wondering  about how to load an external SWF file from within another SWF.
    Adobe's own TechNote on the subject attempts to answer the basic question, along with some common follow-up questions, including:
    How do I load more than one SWF?
    How do I load a SWF into a specific location in the display list?
    How do I resize the loaded SWF?
    How do I set its X and Y location?
    Here are some additional resources that elaborate on loading content and on working with the display list:
    Sample files for the above TechNote. A set of 3 FLA and 3 corresponding SWF files, including a parent SWF and 2 SWFs that the parent loads.
    Help > AS3 Developer’s Guide > Loading an external SWF file
    Help > AS3 Developer’s Guide > Loading display content dynamically
    Loading multiple external SWFs within a main SWF – CreativeCow.net forums
    Video tutorial: ActionScript 101 – Episode 6: Adding named objects to the Stage. By Doug Winnie. An example of how to add the loaded external asset to the Stage and modify its location or other properties.
    Video tutorial: Preloading in ActionScript 3.0.  By Lee Brimelow. A slightly more complicated example, showing how to  make the parent SWF display information about the progress of loading  the external SWF.
    Tutorial: Loading and unloading SWFs - FlashAndMath.com
    This article provides several examples of how to communicate between a parent SWF file and the loaded SWF:
    SWF to SWF Communcation via ActionScript 3.0 (by kglad)

    quote:
    Originally posted by:
    NedWebs
    You now seem to want to get rid of the swf once it has loaded
    and played itself thru. To do that you would need to have something
    in the swf itself that triggers its removal in its last frame. The
    following might work...
    MovieClip(this.parent).removeChild(this);
    Unfortunately I couldn't get this to work. I placed it on the
    last frame of the SWF to be called - is that right?
    I am not sure I am doing it correctly...

  • Invoke method in another source file?

    Hello,
    I'm new to java programming (and OO in general), I feel that I have a basic understanding of OO design (just to give an idea of where I'm at).
    My problem: I can't figure out how to access methods or instance variables in other source files (.java files) within the same package. Here's a couple examples of what I'm trying to do....
    ex1.
    MainFrame.java
    public class MainFrame extends JFrame {
    MainFrame mainFrame = new MainFrame();
    mainFrame.setVisible(true);
    ~I have a button on this form that when clicked does this....
    MainFrame.this.setVisible(false); *as a side note, I don't understand  exactly what this statement means, but it's the only way I could make it hide the frame (so feel free to help me on this too if you don't mind-the confusion is; to hide a label I can just say mylablename.setVisible(false) why do I have to say myframename.this.setVisible when I'm dealing with a Frame?)
    NewEstimate estimate = new NewEstimate(); //inst. and show next frame
    estimate.setVisible(true);
    ~NewEstimate is the name of the other java source file (NewEstimate.java)
    so after clicking the button my new form loads, and I have another button that when clicked should close my estimate form and show mainFrame again, this is where my problem is....
    I want to just dipose this form because I want it instaniated each time so I just want to dispose() this one so...
    MainFrame.setVisible(true); //show the main frame again
    dispose();
    ....I get the error MainFrame symbol not found and I have tried all kinds of ways like mypackagename.MainFrame.setVisible(true);
    mainFrame.setVisible.setVisible(true);
    MainFrame.mainFrame.setVisible(true);
    all to no avail thus leading me to believe that one of those is correct but my problem is something else...
    I also have the same problem when trying to invoke a method in another source file and the same when trying to evaluate a variable...
    if in source1.java I have somewhre String name = mike;
    then in source2.jave I have if name equals mike do something, I get the same errors; symbol cannot be resolved.
    Thanks for taking the time to help.
    Mike

    Thanks for your reply. Here is a test case that resembles what I'm trying to do. Note that I don't want to dipose of Frame1, (my reason is that I only want to initialize it 1 time (when the program is started), so I only want to hide it when it calls Frame2. Then when the user clicks the button on Frame2, dispose of Frame2 and show Frame1 again. The specific error I'm getting in Frame2.java is in the line frame1.setVisible(true) and is frame1 symbol cannot be resolved. That is my MAIN problem (main priority at this point) but I am also having a problem evaluating or referncing variables in Frame1.java from Frame2.java; I'm assuming though that the problems are related.
    Frame1.java
    package thepackage;
    import javax.swing.JPanel;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.*;
    public class Frame1 extends JFrame {
         private JPanel jContentPane = null;
         private JButton jButton = null;
         public String name = "Bill"; //This is the variable I need to evaluate in
    frame2
         public Frame1() {
              super();
              initialize();
         private void initialize() {
              this.setSize(new java.awt.Dimension(300,200));
              this.setSize(300, 200);
              this.setContentPane(getJContentPane());
              this.setTitle("Frame1");
         public static void main(String[] args) {
              Frame1 frame1 = new Frame1();
              frame1.setVisible(true);
         private JPanel getJContentPane() {
              if (jContentPane == null) {
                   jContentPane = new JPanel();
                   jContentPane.setLayout(null);
                   jContentPane.add(getJButton(), null);
              return jContentPane;
         private JButton getJButton() {
              if (jButton == null) {
                   jButton = new JButton();
                   jButton.setBounds(new java.awt.Rectangle(58,132,182,26));
                   jButton.addActionListener(new java.awt.event.ActionListener() {
                        public void actionPerformed(java.awt.event.ActionEvent e) {
                             Frame1.this.setVisible(false);
                             Frame2 frame2 = new Frame2();
                             frame2.setVisible(true);
              return jButton;
    Frame2.java
    package thepackage;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JLabel;
    public class Frame2 extends JFrame {
         private JPanel jContentPane = null;
         private JButton jButton = null;
         private JLabel jLabel = null;
         public Frame2() {
              super();
              initialize();
    showFrame(); //set the label text to the string in variable "name"
         private void initialize() {
              this.setSize(300, 200);
              this.setContentPane(getJContentPane());
              this.setTitle("Frame2");
         private JPanel getJContentPane() {
              if (jContentPane == null) {
                   jLabel = new JLabel();
                   jLabel.setBounds(new java.awt.Rectangle(53,40,131,16));
                   jLabel.setText("");
                   jContentPane = new JPanel();
                   jContentPane.setLayout(null);
                   jContentPane.add(getJButton(), null);
                   jContentPane.add(jLabel, null);
              return jContentPane;
         private JButton getJButton() {
              if (jButton == null) {
                   jButton = new JButton();
                   jButton.setBounds(new java.awt.Rectangle(49,117,136,35));
                   jButton.addActionListener(new java.awt.event.ActionListener() {
                        public void actionPerformed(java.awt.event.ActionEvent e) {
                             frame1.setVisible(true);
                             dispose();
              return jButton;
         private void showName(){
              jLabel.setText(name); -> gives error Component.name is not
    visible
    }

  • Call and display Xcelsius SWF file from an SAP Transaction

    Hello Experts ,
                          Could you please suggest if it is possible to Call and display Xcelsius SWF file
    from an SAP Transaction and if Yes how can this be achieved.
    Regards ,
    Jerin.

    Jerin,
    It is possible to embed a Xcelsius model into an SAP WebTemplate (Anil promised to write a blog about this very soon). After that you can include the WebTemplate in the GUI menu, Role menu or Portal.
    Henk.

  • I need to access/pass variables'(s) of a .swf file into another .swf file.

    Hi all,
    I have basic knowledge of Flash and AS3.0.
    Suppose i have a flash swf file(main.swf). In this main.swf
    file, i loaded another swf file(sub.swf) by writing the following
    code snippet in main.swf file as shown in Attach Code:
    Now, how to acess the data present in main.swf into sub.swf.
    Note: Here data represents values/data stored in
    variables/objects of main.swf file.

    Does this actually work -- assigning variables directly on the loader?  I'm interested in setting flash variables on the loaded SWF, but I get a compilation error when trying something similar:
    Error: Access of possibly undefined property x through a reference with static type flash.display:Loader.
         [exec]
         [exec]             textLdr.x = 50;
    I also tried casting the loader to Object, which compiles but then fails at runtime.
    -Dave

  • How can I make a small swf file out of InDesign

    I have a 200 page book (PDF). I am trying to make a flip book to preview in web browser. How can I make a small swf file out of InDesign with the PDF I have?

    There is another point:
    if you are using JPEG images together with SWF as output file format, you could get smaller images by:
    1. using the Export For Web menu for generating size optimized JPEGs in PhotoShop opposed to Save As JPEG
    2. stripping all color management (ICC) information off the files (SWF is not very good in color management besides sRGB, I think…)
    Uwe

  • How to call methode on remot computer

    I have 2 Applcations on 2 computers in Network
    App 1 on PC1 send xml file to App2 on PC2
    how to call Methods in App2 on PC2 to read the file
    // clss A on PC1
    class A
    sendFile(){
    // clss B on PC2
    class A
    readFile(){
    how to cal method readFile from Class A on PC1

    By using Remote Method Invocation, the topic of this forum.
    See the Javadoc and the RMI tutorials.

  • How can I change the insert SWF File, I need to add a few things and make it better?

    How can I change the insert SWF File, I need to add a few things and make it better? Is there an option inside of the dreamweaver menu that I am not looking at. It would make it easier on me if I changed some things around and didn't have to do it all myself each time I used it. Just incase you was needing to remember what swf flash was, It is not a swf video either.
      <object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="640" height="480">
        <param name="movie" value="Sonic Kaboom.swf">
        <param name="quality" value="high">
        <param name="wmode" value="opaque">
        <param name="swfversion" value="9.0.115.0">
        <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
        <param name="expressinstall" value="../Scripts/expressInstall.swf">
        <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
        <!--[if !IE]>-->
        <object type="application/x-shockwave-flash" data="Sonic Kaboom.swf" width="640" height="480">
          <!--<![endif]-->
          <param name="quality" value="high">
          <param name="wmode" value="opaque">
          <param name="swfversion" value="9.0.115.0">
          <param name="expressinstall" value="../Scripts/expressInstall.swf">
          <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
          <div>
            <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
            <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
          </div>
          <!--[if !IE]>-->
        </object>
        <!--<![endif]-->
      </object>
    </div>

    If I understand correctly, Sonic Kaboom.swf needs to be edited in a separate Flash authoring program and then reinserted into your HTML document. 
    As Murray said, Flash is dead.  Nobody uses it anymore.   We use HTML5, CSS3 and JavaScript animations which have universal support from Smartphones, Tablets and other web devices that can't support Flash.   Look at Edge Animate.
    HTML animation | Download free Adobe Edge Animate CC trial
    Nancy O.

  • How to edit or modify a .swf file?

    I am trying to edit a .swf file and make some changes in the css styles.How to edit or modify a .swf file?

    You need the fla file that created the swf.  You edit the fla and publish the swf.  Swf's don't usually involve css styles.

  • How to call a exe or bat file from java program

    hi,
    i actually want to know that how to call a exe or bat file from program so that i can run them parallely.

    Try this :
    String strCmd = "myFile.bat";
    try
         Runtime rTime = Runtime.getRuntime();
         Process process = rTime.exec(strCmd);
         InputStream p_in = process.getInputStream();
         OutputStream p_out = process.getOutputStream();
         InputStream p_err = process.getErrorStream();
         p_in.close();
         p_out.close();
         p_err.close();
    catch(Exception e) {
         throw new Exception("Unable to start, "+strCmd);
    }

Maybe you are looking for