Accessing parent function from class

Hey guys
I have a .fla file with some code in the actions panel.
A bit of code calls a function in a class from the actions panel
The function in the class is run, but I want to be able to call a function in the main actions panel code from the function in that class
The class doesn't extend anything so (parent as MovieClip).function() does not work
Any ideas?
Thanks
Chris

if you're trying to reference code attached to a timeline, your class will need a displayobject reference.  you can pass it a reference when instantiating a class object:
// on a timeline:
var c:YourClass=new YourClass(this);  // code your constructor to accept this movieclip reference.
you can then use that reference to access code in any timeline (that exists when trying to reference):
private var tl:MovieClip;  // import the mc class.
public funciton YourClass(mc:MovieClip){
tl=mc;

Similar Messages

  • How do you access parent component from a child in Flex 4?

    Suppose I have a Component A (as a Spark Group) that generates an event, eventX.  Inside Component A, I add Component B (also a Spark Group) that wants to add itself as an event listener for eventX.  How do I access Component A from Component B to register for the event?
    For reference, this relationship should be similar to the MVC pattern where Component B is the view, and Component A is the model and controller.
    If I were implementing this in ActionScript, I'd have no problem coding this.  However, I am using flex, and am still trying to figure out how the FLEX API works.

    GordonSmith wrote:
    B could "reach up" to A using the parentDocument property. Or you could set a reference-to-A onto B.
    Gordon Smith
    Adobe Flex SDK Team
    B could "reach up" to A using the parentDocument property
    Would you mind explaining that?
    set a reference-to-A onto B.
    That is something I am trying to avoid.  I do not want to create tightly coupled code.
    Here is a generic form of the code I am using.  Feel free to tell me what I'm doing wrong in your explanation of how B can "reach up" to A.  Thanks!
    Component A
    <?xml version="1.0" encoding="utf-8"?>
    <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx" width="837" height="733"
                     creationComplete="componentA_creationCompleteHandler(event)"
                     xmlns:components="components.*">
         <fx:Script>
              <![CDATA[
                   import mx.events.FlexEvent;
                   public static const STATE_CHANGED:String = "stateChanged";
                   private var currentModelState:String;
                   protected function componentA_creationCompleteHandler(event:FlexEvent):void
                        changeModelState("second");
                   public function changeModelState(newState:String):void
                        if (newState != currentModelState)
                             currentModelState = newState;
                        dispatchEvent(new Event(IP_Dragon.STATE_CHANGED));
                   public function getModelState():String
                        return currentModelState;
              ]]>
         </fx:Script>
         <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
         </fx:Declarations>
         <components:Component_B id="b" x="0" y="0"/>
    </s:Group>
    Component B
    <?xml version="1.0" encoding="utf-8"?>
    <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx"
               xmlns:components="components.*"
               width="837" height="733" contentBackgroundAlpha="0.0" currentState="first"
               creationComplete="componentB_creationCompleteHandler(event)">
         <fx:Script>
              <![CDATA[
                   import mx.events.FlexEvent;
                   protected function componentB_creationCompleteHandler(event:FlexEvent):void
                        currentState = parent.getModelState;
                        parent.addEventListener(Component_A.STATE_CHANGED, modelStateListener);
                   private function modelStateListener (e:Event):void
                        currentState = parent.getModelState();
              ]]>
         </fx:Script>
         <s:states>
              <s:State name="first"/>
              <s:State name="second"/>
              <s:State name="third"/>
         </s:states>
         <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
         </fx:Declarations>
         <components:Component_C includeIn="first" x="220" y="275"/>
         <components:Component_D includeIn="second" x="2" y="0"/>
         <components:Component_E includeIn="third" x="0" y="8"/>
    </s:Group>
    For the record, I know this code does not work.  It has to do with the parent calls in Component B.  Comment out those lines, and the code will compile.

  • Unable to access protected function from the child object

    Hi all ,
    I have an abstract class having one protected method
    package foo;
    public abstract class A {
      protected String getName(){
                 return "ABC';
    package xyz;
    public class B extends A {
              public void print(){
                              *super.getName();//this will get called*
    package abc;
    public class Ex {
            public static void main(String [] args){
               B b = new B();
               *b.getName(); //Im not able to calll this function*
    }{code}
    My question is why I m not able to call the protected method from child instance but inside the class ???
    I have checked this link , it also didn't say about the instance access or access within class .
    [http://java.sun.com/docs/books/tutorial/java/javaOO/accesscontrol.html]
    Thanks and regards
    Anshuman
    Edited by: techie_india on Aug 31, 2009 11:25 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    jossyvjose wrote:
    Hi Winston,
    Did you mean like this? But still same behaviour.
    package abc;
    public class Ex extends A {
    public static void main(String [] args){
    B b = new B();
    b.getName(); //still i am not able to calll this function
    }No. Class 'Ex' would have to extend B in order to call b.GetName(). And I would definitely not make Ex part of your hierarchy (it's the sort of thing you see in SCJP questions, but definitely a bad idea).
    What you can do though is to override the method; and Java allows you to change the visibility of overriden methods, provided they are more open. Thus, the following would be allowed:
    package foo;
    public abstract class A {
       protected String getName(){
          return "ABC';
    package xyz;
    public class B extends A {
       public void print(){
          System.out.println(super.getName()); // your previous code does nothing...
       public String getName() { // Note the "public" accessor
          return super.getName();
    package abc;
    public class Ex {
       public static void main(String [] args){
          B b = new B();
          b.getName(); // And NOW it'll work...
    {code}Note that this is just example code. I wouldn't suggest it as general practise.
    Also, when you write *public* methods, you should generally make them *final* as well (there are exceptions, but it's a good habit to get into; like making instance variables *private* - just do it).
    HIH
    Winston                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Accessing a dll from classes in different packages

    Hello java community,
    I am new to Java and especially the jni so your help is greatly appreciated.
    I am having trouble accessing a Windows native dll from classes in different packages. I placed the .dll in my ClassPath. I am able to loadLibrary successfully from class X in my 'common' package. However, when I try to access the same .dll from another class Y in package 'notsocommon'. I get an unsatisfied link error. I changed the X.h file to include common in the function definition (eg. Java_common_X_functionName) and I did the same to the Y.h file (Java_notsocommon_Y_functionName). I am able to work with the dll from the X class but not the Y class. I don't know what I am doing wrong. I am very new to Java, so any help is appreciated.
    Thank you.

    I apologize to everyone for posting this. I figured out my mistake, it was in the dll and not in the java. Also using
    javah -jni notsocommon.Y
    creates the correct header file.

  • What is the syntax for calling function from class file by jsp

    does anyone here knows what is the syntax of how to call a function from java class file by javascript code or any way to call it?
    and where should i put the calling function code? because the function is called depend on the user click.
    for example
    <%=pc.functionName(a,b)%>
    for the variable a and b, how can i get the value from html textbox and put it in a and b...
    urgent needed...
    thx

    Jsp's are executed before the Html forms are created and loaded. Dont try to use a java code function calling on a javascript click. You'll have to explicitly redirect it into a servlet where in you can call the function you want.
    Well! another way could be using AJAX. That seems to be powerfull enough and it might also serve your purpose.
    Hope this helps

  • IFRAME in portlet question - possible to call parent function from iframe?

    From the iframe I tried to call the parent function by doing this parent.myFunc(). I got a permission denied javascript message. Just curious if anyone has successfully done this. If so please share your thoughts and comments.

    Hi,
    You will get "Persmission denied" error due to cross site scripting. Either you need to change browser settings to allow cross site scripting or you need to make sure both the URLs fall under same parent domain like both URLs ending with "*.abc.com".
    Thanks

  • Accessing a function from a movieclip form a top level layer

    Im having a dillema. my whole game rests on being able to
    access functions from a movieclip inside a movieclip in a top level
    layer called "Cards" to another layer called "Functions". I've used
    this code:
    play_modifier_card(this.num.text);
    to access this function:
    function play_modifier_card(card_num){
    trace(card_num);
    It works OK when the function is in the movieclip but not
    when it is in a top level layer. I tried
    "_root.play_modifier_card(this.num.text);" but it didn't work. Any
    help appriciated. Thanks in advance.

    _global.play_modifier_card(card_num) {
    trace(card_num);
    }

  • How to access parent document from Java listener

    I have two applications, let's call them Gantt and Activity List. The Gantt application is an ADF application. The Activity List application is not. The Gantt application is hosted inside an <iframe> in the Activity List application. There is an input text entry field with ID "unassignedTaskId" in the Activity List application.
    In the Gantt application, when the user clicks a button, there's a Java "listener" method in a bean. In this Java code, I want to access the value in that "unassignedTaskId" field and use it. How can I do that? JavaScript will not work for me in this case. I can access the UIViewRoot which is the top-level component in my page, but how do I get that one more level up, into the owner of the <iframe>, from the listener Java code?
    I am using JDeveloper 11.1.1.0.2. Any advice appreciated.

    I found a way to achieve what I want. I finally realized (I don't know why it took me so long) that the Java code was server code and that the UIViewRoot is sort of a copy of what is in the "real" DOM. Of course I can't get to the outer frame. Duh!
    Once that finally clicked, I looked around and rediscovered clientListeners. I added a Javascript function getUnassignedTaskId(event) to get the value from the parent app and copy it into a hidden component in my app. Then I added an af:clientListener to my button to call this function. The clientListener gets called before the actionListener. So first the client side JavaScript copies the value from the parent app to my ADF app's hidden control, then the server side Java code can see it via the hidden control and its backing bean. Problem solved!

  • Accessing JavaScript function from an Applet?

    Hi,
    I've found how to access an applet's method from Jscript, but can we do the inverse? I'd like to refresh some frames in my web pages from my applet.
    The refresh of several frames could be done with a Jscript function but how can I call it from my applet?
    Thanks!
    Stephane

    actually look at this link to make more sense
    http://www.woodger.ca/jv_jsint.htm

  • How to access graphic components from classes?

    Hi,
    I am creating a Flex application. In my Main.mxml, I add
    different UI elements, such as panels. I also have a few
    actionscript files. Everything is in the same folder. So my
    question is : how can I access a panel created in Main.mxml from an
    actionscript class ? By accessing the panel, I mean things like
    change its properties, etc. Is it possible to access those in a
    'Flash-like' way, using something like _root.myPanel, or is it only
    possible through passing parameters?

    Well...it pains me to see someone obviously new to programming struggle here...so I'll take this one on:
    Here is the BAD way to do it...but it is basically what you are looking for...to learn GOOD ways to do this, please invest in some programming books and learn about encapsulation, MVC, and other programming/architectural styles...anyways...here is the BAD, but easy way:
    In your SGui class, right after the constructor you have to "declare" your object reference as a class member, so edit your file to make it say:
    public class SGui {
         public JButton addStickButton;Then, edit the line in SGui that says:
    final JButton addStickButton = new JButton();so that it just says:
    addStickButton = new JButton();Then, in your Soft class, you can access it just the way you wanted to in your comment:
    gui.addStickButton.setEnabled(false);Other Java programmers reading this thread will probably shoot me for showing you how to do it this way, because it violates principles of encapsulation...but go ahead and use it so you can move forward...but study a little more online or in books to get the hang of it :)
    Message was edited by:
    beauanderson
    Message was edited by:
    beauanderson

  • Accessing Common functionality from multiple parts of my web app

    I have a web app and one of the modules is getting used by other modules in the application.
    This was ok when we had 2 modules accessing this module but now we are adding more and more.
    The module consists of JSP and Servlets and Backend DAO's.
    Right now I have special cases (if statements) that determine what module is accessing this module (each module passes in it id in the URL for example testId, correctionId.
    Basically what this module creates can be assoicated with other modules, so the DAO will save and then check to see if certian module ids are present and then does a save based on that.
    I dont think this solution is very elegent and I was wondering if anyone had any suggestions on a good way to design this module so it can be easily accessed from other modules in my application.
    So to summerize:
    All my modules are JSP/Servlet/DAO/Model Code
    One of my Modules is accessed from many other modules.
    When this module saves its data to the database, it has to take the id that the calling module passsed into it and determine what database bridge table it should save to.
    I want to if anyone has any suggestions on how to design this so allowing more modules to access this module will not require anot of extra code in the module.
    Thank you,
    Al

    Hello Al,
    Use DAO Pattern.
    Have a Factory Class which determines which DAO object it instantiates and hands it over to the Servlet.
    Based on the ID, Create the instance object of the DAO and have an interface which has the contract method.
    What I mean is :
    For Example lets say u have a Interface "ModuleDAO". Have a method "persistData"...
    Create 2 DAO Implementations which implement the same Interface and both will have their own "persistData" implementation going to the respective Tables. The reason why I am recommending multiple DAO implementation is to avoid If else / etc and complex coding.The implementations are independant of each other.
    Have a DAO Factory [or you can use Spring Framework Bean Factory] infront and have your servlet request for the DAO Implemntation based on the ID.
    Your servlet should have NO reference to the Internal Implementation which is being retuirned. It only need to know about the Interface. This way code is clean, decoupled from logic and easier if you want to move the logic out to EJB / External WebServices, etc...
    Hope this helps.
    By this way, you are exercising all "Factory, DAO and Bridge" Design Patterns.
    Thanks,
    Pazhanikanthan. P

  • Using Parent Functions from Child

    I have created an application utilizing numerous components.
    Each component encompasses it's own functions. This has become an
    issue as the application has grown and I need to refresh components
    based on the click of a tab navigator.
    Being very new to flex 2 I am wondering how I could put all
    of the functions now in the components on my main.mxml and call
    them from the children (components)? I believe that this would
    allow me an easy way to refresh the different components utilizing
    a large init() function in main.mxml.
    Also, is it possible to call the init() functions of my
    components from the main.mxml. This would also allow me to refresh
    components. If it's possible I would like to see a simple example
    of the process.
    Thanks for the help. I appreciate it.
    Mark

    This code may help:
    components/init/InitButton1.mxml---------------------
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Button xmlns:mx="
    http://www.adobe.com/2006/mxml"
    label="ButtonOne" creationComplete="init()">
    <mx:Script>
    <![CDATA[
    public function init():void {
    setStyle("fontWeight", "bold");
    setStyle("fontSize", "10");
    setStyle("color", "0xFFFFFF");
    ]]>
    </mx:Script>
    </mx:Button>
    components/init/InitButton2.mxml---------------------
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Button xmlns:mx="
    http://www.adobe.com/2006/mxml"
    label="ButtonTwo" creationComplete="init()">
    <mx:Script>
    <![CDATA[
    public function init():void {
    setStyle("fontWeight", "bold");
    setStyle("fontSize", "5");
    setStyle("color", "0x000000");
    ]]>
    </mx:Script>
    </mx:Button>
    ----------------------------- Test.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    xmlns:comp="components.init.*"
    horizontalAlign="center" verticalAlign="middle">
    <mx:Script>
    <![CDATA[
    import mx.controls.Button;
    public function changeBtn1Styles(event:Event):void {
    if(event.target.id != "btn1" && event.target.id !=
    "btn2"){
    btn1.setStyle("fontWeight", "normal");
    btn1.setStyle("fontSize", "30");
    public function changeBtn2Styles(event:Event):void {
    if(event.target.id != "btn1" && event.target.id !=
    "btn2"){
    btn2.setStyle("fontWeight", "normal");
    btn2.setStyle("fontSize", "40");
    public function resetStyles(event:Event):void {
    var currBtn:Button = Button(event.currentTarget);
    if(currBtn.id == "btn1"){
    btn1.init();
    if(currBtn.id == "btn2"){
    btn2.init();
    ]]>
    </mx:Script>
    <mx:TabNavigator>
    <mx:VBox label="Button One" width="300" height="150"
    backgroundColor="0x0000CC" horizontalAlign="center"
    verticalAlign="middle" click="changeBtn1Styles(event)">
    <comp:InitButton1 id="btn1"
    click="resetStyles(event)"/>
    </mx:VBox>
    <mx:VBox label="Button Two" width="300" height="150"
    backgroundColor="0xCC3333" horizontalAlign="center"
    verticalAlign="middle" click="changeBtn2Styles(event)">
    <comp:InitButton2 id="btn2"
    click="resetStyles(event)"/>
    </mx:VBox>
    </mx:TabNavigator>
    </mx:Application>

  • Object not embedded error whenever i tried to access actionscript function from js

    hi,
    i badly need help in embedding my swf in html , because it keeps saying that my object is undefined.
    object undefined error.
    i am trying to pass values from js to actionscript and then i embedded it.
    i tried to embed it using embed and object tags only, but the javascript functions are not working.
    It keeps saying that object is expected.
    <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
      codebase="http://download.macromedia.com/" WIDTH="500" HEIGHT="500" id="flaMovie1">
      <PARAM NAME=movie VALUE="dwpPlayer.swf">
      <PARAM NAME="allowScriptAccess" value="always" />
      <PARAM NAME=quality VALUE=high>
      <EMBED src="dwpPlayer.swf"
        quality=high bgcolor="#aaaaaa" WIDTH="400" HEIGHT="200"
        TYPE="application/x-shockwave-flash"
        PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
      </EMBED>
    </OBJECT>
    i am trying to embed it that way, the swf is showing but the javascripts and functions are not working..
    please help. i already tried using the AC FL RunContent, yes it is showing but i can't postion my items using this
    <table>
                            <td>
                            hoy!
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div visibility:visible>
                                <script language="JavaScript" type="text/javascript">
                                AC_FL_RunContent(
                                'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0',
                                'width', '400',
                                'height', '400',
                                'src', 'dwpPlayer',
                                'quality', 'high',
                                'pluginspage', 'http://www.adobe.com/go/getflashplayer',
                                'align', 'middle',
                                'play', 'true',
                                'loop', 'true',
                                'scale', 'showall',
                                'wmode', 'window',
                                'devicefont', 'false',
                                'id', 'dwpPlayer',
                                'bgcolor', '#ffffff',
                                'name', 'dwpPlayer',
                                'menu', 'true',
                                'allowFullScreen', 'false',
                                'allowScriptAccess','always',
                                'movie', 'dwpPlayer',
                                'salign', ''
                                ); //end AC code
                                </script>
                                </div>
                            </td>

    here's a sample of correct embedding html.  you'll need AC_RunActiveContent.js, too:
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Bday-flowers_Preview_NoMusic</title>
    <script language="javascript">AC_FL_RunContent = 0;</script>
    <script src="AC_RunActiveContent.js" language="javascript"></script>
    </head>
    <body bgcolor="#cdb4a7">
    <!--url's used in the movie-->
    <!--text used in the movie-->
    <!--
    <p align="center"><font face="Arial" size="40" color="#2d3271" letterSpacing="0.000000" kerning="1">Preview Only</font></p><p align="center"></p><p align="center"><font face="Arial" size="40" color="#2d3271" letterSpacing="0.000000" kerning="1">(Your message will </font></p><p align="center"><font face="Arial" size="40" color="#2d3271" letterSpacing="0.000000" kerning="1">appear here.)</font></p><p align="center"></p><p align="center"></p><p align="center"></p><p align="center"></p><p align="center"></p><p align="center"></p>
    -->
    <!-- saved from url=(0013)about:internet -->
    <script language="javascript">
        if (AC_FL_RunContent == 0) {
            alert("This page requires AC_RunActiveContent.js.");
        } else {
            AC_FL_RunContent(
                'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
                'width', '990',
                'height', '680',
                'src', 'Bday-flowers_Preview_NoMusic',
                'quality', 'high',
                'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
                'align', 'middle',
                'play', 'true',
                'loop', 'true',
                'scale', 'showall',
                'wmode', 'window',
                'devicefont', 'false',
                'id', 'Bday-flowers_Preview_NoMusic',
                'bgcolor', '#cdb4a7',
                'name', 'Bday-flowers_Preview_NoMusic',
                'menu', 'true',
                'allowFullScreen', 'true',
                'allowScriptAccess','sameDomain',
                'movie', 'Bday-flowers_Preview_NoMusic',
                'salign', ''
                ); //end AC code
    </script>
    <noscript>
        <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="990" height="680" id="Bday-flowers_Preview_NoMusic" align="middle">
        <param name="allowScriptAccess" value="sameDomain" />
        <param name="allowFullScreen" value="true" />
        <param name="movie" value="Bday-flowers_Preview_NoMusic.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#cdb4a7" />    <embed src="Bday-flowers_Preview_NoMusic.swf" quality="high" bgcolor="#cdb4a7" width="990" height="680" name="Bday-flowers_Preview_NoMusic" align="middle" allowScriptAccess="sameDomain" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
        </object>
    </noscript>
    </body>
    </html>

  • Is it possible to call a function in a parent component from a child component in Flex 3?

    This is probably a very basic question but have been wondering this for a while.
    I need to call a function located in a parent component and make the call from its child component in Flex 3. Is there a way to access functions in a parent component from the child component? I know I can dispatch an event in the child and add a listener in the parent to call the function, but just wanted to know if could also directly call a parent function from a child (similar to how you can call a function in the main mxml file using Application.application). Thanks

    There are no performance issues, but it is ok if you are using the child component in only one class. Suppose if you want to use the same component as a child to some bunch of parents then i would do like the following
    public interface IParentImplementation{
         function callParentMethod();
    and the parent class should implement this 'IParentImplementation'
    usually like the following line
    public class parentClass extends Canvas implements IParentImplementation{
              public function callParentMethod():void{
         //code
    in the child  you should do something like this.
    (this.parent as IParentImplementation).callParentMethod();
    Here using the Interfaces, we re decoupling the parent and the child
    If this post answers your question or helps, please mark it as such.

  • How to load function from derived class from dll

    Dear all,
    how to access extra function from derived class.
    for Example
    //==========================MyIShape.h
    class CMyIShape
    public:
    CMyIShape(){};
    virtual ~CMyIShape(){};
    virtual void Fn_DrawMe(){};
    // =========== this is ShapRectangle.dll
    //==========================ShapRectangle .h
    #include "MyIShape.h"
    class DLL_API ShapRectangle :public CMyIShape
    public:
    ShapRectangle(){};
    virtual ~ShapRectangle(){};
    virtual void Fn_DrawMe(){/*something here */};
    virtual void Fn_ChangeMe(){/*something here */};
    __declspec (dllexport) CMyIShape* CreateShape()
    // call the constructor of the actual implementation
    CMyIShape * m_Obj = new ShapRectangle();
    // return the created function
    return m_Obj;
    // =========== this is ShapCircle .dll
    //==========================ShapCircle .h
    #include "MyIShape.h"
    class DLL_API ShapCircle :public CMyIShape
    public:
    ShapCircle(){};
    virtual ~ShapCircle(){};
    virtual void Fn_DrawMe(){/*something here */};
    virtual void Fn_GetRadious(){/*something here */};
    __declspec (dllexport) CMyIShape* CreateShape()
    // call the constructor of the actual implementation
    CMyIShape * m_Obj = new ShapCircle();
    // return the created function
    return m_Obj;
    in exe there is no include header of of ShapCircle and ShapRectangle 
    and from the exe i use LoadLibrary and GetProcAddress .
    typedef CMyIShape* (*CREATE_OBJECT) ();
    CMyIShape*xCls ;
    //===================== from ShapeCircle.Dll
    pReg=  (CREATE_OBJECT)GetProcAddress (hInst ,"CreateShape");
    xCls = pReg();
    now xCls give all access of base class. but how to get pointer of funciton Fn_GetRadious() or how to get access.
    thanks in advance.

    could you please tell me in detail. why so. or any reference for it. i love to read.
    i don't know this is bad way.. but how? i would like to know.
    I indicated in the second sentence. Classes can be implemented differently by different compilers. For example, the alignment of member variables may differ. Also there is the pitfall that a class may be allocated within the DLL but deallocated in the client
    code. But the allocation/deallocation algorithms may differ across different compilers, and certainly between DEBUG and RELEASE mode. This means that you must ensure that if the DLL is compiled in Visual Studio 2010 / Debug mode, that the client code is also
    compiled in Visual Studio 2010 / Debug mode. Otherwise your program will be subject to mysterious crashes.
    is there any other way to archive same goal?
    Of course. DLL functionality should be exposed as a set of functions that accept and return POD data types. "POD" means "plain-ole-data" such as long, wchar_t*, bool, etc. Don't pass pointers to classes. 
    Obviously classes can be implemented within the DLL but they should be kept completely contained within the DLL. You might, for example, expose a function to allocate a class internally to the DLL and another function that can be called by the client code
    to free the class. And of course you can define other functions that can be used by the client code to indirectly call the class's methods.
    and why i need to give header file of ShapCircle and shapRectangle class, even i am not using in exe too. i though it is enough to give only MyIShape.h so with this any one can make new object.
    Indeed you don't have to, if you only want to call the public properties and methods that are defined within MyIShape.h.

Maybe you are looking for

  • Question on the flow of the data from SAP R/3 to SAP BW

    hai bwgurus, I am learner of  sap bw ,i have small doubt in the extracting the data from sap r/3 to sap bw  i.e Extraction is always performed only on master data table not on transaction table , Am I right or wrong pls correct me with an detailed ex

  • Typewriter in Acrobat Pro 9

    Typewriter in Acrobat Pro 9 is now only typing in 'Comments' & not on the page. What is wrong?  I opened a pdf document > clicked the typewriter button > the usual 'A_' showed > I clicked on the document were I wanted to enter text > when finished I

  • Background image for a KM Navigation iView

    Hi Friends, I would like to put an image, that is a part of the KM repository (/documents/myPic/abc.jpg) as a background image to my KM Navigation iView. Could you please let me know all the available solutions to achieve this? EP/KMC 04s (7.0 SP06).

  • JFrame and Memory Leak

    Hello In my java application i am opening a Frame to display HTML data from database but after many times i have a problem with the memory. at each time i close the frame with dispose() but it seems that the memory does not released from JVM. if i ad

  • Best way to upgrade to ff4 rc?

    Hi there, Just realised the way I upgraded may not have been optimal. I made a back-up of my original profile... Then I turfed the app bundle from /applications & dropped the new ff4 app bundle in it's place. I removed the old shortcut from the dock,