How to inherit base class properties ?

Hi All,
I have one doubt.Can anyone clear this doubt?
Steps:
1)I have created One movieClip & named as MyComp
2)I export this movieclip to actionscript.Class name for this movieclip is MyComp.
3)After that,Dynamically I have created 5 instance for this class & added to stage.
4)Now i need to change width of MyComp. it should reflect on previous 5 instance too.
I tried like,
I have created MyComp.as file in same location. There I tried to inherite DisplayObject properties Width.
Example :
In authoring time,I have one movieclip in my library which contains one rectangle shape..Im adding 5 instance of that movieclip in stage.
After that i get into one movieclip,and im increasing width of that movieclip by increasing Shape width. it ll get reflect in all instance..
i need this thing in actionscript.... is it possible?
Thanks...

you can't do what you are trying to do the way you are trying to do it.
I have included some code here (pure AS3, no timeline or library) which you might be able to adapt to your needs
Basically I have created a static property (_rectWidth which controls the rectangles width) on the MovieClip class that contains the rectangle and a render() function that redraws the rectangle tot he correct width. Note you will have to call render() after setting a new width to see the rectangle drawn at the new  width.
Then in the main class I create 5 rectangles with random colours and positions.
The main class also listens for the "arrow up" and "arrow down" keys to change the rectangle's size. Note: I change the size of the rectangle and then run through all of the Main classes children (which are all RectMC's) and call render();
package
          import flash.display.Sprite;
          import flash.events.Event;
          import flash.events.KeyboardEvent;
          public class Main extends Sprite
                    public function Main():void
                              if (stage) init();
                              else addEventListener(Event.ADDED_TO_STAGE, init);
                    private function init(e:Event = null):void
                              removeEventListener(Event.ADDED_TO_STAGE, init);
                              // entry point
                              for (var i:int = 0; i < 5; i++)
                                        var col:uint = Math.floor(Math.random() * 0xffffff);
                                        var rectX:int = Math.floor(Math.random() * stage.stageWidth);
                                        var rectY:int = Math.floor(Math.random() * stage.stageHeight);
                                        var rectMC:RectMC = new RectMC(col);
                                        rectMC.x = rectX;
                                        rectMC.y = rectY;
                                        addChild(rectMC);
                              stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
                    private function onKeyDown(e:KeyboardEvent):void
                              switch (e.keyCode)
                                        case 38:
                                                  RectMC.rectWidth += 20;
                                                  break;
                                        case 40:
                                                  RectMC.rectWidth -= 20;
                                                  break;
                              for (var i:int = 0; i < numChildren; i++)
                                        var rectMC:RectMC = getChildAt(i) as RectMC;
                                        rectMC.render();
package 
          import flash.display.MovieClip;
          import flash.events.Event;
           * @author steven O'Boyle
          public class RectMC extends MovieClip
                    protected static var _rectWidth:int = 100;
                    protected static var _rectHeight:int = 50;
                    protected var _rectColour:uint;
                    public function RectMC(col:uint)
                              _rectColour = col;
                              render();
                    public function render():void
                              graphics.clear();
                              graphics.beginFill(_rectColour);
                              graphics.drawRect(0, 0, _rectWidth, _rectHeight);
                              graphics.endFill();
                    public static function set rectWidth(value:int):void
                              _rectWidth = value;
                    public static function get rectWidth():int
                              return _rectWidth;

Similar Messages

  • How to inherit super class constructor in the sub class

    I have a class A and class B
    Class B extends Class A {
    // if i use super i can access the super classs variables and methods
    // But how to inherit super class constructor
    }

    You cannot inherit constructors. You need to define all the ones you need in the subclass. You can then call the corresponding superclass constructor. e.g
    public B() {
        super();
    public B(String name) {
        super(name);
    }

  • How to inherit automatically folder properties

    Hi there,
    is there any automatism provided such that if I have a folder A, where for example State Management is activated, and I create folder B within folder A, that on folder B State Management will be activated (here: with the same step definitions as in folder A) too? The same question for the other properties depending on activated RepServices, like Manual Ordering, Versioning etc.?
    I know how to "inherit" this step by step programatically (not too less work), but isn't this a standard feature?!?! At least I imagin that it is a standard request?!
    If not, how about implementing in the future...
    - a boolean property on a folder of type "inherits" or so
    - or to implement a standard "inheritance" repository service?
    Thanks in advance
    Detlev

    Hi again,
    SAP has introduced now with KMC SPS 14 the "Inheritance of the Versioning Settings When Creating New Folders", see http://help.sap.com/saphelp_nw04/helpdata/en/3a/d60a15803111d5992f00508b6b8b11/frameset.htm for details.
    Advantage: It is implemented now
    Disadvantage: It is not customizable in any way; still, ApprovalWorkflow, ManualOrdering and TimeDependentPublishing inheritance are not supported.
    Hope it helps
    Detlev

  • How to inherit property class

    hello experts,
    i am using forms 10g. i created a property class in form a.
    save and compile. now i wanted to inherit that property class in form b.
    for this i subclass it from form a to form b.
    when i close the form a, it showing the message
    frm:18108 error
    source module: formA
    source object my_property (property class)
    as we say we can inherit property classes , please help me how?
    thanks
    yash

    Yash,
    In order for FORM B to find the Property Class in FORM A, FORM A must be in a directory that is part of the FORMS_PATH. It is always a good idea to create a GLOBAL.FMB (or what ever you want to call the form) or an Object Library (.OLB) that contains all of your objects that will be subclassed in other forms. Then put this .FMB or .OLB in a directory that is in your FORMS_PATH. This lets you store all of your subclass source objects in one location.
    Craig...

  • How to extends base class???

    Hi here I want to extend GoogleApiKeyStore. I am sure that this class is availabe, because when I  writing to import this class flash showing this classname in hint dialogue box. but when i make object of mykey in my document class then it shows error: The definition of base class GoogleApiKeyStore was not found.
    package code {
              import be.boulevart.google.apicore.GoogleApiKeyStore
              public class mykey extends GoogleApiKeyStore{
                        public static const API_KEY : String = "xxxxxxxxxxxxxxxxxxxxxxxx"
                        public function mykey() {
                                  // constructor code

    download and save the class to make it local.

  • How to override base class events

    I Have faced one event problam. That is i have called one AA class in to stage. AA class is extends from BB class. BB class extends from CC class.CC class extends MovieClip.  In CC class i have given CLICK event trace("this is CC class"). i am also given for AA class CLICK event ("this is AA class ").When I Click the AA in out put panel "this is CC class" ,"this is AA class ") i want to stop CC Class mouseEvents.

    Events bubble by default... It sounds like you want to look at the Event class' stopImmediatePropagation method.

  • Class override, how to create the child class and then the base class

    I started to write a program for a smart DMM, the problem is every version of the DMM the company change the communication commend.
    My idea is to write a child class for every DMM version and every SubVI of the child will override the base class SubVI.
    My problem is, i want first to create one child class and after i will see every thing is work,  start to create the base class. that way i will see if am thinking the right way.
    My question is
    How can i create a child class and then create the base class and configure the SubVi of the child class to be Override of the base class?
    I tried to search in the property of the class but i didn't see nothing.
    Thanks
    Solved!
    Go to Solution.

    This can be done and I've done it on occasion.
    You simply create the base class with the dynamic dispatch methods you require (connector panes need to be identical to thos of the child class).
    Then set the inheritance of the class to inherit from this base class.  If your method is defined as a dynamic dispatch method in the parent, you'll most likely now have some errors (unless your child method was already DD in which case you might just be OK already).
    To change the inheritance of a class, right-click the properties of the class in your project and select properties.  I believe the ineritance tree is at the lower end of the properties.  Click on the "change inheritance" (or something similar) to choose the class from which you now wish to inherit.
    Say hello to my little friend.
    RFC 2323 FHE-Compliant

  • AS3: How to create one base class for classes loaded in multiple swfs?

    Our application have 3 different modules and all use
    fscommand and ExternalInterface alot. Now the problem is we are
    combining all those modules, but they all will reside in different
    swfs. Is there any way that they extend to same base class and its
    static members have only one instance accessible by all
    three?

    Hi,
    You can achieve this via Workshop 9.2 by using the exported Ant script for your project as follows:
    -Ensure that all Jars needed to resolve com.bea.p13n.property.EntityPropertyManager (this particular class is found in weblogic92/common/p13n/lib/p13n_ejb.jar) and all referenced classes are added to the Java build path for your WebLogic EJB project (Properties->Java Build Path->Libraries)
    -Export the "Workshop Ant Script" for your WebLogic EJB project (File->Export->Workshop Ant Script); this will generate a "build.xml" Ant script under your project root directory.
    -Edit this default build script as follows: in the call to the "ejbgen" task within the "build" target, add the attribute: propertyFile="ejbgen.properties"
    -Create a file "ejbgen.properties" under the root of your WebLogic EJB project and add the following entry:
    YourSessionBeanClassName.remote.baseClass=com.bea.p13n.property.EntityPropertyManager
    -Add a "<path refid="java.classpath"/>" within the "<classpath>" for the "java" task element that calls "weblogic.ejbc" (this will ensure that the p13n classes are resolved by EJBC)
    Follow the instructions for executing the Ant build script found here: http://edocs.bea.com/workshop/docs92/ws_platform/ideuserguide/conUseCustomAntBuild.html
    For more information on the EJBGen property file support, see: http://e-docs.bea.com/wls/docs92/ejb/EJBGen_reference.html

  • How to specify a base class for Remote Interface in Workshop 9.2? -- URGENT

    Hi,
    I am trying to create a UUP EJB in WebLogic 9.2 workshop. I am using @FileGeneration to create my home & remote interfaces. And the generated remote interface is extending javax.ejb.EJBObject;I want my remote interface to extend com.bea.p13n.property.EntityPropertyManager which in turn implements javax.ejb.EJBObject. Can someone tell how i can do it in Workshop?.
    I came across Predefined Variable: remote.baseClass and as per docume
    ntation..."If specified, the value of this variable will be used as the base class for all generated remote classes. Where i should specify it?. @FileGeneration does nt have any option for it. Any help is grtly appreciated.
    Following are my code snippets:
    IMPL Class
    @FileGeneration(remoteClass = Constants.Bool.TRUE,remoteHome = Constants.Bool.TRUE, localClass = Constants.Bool.FALSE, localHome = Constants.Bool.FALSE,remoteClassName = "MyEntityPropertyManager",remoteHomeName = "MyEntityPropertyManagerHome")
    public class MyEntityPropertyManagerImpl extends GenericSessionBean implements
              SessionBean {
    //code
    }

    This question was posted to both the bea.workshop.developer.general and weblogic.developer.interest.workshop (I had replied to the later on 10/19); after seeing an identical question today on this list want to include a reference to that reply here:
    http://forums.bea.com/bea/message.jspa?messageID=600044925&tstart=0
    -Rob

  • How to expose and code the event handlers of a base class?

    I have created a class that inherits NumericUpDown. When I instantiate an object from that class, I can make it visible and have it appear on my form just like any other NUD. How can I get that instantiated object to expose the event handlers of its base
    class, the NUD in this case, so that, for example, I can tell the client what action to take when the value of the instantiated object changes?
    Thanks for your help.

    I am not sure exactly what you mean.  Are you adding your NUD controls to the Form at design time from the toolbox or adding them in code at run time?  If you are adding them to the form from the toolbox then you access the events the same way
    you would a standart NUD control.   If it is at runtime and you have a fixed amount of them you are going to add then you can declare them Class Scoped using the
    WithEvents keyword which will let you access all their events.
    Public Class Form1
    Private WithEvents Nud1 As New NUD
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Me.Controls.Add(Nud1)
    End Sub
    Private Sub Nud1_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Nud1.ValueChanged
    Me.Text = Nud1.Value.ToString
    End Sub
    End Class
    Public Class NUD
    Inherits NumericUpDown
    'Your custom code to make it work how you want...
    End Class
     If this is not what you are doing then you may need to explain a bit more and show the code you are using so we understand better.
    If you say it can`t be done then i`ll try it

  • How to call derived class to base class

    Hello everybody,
    I create a GUi application in java swing. Now i want to navigate between the screen but the timing between the screen is very slow bcoz i imported the class from package to another package. Now i want to extends one package to another package to reduce the navigation time but it saying error bcoz i cant able to call my derived class to base class. if anyone know the answer for this please answer this immediately.
    If any other method is there to optimise the navigation time please tell me
    by
    (kamal)

    Sorry, I've got major difficulties understanding your query:
    I create a GUi application in java
    ication in java swing. ok
    Now i want to navigate between
    the screenwhat? switch screens? display a different dialog?
    but the timing between the screen is very
    slowtiming? do you mean the time it takes to display a different dialog?
    bcoz i imported the class from package to
    another package.how did you come to the conclusion that that is the reason for the slowness? Did you do any profiling or is this just guess-work?

  • How to deserialize xml with structure of abitrary nested layers of base class?

    let say i want to represent arithmetic expression using xml:
    <?xml version="1.0" encoding="utf-8" ?>
    <expr>
    <add>
    <num>10</num>
    <num>20</num>
    </add>
    </expr>
    and here is my classes to represent this:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    namespace Test
    public abstract class Evaluable
    public abstract int Eval();
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Xml.Serialization;
    namespace Test
    [Serializable]
    [XmlRoot("expr")]
    public class Expr
    [XmlElement]
    public Evaluable Evaluable { get; set; }
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Xml.Serialization;
    namespace Test
    [Serializable]
    [XmlRoot("add")]
    [XmlType("add")]
    public class Add : Evaluable
    [XmlElement]
    public List<Evaluable> Elems { get; set; }
    public override int Eval()
    return Elems.Select(e => e.Eval()).Sum();
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Xml.Serialization;
    namespace Test
    [Serializable]
    [XmlRoot("num")]
    [XmlType("num")]
    public class Num : Evaluable
    [XmlText]
    public int Val { get; set; }
    public override int Eval()
    return Val;
    but it doesn't work, and it's reasonable, since Serializer doesn't know any thing about the subclass. but how to make it work?
    here is my deserialization code:
    var serializer = new XmlSerializer(typeof(Expr), new[] { typeof(Add), typeof(Num) });
    Expr expr = null;
    using (var file = new StreamReader("expr.xml"))
    expr = serializer.Deserialize(file) as Expr;

    I think what you want is to set the XmlElement attribute on the container (Elems).
    It can be done if the deserializer can be made aware of all the potential subclasses of the base class.  It's ok to put multiple XmlElement attributes on the container to let the deserializer know about the various subclasses it can deserialize.
    I don't think there's a way to tell the XmlSerializer externally about new types.  I could be wrong.  [If someone shows me how to do that, I'd sure appreciate it!]   [WORKAROUND:  A potential workaround
    is to create a class that contains all the potential children including the class itself and serialize that.  Seems a little like cheating.]
    Here is a complete example:
    [Serializable]
    public class Foo
    [XmlAttribute( "name" )]
    public string name;
    [XmlElement( "Foo", Type = typeof( Foo ) )]
    [XmlElement( "Bar", Type = typeof( Bar ) )]
    public List<Foo> children = new List<Foo>();
    public void Dump( int level )
    ShowProperties( level );
    foreach( var f in children ) {
    f.Dump( level + 1 );
    protected virtual void ShowProperties( int level )
    Console.WriteLine( "{0}{1}", new string(' ', level * 4 ), name );
    [Serializable]
    public class Bar : Foo
    public string stuff;
    protected override void ShowProperties( int level )
    base.ShowProperties( level );
    Console.WriteLine( "{0}{1}", new string(' ', level * 4 ), stuff );
    class Program
    static void Main( string[] args )
    // <Foo name="A">
    // <Bar name="B">
    // <Foo name="D" />
    // <stuff>B's Stuff</stuff>
    // </Bar>
    // <Bar name="C">
    // <stuff>C's Stuff</stuff>
    // </Bar>
    // </Foo>
    // A
    // B
    // B's Stuff
    // D
    // C
    // C's Stuff
    Foo a = new Foo() { name = "A" };
    Bar b = new Bar() { name = "B", stuff="B's Stuff" };
    Bar c = new Bar() { name = "C", stuff="C's Stuff" };
    Foo d = new Foo() { name = "D" };
    a.children.Add( b );
    a.children.Add( c );
    b.children.Add( d );
    XmlSerializer xs = new XmlSerializer( typeof( Foo ) );
    // There:
    XmlSerializerNamespaces ns = new XmlSerializerNamespaces( new[] { XmlQualifiedName.Empty } );
    StringBuilder sb = new StringBuilder();
    using( XmlWriter xw = XmlWriter.Create( sb, new XmlWriterSettings() {
    OmitXmlDeclaration = true,
    Indent = true
    xs.Serialize( xw, a, ns );
    Console.WriteLine( sb.ToString() );
    // And Back Again:
    using( StringReader sr = new StringReader( sb.ToString() ) )
    Foo root = (Foo)xs.Deserialize( sr );
    root.Dump( 0 );

  • How to reference /inherit property class in form in oracle apps

    Hi
    I had a Form which is register in the oracle apps but now i have another requirement to
    create a tab canvas put all fields of pervoius form(content form) into new tab page canvas
    now i want to know how i can reference/inherit the pervious conent form property class and object to new tab canvas
    since i didn't create with template fom .but i have property class in form module
    is it possible to inherit property classes
    Iam using form 6i,11i apps
    please help me

    It is possible.

  • BUG? Default Project Properties, Business Components: Base Classes

    Is it just me, or is there a bug in the Default Project Properties Dialog when attemptiong to specify custom classes for the Business Component Base Classes.
    I have extended EntityCache and can successfully specify it as a base class via the Project Properties dialog, but in Default Project Properties, I get an error stating: "The selected class is not a valid superclass. Either is does not implement the interface oracle.jbo.server.EntityCache or it has an invalid modifier".
    FYI: My custom library has been added to the Default Project Properties->Libraries.
    Any help?

    Does it work if you use the:
    Tools | Preferences... | Business Components > Base Classes panel instead?

  • How to use reflection to get base classes protected field

    I have one base Base classes which have protected fields and public get method to get the field.
    class Base
    protected int proField;
    public int getProField(){return proField;}
    Class Derive extends base class Base
    class Derive extends Base implements OtherInterface
    public void funtion(){};
    Now I have an instance of Derive, how can I use reflection to get the protected field inherited from Base. It seems Java Reflection only give runtime accessibility to public field and decleared field, protected-inherited field is excluded.
    Thanks
    Lei

    as the last poster said, traverse up the class hierarchy.
    ex:
    private void doSumfinToField(String fieldName throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException {
    Class clazz = getClass();
    Field field = findFieldInClass(clazz, fieldName);
    //field.doSumfin;
    private Field findFieldInClass(Class clazz, String fieldName) throws NoSuchFieldException {
    try { // to find the field in this class    
    return clazz.getDeclaredField(fieldName);
    } catch (NoSuchFieldException e) {
    // if we don't have a superclass, continue
    if (clazz.getSuperclass().equals(Object.class)) {
    throw e;
    // check in the superclass
    return findFieldInClass(clazz.getSuperclass(), fieldName);
    }

Maybe you are looking for

  • Strange behaviour of smq2 in ecc system

    Hi Gurus, From the last one month we are facing Entries got stuck in smq2 of Ecc system Error Status saying that Time Limit Exceed and some times Object was locked by the user xxxx .Here we observed is entries are not stucking for entire week at part

  • Marker Import Weirdness iMovie to DVDSP

    Hi, For Some Strange Reason, when I drag an imported video asset created with iMovie 3.0.3 that contains markers into a blank chapter index menu in DVDSP 3, the first scene always gets named "Start". I did not name this first marker "Start" in iMovie

  • Can I suspend texting and calls on my daughter's phone except for account members?

    I'd like to put my daughter's phone out of action except for other family members on our account.  That way she can't use the phone to distract herself from homework, etc. but she can still reach the family members on our account if she must due to e

  • Help on javafx coding please...

    hi, I have developed a small eclipse application. I want to integrate javafx with it. I used the eclipse view's "composite" as the frame for the javafx application i developed, say a frame has a canvas which inturn has a rectangle. Integration using

  • How to use thread only for progress bar.....

    Hello, I am working on an application which is taking time to load. Now I want to use a progress bar to tell the user of the application that It is taking time to load. How to do it... I read the Java swing tutorial and went through the example. Plea