How to call a function in a class from the main timeline?

Hey Guys
I have a project in Flash with four external AS files, which are linked to items in the library using AS linkage.
What I want to do is call a function in one of these files from the main timeline, how would I go about doing this? I'm not currently using a document class, most of the code is in Frame 1 of the main timeline.
Thanks

// change type to the class name from the instance
ClassNameHere(this.getChildByName('instance_name')).SomeFunction();

Similar Messages

  • How do you call a java class from the main method in another class?

    Hi all,
    How do you call a java class from the main() method in another class? Assuming the two class are in the same package.
    Thanks
    SI
    Edited by: okun on May 16, 2010 8:40 PM
    Edited by: okun on May 16, 2010 8:41 PM
    Edited by: okun on May 16, 2010 8:47 PM

    georgemc wrote:
    To answer your impending question, either the method you're calling has to be static, or you need an instance of that other class to invoke it against. Prefer the latterAnd to your impending question after that: no, don't use the Singleton pattern.

  • I have 2 Macs - an iMac that holds my entire iPhoto library and a Mac Book Pro that I use to hold a subset of the main library - how can I transfer photos and their metadata from the main library of the iMac to my Mac Book?

    I have 2 Macs - an iMac which holds my main iPhoto library and a Mac Book Pro which holds a subset of the library. How can I transfer photos and their metadata from the main library to the smaller 1 on the Mac Book Pro?

    Link the two Macs together and use iPhoto Library Manager
    Regards
    TD

  • Using Flach CS4 and action script 2.0 how do I advance to a specific frame of the main timeline when a movie clip instance come to the end of its timeline?

    Using Flach CS4 and action script 2.0 how do I advance to a specific frame of the main timeline when a movie clip instance come to the end of its timeline?

    code on the last frame of your movieclip instance:
    _root.gotoAndStop('whatever_frame');  // will work unless this swf is loaded into another swf.  in that situation, you should use a relative path to the main timeline (eg,  _parent or _parent._parent etc).

  • VC++ WebBrowser call Javascript function in a frame of the main page

    I can successfully call JS function in the main page from VC++, but when I call the JS function in frame, GetIDsOfNames() return DISP_E_UNKNOWNNAME. The question can be describe as below:
    main page is INDEX.HTM, loaded in webbrowser control, src:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Sample</title>    
        <script type="text/javascript">
    function FuncMain()
    alert("Main Page Function Called!");
        </script>
    </head>
    <body>
    <div>
      <div id="div_test1">
        <iframe id="page_test1" width="100%" height="100%" src="test1.htm" frameborder="0" scrolling="no"></iframe>
      </div>
      <div id="div_test2">
        <iframe id="page_test2" width="100%" height="100%" src="test2.htm" frameborder="0" scrolling="no"></iframe>
      </div>
    </div>
    </body>
    </html>
    test1.htm src:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <body>
    <div>Test1 frame page</div>
    </body>
    </html>
    test2.htm src:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <script type="text/javascript">
         function showAlert(x)
    alert(x);
     function callVC()
    window.external.VCFuncTest();
        </script>
    </head>
    <body>
    <div>Test2 frame page</div>
    <div id="test_btn" style="background-color:red;width:100px;height:100px;cursor:pointer;" onclick="callVC();">Test</div>
    </body>
    </html>
    in VC++:
    VC++ code can call JS functions by CWebPage class, I found it here:  http://www.codeproject.com/Articles/2352/JavaScript-call-from-C
    in my VC project, webPage.CallJScript(_T("FuncMain")) succeeded!
    webPage.CallJScript(_T("page_test2.showAlert") failed,  the GetIDsOfNames() return DISP_E_UNKNOWNNAME. BTW, webPage.CallJScript(_T("showAlert")
    also failed! Same error.
    any help?
    Best Regards!

    Thanks for your reply Viorel_.
    i know i can define a function in the main page: 
    function showAlert_Main(x)
            document.frames('page_test2').showAlert(x);
    then, webPage.CallJScript(_T("showAlert_Main"))
    succeeds.
    but this function is just an empty shell doing nothing, and i know there must have a way to call showAlert(x) directly.

  • How can you retieve a list of classes from the Library

    Is it possible to retrieve a list of the Linkage or Export
    Classes from a swf library dynamically?
    I am building an application where I allow the user to load
    an asset swf at runtime, then they can choose to load any Exported
    class from the library of the swf. Currently it works if you know
    the name of the asset, that you want to load, but I would like to
    be able to bring up a chooser list of the assets, rather than
    having to type the Class names.
    So far I have only seen examples where "if you know the class
    name you can load it", but nothing concerning pulling the list.
    There must be a list somewhere in flash, I just want to tap into
    that.

    I saw this before and did not have a chance to go through it
    completely.
    As I was reading it, though it did not seem to be giving me
    the answer, as they seem to extend the Export clips in the library
    by extending the class.
    I'll run through that and see.
    It does give me another idea though.
    (crazy) Idea:
    What if I extend the loader class and add a method, kind of
    like what they are doing on the document class of the loaded swf,
    to pull the class names. They hard code in the class names into the
    array though.... so that is the crux of the issue.
    Somehow I think this concept is doomed to fail but, I will
    also see if that is possible.
    I suppose for the application, I could require that any user
    would use a swf with a document class that has the getAssets()
    method.... also has some problems .... namely dealing with the
    issue of "what if they do not extend" and having it fail
    gracefully.
    oh well, food for thought... I will leave this open for now
    and perhaps I will post some answer.

  • How to call C function in .m file from another function in a .mm file

    I am making an interface class between a C library and an objetive C application.
    I have not problem calling function the C library from .mm funstions,
    but I am having problems calling .m functions from the .mm class.
    here is an example of what I mean.
    here in my .m vector file
    *struct dVector*
    * float m_x;*
    * float m_y;*
    * float m_z;*
    * float m_w;*
    *struct dVector InitVector (float x, float y, float z, float w);*
    *struct dVector AddVector (struct dVector* A, struct dVector* B);*
    *struct dVector SubVector (struct dVector* A, struct dVector* B);*
    here is my .mm class
    *#import <Foundation/Foundation.h>*
    *@interface iNewton : NSObject*
    * void* m_world;*
    *-(id) init;*
    *-(void) dealloc;*
    -(void) CreateBox: (Entity*) ent: (int) shapeId;*
    @end
    here is the implemrntation of function funtion CreateBox in a .mm file
    [code]-(void*) CreateBox: (Entity*) ent: (int) shapeId
    struct dVector minBox;
    struct dVector maxBox;
    // this is fine
    [ent GetBBox: &minBox: &maxBox];
    //calculate the box size and dimensions of the physics collision shape
    // this report a link errors, and I do no knwo why
    struct dVector size = SubVector(&maxBox, &minBox);
    struct dVector origin = AddVector (&maxBox, &minBox);
    // thsi work without problemen
    return NewtonCreateBox ((NewtonWorld*) world, size.m_x, size.m_y, size.m_z, shapeId, &offset.mfront.mx);
    I get these compiler errors
    Building target “tutorial102AddingRigidBody” of project “newton_iPhone” with configuration “Debug_Emulation” — (3 errors)
    cd /Users/juliojerez/Desktop/NewtonMac/NewtonSDK/newton_iPhone
    setenv MACOSXDEPLOYMENTTARGET 10.5
    setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr /bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.0 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2 .1.sdk -L/Users/juliojerez/Desktop/NewtonMac/NewtonSDK/newtoniPhone/build/DebugEmulation-iphonesimulator -L/Users/juliojerez/Desktop/NewtonMac/NewtonSDK/newton_iPhone/../sdk -F/Users/juliojerez/Desktop/NewtonMac/NewtonSDK/newtoniPhone/build/DebugEmulation-iphonesimulator -filelist /Users/juliojerez/Desktop/NewtonMac/NewtonSDK/newtoniPhone/build/Debug_Emulation-iphonesimulator/tutorial_102_AddingRigidBody.build/ Objects-normal/i386/tutorial_102AddingRigidBodies.LinkFileList -mmacosx-version-min=10.5 -framework Foundation -framework UIKit -framework OpenGLES -framework QuartzCore -framework CoreGraphics -lnewton_iPhoneEmulation -o /Users/juliojerez/Desktop/NewtonMac/NewtonSDK/newtoniPhone/build/Debug_Emulation-iphonesimulator/tutorial_102_AddingRigidBodies.app/ tutorial_102AddingRigidBodies
    Undefined symbols:
    "AddVector(dVector*, dVector*)", referenced from:
    -[iNewton CreateBox::] in iNewton.o
    "SubVector(dVector*, dVector*)", referenced from:
    -[iNewton CreateBox::] in iNewton.o
    "Scale(dVector*, float)", referenced from:
    -[iNewton CreateBox::] in iNewton.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    "AddVector(dVector*, dVector*)", referenced from:
    -[iNewton CreateBox::] in iNewton.o
    "SubVector(dVector*, dVector*)", referenced from:
    -[iNewton CreateBox::] in iNewton.o
    "Scale(dVector*, float)", referenced from:
    -[iNewton CreateBox::] in iNewton.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    Build failed (3 errors)
    Basically I can call objective C class methods from .mm files,
    but I can not call functions who are not members of a class from .mm funtions.
    Does any one knows how I can solve this?
    I have two books on objective C and neither show how to do that.
    Please I will apreciate if some one can help me with this.
    Julio Jerez

    julio jerez wrote:
    // this is fine
    [ent GetBBox: &minBox: &maxBox];
    why will tha be wrong?
    ent is a objective C class with a method GetBBox
    wich I use in hundred of places with out problem.
    Beside that is not the problem that.
    Well, you've got me on this one. You are correct. Apparently you don't need to specify the parameter names. Still, I strongly encourage you to use parameter names. Even though they apparently aren't required, I've never seen them not used. I would have expected to see:
    [ent GetBBoxMin: & minBox max: & maxBox]
    The problem is calling C function that are declared in .m files.
    if you read the errors, they are linking errors not compiler errors.
    this is a C function that is declared in a .m file
    struct dVector size = SubVector(&maxBox, &minBox);
    beside I also use those functions in many other place as well in teh project and they work.
    If it helps I can post a link to the a download place to the xcode project maybe it is eassy to see what I am trying to do.
    That would probably be a good idea.
    Normally, all you need is
    extern "C"
    but there is so much missing from what you've posted that I can't tell for sure what is going on.

  • How to call particular method in action class from Portlets StrutsContent

    I am developing a web application which uses weblogic portlets and struts. This is what I have for now in the .portlet file.
    +<netuix:strutsContent action="getStudentList" module = "people/students"+
    refreshAction = "getStudentList" reqestAttrpersistence="none"/>
    I want it to change something like this:
    +<netuix:strutsContent action="getStudentList.do?method=allGrads" module = "people/students"+
    refreshAction = "getStudentLis.do?method=allGrads" reqestAttrpersistence="none"/>
    But this is not working. So how can I achieve something like that?
    Thanks
    Edited by: user13634949 on Jun 23, 2011 1:22 PM
    Edited by: user13634949 on Jun 23, 2011 1:22 PM

    No, i dont know how to call other than main methods from other classes
    And one more doubt i have i.e. Like in C can we see the execution of the program like how the code is being compiled step by step and how the value of the variable changes from step to step like(Add Watch).........

  • How to call a method of a class where the name of method is string

    i have a method of a class in the form of a string and i have the object of the class to which it belongs .what i want to do is call this method.
    for ex:
    S1 s=new S1();
    // this is the object of my class. this class has one method called executeMe()
    String methodname="executeMe";
    //i have the name of the method with me in the form of string.
    so how can i call the class's method in this scenario from the string like what should i write in sucha way that i get s.executeMe(); it is not presumed that this will only be the method that will be called. there maybe some other method too and it has also to be called this way. so please guide.

    S1 s = new S1();
    String name = "executeMe";
    Method m = s.getClass().getDeclaredMethod(name,null); // no parameters
    m.invoke(s,null);Built from memory, maycontain flaws.

  • How to call a method of a class from another class

    Hi,
    Can some one explain me this? I want the label from the Label class to be displayed in the JFrame. I understand to do this, I have to call "label" to the ABC() and createAndShowGUI().
    I am novice. It will be really helpful if you could explain me what you did.
    class Label {
      public Label() {
      public JTextField label;
      label = new JTextField("Hi");
    public ABC() {    //Constructor
              Container c = getContentPane();
              c.setLayout(new FlowLayout());
        private static void createAndShowGUI() {
            //Create and set up the window.
            JFrame frame = new JFrame("FrameDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            JLabel emptyLabel = new JLabel("");
            emptyLabel.setPreferredSize(new Dimension(600, 400));
            frame.getContentPane().add(emptyLabel, BorderLayout.CENTER);
            //Display the window.
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args) {
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
        }Will it be some thing like this?
    public ABC() {    //Constructor
              Container c = getContentPane();
              c.setLayout(new FlowLayout());
                    Label label = new Label();
                    label.add
    private static void createAndShowGUI() {
            //Create and set up the window.
            JFrame frame = new JFrame("FrameDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            JLabel emptyLabel = new JLabel("");
            emptyLabel.setPreferredSize(new Dimension(600, 400));
            frame.getContentPane().add(emptyLabel, BorderLayout.CENTER);
           frame.add(new Label());
            //Display the window.
            frame.pack();
            frame.setVisible(true);
        }

    merit wrote:
    Hi,
    Can some one explain me this? I want the label from the Label class to be displayed in the JFrame. I understand to do this, I have to call "label" to the ABC() and createAndShowGUI().
    I am novice. It will be really helpful if you could explain me what you did.
    class Label {
    public Label() {
    public JTextField label;
    label = new JTextField("Hi");
    public ABC() {    //Constructor
              Container c = getContentPane();
              c.setLayout(new FlowLayout());
    private static void createAndShowGUI() {
    //Create and set up the window.
    JFrame frame = new JFrame("FrameDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JLabel emptyLabel = new JLabel("");
    emptyLabel.setPreferredSize(new Dimension(600, 400));
    frame.getContentPane().add(emptyLabel, BorderLayout.CENTER);
    //Display the window.
    frame.pack();
    frame.setVisible(true);
    public static void main(String[] args) {
    //Schedule a job for the event-dispatching thread:
    //creating and showing this application's GUI.
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();
    }Will it be some thing like this?
    public ABC() {    //Constructor
              Container c = getContentPane();
              c.setLayout(new FlowLayout());
    Label label = new Label();
    label.add
    private static void createAndShowGUI() {
    //Create and set up the window.
    JFrame frame = new JFrame("FrameDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JLabel emptyLabel = new JLabel("");
    emptyLabel.setPreferredSize(new Dimension(600, 400));
    frame.getContentPane().add(emptyLabel, BorderLayout.CENTER);
    frame.add(new Label());
    //Display the window.
    frame.pack();
    frame.setVisible(true);
    You know it maybe that it's just too late at night for me, but I see you complete Label class, but I don't see a class definition for ABC; you have a constructor for it, but not a class definition for it.
    In any case, when you define a class, you use it in the same way any other class is used...
    MyClass myObjectRef = new MyClass();

  • How to call a method in IMPL class from one context node

    Hi, I´ve been only study the posibility to access a method in the IMPL class  from one context node class...CN## without using events, is there a way to call it ??? I don´t have it as requierement just learning thanks !.

    Hi,
    Try this by following this you can get the custom controller instacne in the view context nodes, for your requirement you can keep the view implementation class instance instead of cuco..
    To get the custom controller instance in Context node getter/setter method:
    1. Declare Cuco instance reference variable in ctxt class..
    2. Set this cuco ref. in the Create context node method of ctxt class:
    try.
    gr_cucoadminh ?= owner->get_custom_controller( 'ICCMP_BTSHEAD/cucoadminh' ). "#EC NOTEXT
    catch cx_root.
    endtry.
    you can avoid this step as this is not needed in case of view isntance
    3. Assign this instance to the respective context node Create method using:
    BTStatusH->gr_cuco ?= gr_cucoadminh.  " here assign the view implementation ref. " me" instead of gr_cucoadminh
    Here gr_cuco is the ref. variable of custom controller in the respective context node for eg. BtstatusH
    Sample implementation of this can be found in
    ICCMP_BTSHEAD/BTSHeader ->context node BTACTIVITYH-> attr ->GR_CUCO(instance of cuco)
    Cheers,
    Sumit Mittal

  • Problem:  Unable to call a function in parent swf from the child swf.

    I am working on a site right now that has a parent loader
    (all it contains are the menu bar [which is as3 tweened] and the
    functions for calling all of the other pages.) The problem that I
    am having right now, are some of the internal or child pages, need
    to call functions that are in the parent loader. For what ever
    reason, I am unable to do any of that.
    I have attached the code so you can look at that.
    Let me see if I can explain it any better.
    The code I just posted is for the Main Stage swf called
    loader.swf. It has the menu, and all the functions that control the
    menu's movement and when to load all the other swfs. The easiest
    way for me to ask this, is to show you.
    click
    http://dev.locallinux.com/mystictan/layout2.html
    When you get there, you will see the menu bar, and it is
    loading home.swf onto the stage behind the menu.
    Mouse over "The Perfect Tan" and click on "1: Base"
    You will notice it just loaded a new swf called ptbase.swf.
    Well in that swf is a button for "Products" That button
    basically needs to take you to "Products > 1: Base" on the menu
    (not working yet, I know. But theres no point in me making that,
    until I could get this working"
    What I would like is when you click on "Products" in
    ptbase.swf, it calls the function clickedProductsBase(), which does
    its thing. But that function is back in the loader.swf. Does that
    make sence?
    What am I missing here?

    RyanORo, thank you very much for your response.
    I try that, and I get this sort of error when I click on it:
    TypeError: Error #1006: fwd is not a function.
    at ptbase_fla::MainTimeline/testing()
    I know all that code that I posted was a bith much, but here
    is the movie loading part:
    function loadComplete(event:Event):void
    loaderbar.visible = false;
    mainbody.removeChild(thisMC);
    thisMC = MovieClip(myloader.content);
    myloader.unload();
    mainbody.addChild(thisMC);
    thisMC.gotoAndStop(1);
    TransitionManager.start(thisMC, {type:Fade,
    direction:Transition.IN, duration:5, easing:Strong.easeOut});
    mainbody is an empty mc under the menu, so that the loaded
    swf file appears under the menu.
    You know what, scratch all that . *MOOWHA* I could KISS you
    right now. "(parent as MovieClip).clickedProductsBase()" did not
    work because it was calling it out of the wrong parent. Just did
    "(this.parent.parent as MovieClip).clickedProductsBase()" and that
    did the magic I needed. Thanks...

  • How do I play a symbol timeline from the main timeline

    Ive created a box, turned it into a symbol called box,
    Inside box i have a left to right animation with auto play turned off.
    I then went back to the main stage, clicked the box, added action, on click to play, yet it does nothing.
    How do i Play the symbols timeline?

    On click handler for the symbol use
    sym.getComposition().getStage().getSymbol("nameofsymbol").play();
    or
    sym.getSymbol("nameofsymbol").play();
    replace the italics with the literal name of the symbol as it appears in the Elements panel.
    Some API details found here (http://www.adobe.com/devnet-docs/edgeanimate/api/current/index.html) in the Work With Symbols section.
    Darrell

  • Calling a method in a tab from the main window.

    I came into this project and I don't fully understand why I can't do what I want to do.
    The previous writer creates a main GUI that looks like a normal Windows Application with the menus and things. Then inside he has tabs to navigate to the various parts of the program where the user can input data and receive results. This I understand. He begins the program by using a starter to create a new MainGUI calling it MainGUI.  My problem is now that I am working on the tab and want to call one of MainGUI's get methods, I can't. I can call from another tab. EX: SitePropPanel.getOpenYear() where SitePropPanel is another tab that is created in the MainGUI.  When I try to use MainGUI.getData() it just says _MainGUI cannot be resolved.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    In case it is not clear, In the tab, I want to I want to be able to call a getter method that exists in the MainGUI. I thought I could do this by saying
    MainGUI.getData();  I used MainGUI because that is name the previous programmer gave to the instance of the class, MainGUI, in the Starter class.

  • How to call a function inside a class? 

    Hello, i am trying to fire a function onPress .. this
    function is inside a class.
    In this function i refer to another function inside the calss
    to call a Tween. It never arrives in the second function.
    I tried to make an example.
    In the fla file i have:
    var test:makeMovie = new makeMovie(this);
    You will see a red squere and you can press on it. It should
    run the tween class. Am i using the delegate class wrong?

    I always have to use test movie and trace a couple of times
    each time I start to use Delegate.
    It wraps function.apply I think, which I tend to use more
    often.
    try using:
    Container.onPress = Delegate.create(this,setAlpha);
    and then just
    setTween()
    inside your setAlpha....
    That's conceptually how I think I would try it above if I was
    doing something similar.
    I'm not sure it would have the desired effect even if the
    delegate was executed as you have it coded. Unless you want
    setTween's execution scope to be the Container clip in which case
    you might need to do what kglad said and change the Container
    reference to 'this'.
    The way you have it at the moment inside setAlpha the
    Delegate.create is simply creating a function...and not excuting
    it.
    its like : function something(){trace('what')}
    and not like : something();
    Below is some quick code that helps show how things work.
    Notice that I assigned the delegate function to mainFunc....so that
    along with the last example might provide a clue. Just paste it on
    a frame and take a look at what's happening.

Maybe you are looking for