Create a class

I have been having problems with creating a class with actionscript project in flashbuilder.
Here is a simple class but how do I use this with the skeleton code here?
How do I arrange these files to make this work?
Here I instatiate the class
var p1 : Person2 = new Person( 1, "Xavi", "Beumala", "address1");
Here is the Skeleton code
package
      import flash.display.Sprite;
      public class atest2 extends Sprite
            public function atest2()
public class Person2 {
          private var _id : int;
          public var name : String;
          public var surname : String
          public var street : String;
          public function Person2( id : int, name : String = "", surname:String = "", streetString="") {
               this._id = id;
               this.name = name;
               this.surname = surname;
               this.street = street;
          public function get id() : int {
               return _id;

Perhaps I am a bit confused because of the way you display your code here.  Are you creating the second class within the same file as the first?  If so that second class will only be accessable from within the first one and not to any code outside the primary class.  I.E. each class needs to be in their own seperate files.  If the Person class is in a different package you will also need to import it into the calling class.  (I assume you already know this but am just making sure.)
Here is your person class slightly modified so that you can retrieve each vars data using a function and keep them private.  I would also suggest setting the data on each field using a setter function so that you can scrub the incomming data but that's up to you.
package {
public class Person{
  private var _ID:int;
  private var _name:String = "";
  private var _surname:String = "";
  private var _street:String = "";
  public function Person(id:int, name:String, surname:String, street:String){
       this._ID = id;
       this._name = name;
       this._surname = surname;
       this._street = street;
  public function get id():int{
   return this._ID;
  public function get name():String{
   return this._name;
  public function get surname():String{
   return this._surname;
  public function get street():String{
   return this._street;
And to test it you can trace out the function call or (my preference) import Alert and ObjectUtil to pop up the object data in an alert box.  These are part of the Flex MX libraries though so you may not want to use them if your writing pure actionscript code.  Of course you would want to run this code out of another class.
// import the libraries needed to use Alert boxes and convert the object to a string.  If your Person class was in another package you would want
// to remember to import it also.
import mx.controls.Alert;
import mx.utils.ObjectUtil;
//Create your Person variable to use locally.
private var myPerson:Person;
//A function to build a person and test what is returned by showing the details in an alert box.
public function testPerson():void{
    this.myPerson = new Person(1,"John", "Doe", "1234 Anywhere Street");
    Alert.show(this.myPerson.id + " " + this.myPerson.name  + " " + this.myPerson.surname + " " + this.myPerson.street);
Hope that helps.  Let me know if that does not make sense or if perhaps I missunderstood your question.
-Joe

Similar Messages

  • How to create proxy class for a Siebel WS which has many Workflows in it?

    Hi,
    I am facing a strange problem. I have a Web Service for which there are many workflows associated with this. When I generate WSDL for this Web Service and later on generate proxy class in .NET, it creates mutilple classes for each workflow. From UI, I can invoke a perticular method for the class for which I am interested in. But when I am building the same in JDeveloper, using Web Service proxy, I get only one class and I am not interested in invoking method in this class but interested in some other class for which the proxy was not generated. Is there some way to generate multiple classes in JDeveloper proxy?
    Thanks,
    Sudha.

    I have figured this out. Actually Generate proxy creates package and it includes all the class in it. Now i am able to invoke web service method call.

  • How to create a class using java script..

    Hi all,
    Iam new to java script and I tried out the following program but its not working..I basically created a class just like a java prog' but Iam not getting any output or error.Iam attaching the code below.
    If I created one function inside the script and create one object its working fine but what should I do when I have a lot of function??so I created a class and put all the function and created an object but its not working..
    Do let me know what changes should I do..Iam attaching the code which I had written. or give me an example of how to create a class with couple of functions using JAVASCRIPT
    Thanks
    Avis_su
    <html>
    <head><title>JSP Page</title></head>
    <body>
    <SCRIPT language = "JavaScript">
    <!--
    //Created classes
    class book
    var title: String;
    var author:String;
    function author()
    doucument.write("Author is " +this.author);
    function tile()
    doucument.write("Title is " +this.title);
    function printall()
    var counter = 0;
    function author();
    function title();
    var chapters = Array[String];
    for(chapter in this chapters)
    counter++;
    document.write("Chapter" counter" :"+this.chapters[chapter]+"<br>");
    var thisbook = new book()
    thisbook.author = "Sivagami";
    thisbook.title = "MS in CS giude";
    thisbook.chapters = new Array[10];
    thisbook[0] = "Prepare to Excell in all ";
    thisbook[1] = "Learn to be happy";
    thisbook[2] = "Learn to be healthy mentally emotionally physically";
    thisbook[3] = "Siva and Subbu along with kidssssss will be successful in future";
    thisbook.printall();
    //-->
    </script>
    </body>
    </html>

    Run this program to get your answer:
    public class AnswerToYourPost {
    public static void main(String args[]) {
    System.out.println("TRUE/FALSE: This question
    ion belongs on a Java forum.\n"
    + "ANSWER: " + ("Javascript" == "Java"));
    }Since when do we compare objects for equality using operator == ?

  • How to create Development Class in SAP R/3 4.7c and Netweaver?

    I follow some old notes on ABAP Development Class but I could not create a new Development Class. i.e. Stuck in creatinf a type group.  Please give some details on how to create a development class.  Thanks.
    see the following stepa:
    (A) Procedure for creating  a type group:
    /nse80
    1. Object Navigator> select Development class>(Enter your development class
       yFTGxxDEV
    2. Double click on development class object types.
    3. Type Group: zPTAxx1.
    4. Click on the Create button at the bottom (4th one from the left).
    5. Enter short text: zPTAxx1 type group.
    6. Save>Enter your development class> click on diskette button to save the type group
    7. Select Source Code tab and enter the following:
    "An example type-pool statement containing types and constants
    type-pool zxx1.  "zxx1 is a type pool. It is also known as a type group
    types: zxx1_dollars(16)    type p decimals 2,
                 zxx1_lira(16)          type p decimals 0.
    constants:
           zxx1_warning_threshold type i value 5000,
           zxx1_amalgamation_date like sy-datum value '19970305'.
    8. Select  Type Group from menubar
               a) Check
               b) Save
               c) Activate
    9. Click the back button or F3 to exit.
    10, Show  your type group to your teacher.
    11. Go to ABAP editor and enter the following program:
    "Calculations on date
    report zxx_0914.
    type-pools zxx1.                   "contains zxx1_amalgamation_date
    data:    d1              like sy-datum,
                d2              like d1,
                num_days type p.
    d1  = d2 = sy-datum.
    subtract 1 from d1.
    write / d1.                              "yesterday's date
    d2+06 = '01'                         " first day of current months
    subtract 1 from d2.
    write / d2.                           " last day of previous month
    num_days = sy-datum - zxx1_amalgamation_date.
    write / num_days.                " number of days since amalgamation
    11. Double click zxx1 from the type-pool statement to see the type group.
    12. Follow lab1 procedure and run your program
    (B) Run an ABAP program using field symbol ( i.e. pointer)
    report zxx_lab6.
    data  f1(3)  value   'ABC'.          "Step 1 Define a variable
    field-symbols <f>.                     "Step 2 Define a pointer variable ( it only stores address)
    assign f1 to <f>.                        "Step3 Initialize the pointer variable with an address
    write <f>.                                    "Step4 Now you can use <f> in place of f1
    write / f1.                                      " (same as write f1 )  
    <f> = 'xyz'.                                   " Assign a new value to f1
    write <f>.
    write / f1.

    This is not the way to create a new development class.
    Follow this steps to create a development class:
    http://sap.mis.cmich.edu/abap4/knowbase/Create-Dev-Class.pdf
    Regards,
    Naimesh Patel

  • Error Occured While Creating message class 8II In SapNote 1486147

    Dear All
    I applied SapNote 1486147 but at the time of creating message class 8II
    It shows error like this
    Object MSAG 8II is in reserved name range for sap partner
    Any body help on this.
    Edited by: chandrap on Feb 24, 2011 2:08 PM

    Hi Yasir,
    remove the jaxb.jar from the WEB_INF/lib and move
    them to your SUNWappserv/lib/endorsed - dir, together
    with the following jars:
    dom.jar jaxb-api.jar jaxb-impl.jar jaxb-libs.jar
    jaxb-xjc.jar namespace.jar relaxngDatatype.jar
    r xalan.jar
    xercesImpl.jar xsdlib.jar
    (restart the deploytool if used)
    This should work,
    Bas van OudenaardeHi Bas
    Thank you for the very useful tip but I don't seem to have a SUNWappserv/lib/endorsed - directory inside my .war archive , could you please advise on this issue

  • Error While Creating Asset Class

    Hi Friends,
    I am getting the following error in development client while creating the asset class AB2200.
    "Screen Layout 200 was not created"  but the same was created.
    Please guide me how to handle this error and the reason for me getting this error message while creating asset class.
    Your quick response would be highly solicited.
    Thanks and Regards,
    C.R.Srinath

    Hi Srinath
    There are 2 things.. Create the screen layout and Define the screen layout... (IMG> AA > Master Data> Screen Layout for asset classes)
    Complete both the steps here and specify the same sccreen layout in your asset class
    Regards
    Ajay M

  • Error while creating model classes, operation aborted in NWDS

    Hi All,
    When i select Adaptive rfc 2 model  and then search for the RFC,  when i select RFC and click on next i get an error while importing :
    Error while creating model classes, operation aborted.
    It is working fine in visual composer and i have activated function module, RFC but getting same error. It is also working in web service navigator also.
    Can any one help me out??
    Regards,
    Pradeep kumar
    Edited by: pradeep_546 on Feb 17, 2011 9:35 PM
    Edited by: pradeep_546 on Feb 17, 2011 9:36 PM
    Edited by: pradeep_546 on Feb 17, 2011 9:37 PM

    Hai guys thanks for reply
    Tushar,
    I am using NWDS 7.2, ce7.2 server, ECC 6.0.
    Amit,
    I have tested the JCO destinations they are working fine and i created a new pair of JCO destinations but unable to import the Adaptive RFC2 Model gives same error but Adaptive webservices are working fine in my NWDS7.2
    Deepak,
    I am unable to create model in other projects also.
    I have sufficient amount of memory in my drive.
    I have imported the DC to other NWDS but it gives same error.
    Thanks for all,
    Regards,
    Pradeep Kumar G
    Edited by: pradeep_546 on Feb 18, 2011 3:05 PM

  • Error in creating a class.

    Hi Experts,
    While creating a class for the created interface..
    I am getting following error.
    "IT_MARA" is not an internal table - the "OCCURS n" specification is missing.
    Please correct the error.
    method Y_IF_INTERFACE~SELECT_METHOD .
    SELECT * FROM MARA INTO TABLE IT_MARA
             WHERE MATNR BETWEEN P_MATNR_LOW AND P_MATNR_HIGH.
    endmethod.
    Regards
    nani

    The code is like this
    tables: mara.
    *provide mara table
    DATA: zMARA TYPE MARA.
    *provide data objects
    DATA: OBJ TYPE REF TO Y_CL_INTERFACE,
          IT_MARA TYPE standard table of MARA with header line,
          WA_MARA TYPE MARA.
    *provide selection screen
    SELECT-OPTIONS: S_MATNR FOR MARA-MATNR.
    *provide object
    START-OF-SELECTION.
      CREATE OBJECT OBJ.
    *call the method.
      CALL METHOD OBJ->Y_IF_INTERFACE~SELECT_METHOD
        EXPORTING
          P_MATNR_LOW  = S_MATNR-LOW
          P_MATNR_HIGH = S_MATNR-HIGH
        IMPORTING
          IT_MARA      = IT_MARA
          WA_MARA      = WA_MARA.
    *display the data
      LOOP AT IT_MARA INTO WA_MARA.
        WRITE:/ WA_MARA-MATNR,
                WA_MARA-ERSDA,
                WA_MARA-ERNAM,
                WA_MARA-MATKL,
                WA_MARA-MEINS.
      ENDLOOP.
    Regards
    Nani

  • Message while creating a class method

    Hi all,
    I have created a class as local object. When i try to modify that class the following message is displayed.
    "You are not authorized to make changes (authorization object S_DEVELOP)"

    Click [here|http://help.sap.com/saphelp_40b/helpdata/EN/27/174b6e5733d1118b3f0060b03ca329/content.htm] to know about s_develop authorization object.
    and Please ask your BASIS Team or Security Admin to get the Change Authorization to your User
    ID/Profile.

  • Help Needed in Creating Java Class and Java Stored Procedures

    Hi,
    Can anyone tell how can i create Java Class, Java Source and Java Resource in Oracle Database.
    I have seen the Documents. But i couldn't able to understand it correctly.
    I will be helpful when i get some Examples for creating a Java Class, Java Source and Stored Procedures with Java with details.
    Is that possible to Create a Java class in the oracle Database itself ?.
    Where are the files located for the existing Java Class ?..
    Help Needed Please.
    Thanks,
    Murali.v

    Hi Murali,
    Heres a thread which discussed uploading java source file instead of runnable code on to the database, which might be helpful :
    Configure deployment to a database to upload the java file instead of class
    The files for the java class you created in JDev project is located in the myworks folder in jdev, eg, <jdev_home>\jdev\mywork\Application1\Project1\src\project1
    Hope this helps,
    Sunil..

  • Creating A Class For A ComboBox Component

    I have a comboBox component that I would like to create a
    class for. But I am not sure if I could. I see how you can use the
    Linkage window to assign an AS 2.0 Class to a movie clip, but I do
    not see that same option for a comboBox component.
    It has all of the basic combo box things that I would like to
    seperate out into it's own class if possible
    If anyone could give me a few tips, or better yet, point me
    to a few good tutorials, that would be great.
    Thanks
    Mathias

    I have a comboBox component that I would like to create a
    class for. But I am not sure if I could. I see how you can use the
    Linkage window to assign an AS 2.0 Class to a movie clip, but I do
    not see that same option for a comboBox component.
    It has all of the basic combo box things that I would like to
    seperate out into it's own class if possible
    If anyone could give me a few tips, or better yet, point me
    to a few good tutorials, that would be great.
    Thanks
    Mathias

  • Dynamically create a class based on database tables

    I am trying to build a database and tables on the fly, and save to the harddisk(done). Then I need to create a class using the info from the tables on the fly.
    For example,
    I built a database BANK, and a table Customer,
    Customer
    ID
    Phoneno
    Address
    Could I create a class named CUSTOMER (table name)
    dynamically, and have ID, PHONENO, ADDRESS,as the attributes of the class?
    Could anyone help or show the direction?
    Cheers.

    You could use a HashMap, and use the String keys "Customer", "ID", etc, and if you have primitive values like an int, you just wrap it inside Integer or any of the other wrapper classes, because HashMap only works with objects.
    Then you can use an ArrayList to hold all the records (one record is one HashMap as described above).

  • Fastest way to create child class from parent?

    As the subject states, what do you folks find is fastest when creating child classes directly from the parent? (esp. when the parent is in a lvlib) I thought I'd post up and ask because the fastest way I've found to get working takes a few steps.
    Any suggestions ae appreciatized!
    -pat

    Thanks for the quick response Ben!
    Yea, I apologize, in your response I realize my OP was more than vague haha (it hapens when you get used to your own way of doing things I guess huh)- I'm trying to create a child from a parent so that it has all of the methods that the parent has.
    In order to do so I currently have to open and close LV a few times during my current process so that vi's in memory dont get mixed up- Currently I save a copy of the parent class in a sub dir of where it is saved, close out of LV, open the new 'copy of parent.lvclass', save as>>rename 'child class.lvclass', close LV, and open up the project to 'add file', then right click>>properties>>inheritance.
    Is this the only way to do this?
    Thanks again!
    -pat
    p.s. I'm tempted to steal your cell phone sig, hope you dont mind haha good stuff!

  • Can I create private class in ABAP?

    Hi all,
    Can I create private class in ABAP? Please reply me its interview question.
    Thanks ,
    Vishal
    Moderator message : Interview type questions not allowed, read Forum Rules Of Engagement before posting.  Thread locked.
    Edited by: Vinod Kumar on Jan 16, 2012 12:20 PM

    Vishal , please read the rules of this forum.

  • How to create a class pool

    Hi how to create a class pool when i tried to create it has shown the following error
    <b>Unable to change program from or to type K
    Message no. DS165
    Diagnosis
    You tried to assign a type to a program that cannot be assigned in the program attributes, but can only be set internally by one of the tools in the ABAP Workbench.
    The following program types are reserved:
    F Reserved for Function Groups
    Function groups are adminstered by the Function Builder, and you can only create or delete them using the Function Builder or the Object Navigator (Transaction SE80).
    K Reserved for Class Defintions
    Class definitions are administered in the Class Builder. You can only create or delete them using the Clas Builder or the Object Navigator.
    J Reserved for Interface Definitions
    Interface definitions are administered in the Clas Builder. You can only create or delete them using the class Builder or the Object Navigator.</b>

    Hi,
    Though you get a popup for different options for different program types like Class pools, function groups etc in SE 38 Program attributes, you can't create them from Se38 transaction.
    They have to be created from different places.
    Class Pools are nothing but creating CLASSes and INTERFACEs using the T Code SE24.
    This needs little Java/OOPs concepts to create and use them.
    Hope this helps.
    Regards,
    Anji

  • Creating a class library in VS2013 that can be referenced by a VB6 application and newer applications

    I need to create a class library in VS2013 that can be referenced by a VB6 application and newer applications. I heard something about
    COM Interop but have no idea where to start. I am assuming I would develop a class library in VS2013 and then package the assembly for COM. Any good sample projects on this out there?

    Hello,
    >> Any good sample projects on this out there?
    Not suer if you are using C# as the develop language, if it is, i think you would find a lot of articles about this topic with your favorite search engine, here are some related links:
    COM Interop Part 1: C# Client Tutorial
    COM Interop Part 2: C# Server Tutorial
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for