Class Question...

I've always wrote all my code into the .fla and now I'm trying to use classes more. I have my file loading the document class. Then the document class imports two additional classes. In my constructor of the document class I am creating a new instance of both additional classes. Here is my doc class:
// start package
package com{
// import classes
import flash.display.MovieClip;
import com.CheckoutRemoting;
import com.CheckoutMain;
// start class
public class CheckoutDocClass extends MovieClip {
  // initialize classes
  public var remoting_class:CheckoutRemoting;
  public var main_class:CheckoutMain;
  //constructor
  public function CheckoutDocClass() {
   remoting_class = new CheckoutRemoting();
   main_class = new CheckoutMain();
Now inside of the other two classes I should be able to just use main_class.myFunc(); Correct? Why isn't is working? How can I interact classes? If I create a new instance to the class I want to access then I get a stack over flow error.
Inside remoting class in the constructor my code;
main_class = new CheckoutMain();
main_class.myFunc();
Thanks, in advance...
C

So if my document class imports class_a and class_b then both class_
a and class_b need to reference each other in order to use methods in each other? why doesn't it work that the class that impor
ted them can just create a reference var and you can use that? why would I be getting a stack overflow error when I'm trying to make class_b reference a function in class_a?
C

Similar Messages

  • Can anyone help me change fonts and size on my page? I don't understand the class questions?

    Can anyone help me change fonts and size on my page? I don't understand the class questions? All I want to do is change the font and size of a table or div.
    http://www.allgearinc.com/AG12SSWL-Swift.htm -One problem page

    If you want to change the fonts of the entire page then this code will do the trick:
    body {
        font-size: 16pt;
        color: silver;
         font-family: whatever, goes, here;
    If you want to change the fonts of ALL tables on a page then the code is something like this:
    table {
        font-size: 20pt;
        font-family: "Courier New", Courier, monospace;
        font-style: italic;
        font-weight: bold;
    what exactly do you want to change?  Can you be a bit specific so that Ben or Ken can give you the exact code and tell you about the short-hand method to write the code in one line.
    Have you bought a book on CSS yet?  If not, it is a good idea to get one as a reference.  Eric Meyer writes good books on CSS.

  • Inner Class Question

    My question pertains to the code at the bottom of this post.
    I don't understand why the compiler doesn't give an error for the line below. Why would it let you refer to something inside the class (in this case I'm referring to ClassWithInnerClass.MyInnerClass) unless it were static?
    ClassWithInnerClass.MyInnerClass mic = cwic.retMyInnerClass();To illustrate why I'm asking, I created 2 ints ("regularInt" and "staticInt") inside class "ClassWithInnerClass". The compiler let me set the value of "staticInt" from within main whereas it wouldn't let me do so w/ "regularInt" (which is why I commented that line out). Don't get me wrong though - I understand the reasons why the compiler behaves as it does for "regularInt" and "staticInt". I understand that a static variable can be accessed without instantiating a class (and that there's only 1 created no matter how many classes are instantiated). I also understand that, to access a non-static variable, you need to instantiate a class. My question arises only because of trying to extend that logic to MyInnerClass.
    I can already take a guess that the answer is going to be something like, "the reason it works this way is because class 'MyInnerClass' is just a declaration NOT a definiton". I guess I just want confirmation of this and, if possible, some reasoning behind this logic.
    HERE'S THE CODE...
    class CreateInnerClasses {
         public static void main (String args[]) {
              ClassWithInnerClass cwic = new ClassWithInnerClass();
              ClassWithInnerClass.MyInnerClass mic = cwic.retMyInnerClass();
              //ClassWithInnerClass.regularInt = 5;
              ClassWithInnerClass.staticInt = 10;
              mic.printIt();
    class ClassWithInnerClass {
         public int regularInt ;
         static public int staticInt;
         class MyInnerClass {
              void printIt() {
                   System.out.println("Inside ClassWithInnerClass.myInnerClass");
         MyInnerClass retMyInnerClass () {
              return new MyInnerClass();

    The line    ClassWithInnerClass.MyInnerClass mic = cwic.retMyInnerClass();is accepted because the name of the inner class is ClassWithInnerClass.MyInnerClass. This has nothing to do with accessing fields even though the syntax is similar.
    On the other hand, the line    SomeClassWithAnInnerClass.InnerClass ic = new SomeClassWithAnInnerClass.InnerClass();is not accepted because the nested class SomeClassWithAnInnerClass.InnerClass is not static: you must have an instance of the outer class available. The correct syntax for calling the constructor of the inner class would be    Outer.Inner instance = outerInstance.new Inner();In this case you could write:    ClassWithInnerClass.MyInnerClass mic =  new SomeClassWithAnInnerClass() . new InnerClass();
        // OR:
        ClassWithInnerClass.MyInnerClass mic =  cwic . new InnerClass();The Java tutorial has a pretty good explanation on nested classes:
    http://java.sun.com/docs/books/tutorial/java/javaOO/nested.html
    http://java.sun.com/docs/books/tutorial/java/javaOO/innerclasses.html

  • Some newbie POWL feeder class questions

    Hi,
    I'm just working with POWLs resp. the associated feeder class. At the moment I have two question that hopefully could be answered by someone:
    1) Is it possible to modify the UI layout of the selection criteria in a way that they will be displayed in a configurable number of columns and not just one below the other?
    2) I declared some criteria with "ls_seldef-kind = c_type_param.". The user should be able to work with wildcards for these criteria (option "CP"), but the criteria values given to the GET_OBJECTS method always do have the "EQ" option. This is not really useful for e.g. description fields. How can I change this?
    Many thanks in advance for any help.

    I also hope I can know how to do .
    Pleae tell me if you have solved the problem .
    Best regards ,

  • Importing Java Class Question

    Hello,
    Sorry for such a newbie question and such a long post, I did remember how to do this before but now I can't for the life of me remember. Anyhow, I have a simple question about importing custom-made java classes, from another directory in the windows operating system. I have the classpath set, and also I realize that because the two files below are in the same directory theres no need for an import statement as Java will look for the class in the same directory.
    But I would like to know how the import statement is suppose to look to import a custom made java class from another directory, (assuming of course that I set the correct classpath)
    here's the java class location:
    c:\school\csc365\narcus.java
    //narcus.java
    import java.io.*;
    class narcus implements Comparable
    String firstName = "firstName";
    String lastName = "lastName";
         public narcus()
         firstName = firstName;
         lastName = lastName;
         public narcus(String f)
         firstName = f;
         lastName = lastName;
         public narcus(String f, String l)
         firstName = f;
         lastName = l;
    public String getFirst()
    return "first..";
         public int compareTo(Object e)
         return 1;
    Here's the location of the driver program thats suppose to use the narcus.java class
    c:\school\csc365\test.java
    //test.java
    //import statement? maybe import "c:\\school\\csc365\\*"; ?
    import java.io.*;
    class test
    public static void main(String[] args)
         narcus jim = new narcus();
         System.out.println("omg\n");
         System.out.println(jim.getFirst());
    And also, here is my classpath:
    PATH=c:\school\csc365\;c:\school\
    The classpath also points to the jdk libraries and few other directories but I didn't write that above, as it probably isn't relevant.
    I've tried the following import statements.
    import "c:\\school\csc365\\narcus.java";
    import "narcus.java";
    import "c:\\school\\csc365\\*";
    But I keep getting an error that says:
    test.java:1 <identifier> expected
    Any help is appreciated!

    Hi Folks,
    I am new to this forum, heard that interesting discussions always happens on this forum so immediately registered,don't want to miss any oppurtunity to participate in discussions.
    I have pretty much basic question regarding compiling and exceuting files in different packages.I have the following directory structure
    C:\Projects\WDPROEast\Development\CommonService\Code\Java from where java files stored in different packages as follows:
    com\wdpro\commerce\common\crm\dae\nautilus\adapter directory has java files in com.wdpro.commerce.coomon.crm.dae.nautilus.adapter package.
    com\wdpro\commerce\common\dae\exception has java files with package named com.wdpro.commerce.common.dae.exception.
    com\wdpro\commerce\common\dls\exception has java files with corresponding package name.
    com\wdpro\commerce\common\dto has java files under proper package name.
    com\wdpro\commerce\common\exception has java files with appropriate package name.
    com\wdpro\commerce\common\util has java files with package name. I am starting at Java Directory,want to compile and run file named a.java in com.wdpro.commerce.coomon.crm.dae.nautilus.adapter package with having all other java files on classpath as follows
    so I issued command for compilation as follows C:\Projects\WDPROEast\Development\CommonService\Code\Java>javac com/wdpro/commerce/common/crm/dae/nautilus/ada
    pter/a.java com/wdpro/commerce/common/crm/dae/nautilus/adapter/NautilusServiceUtility.java com/wdp
    ro/commerce/common/crm/dae/nautilus/adapter/URLReader.java com/wdpro/commerce/common/crm/dae/nautilus/adapter/
    b.java com/wdpro/commerce/common/dae/exception/*.java com/wdpro/commerce/common/dto/*.java
    com/wdpro/commerce/common/exception/*.java com/wdpro/commerce/common/util/*.java com/wdpro/commerce/common/dl
    s/exception/*.java It compiled greatly but when I issue command to run a.class file as
    C:\Projects\WDPROEast\Development\CommonService\Code\Java>java com/wdpro/commerce/common/crm/dae/nautilus/adap
    ter/UtilityAccesssit's giving following exception
    Exception in thread "main" java.lang.NoClassDefFoundError: com/wdpro/commerce/common/crm/dae/nautilus/adapter/
    UtilityAccesssbut when I run a.java with the following command
    C:\Projects\WDPROEast\Development\CommonService\Code\Java>java com/wdpro/commerce/common/crm/dae/nautilus/adap
    ter/UtilityAccess com/wdpro/commerce/common/crm/dae/nautilus/adapter/NautilusServiceUtility.java com/wdpro/com
    merce/common/crm/dae/nautilus/adapter/URLReader.java com/wdpro/commerce/common/crm/dae/nautilus/adapter/Nautil
    usAccessUtility.java com/wdpro/commerce/common/dae/exception/*.java com/wdpro/commerce/common/dto/*.java com/w
    dpro/commerce/common/exception/*.java com/wdpro/commerce/common/util/*.java com/wdpro/commerce/common/dls/exce
    ption/*.javaSo my question do I need to add all required java files to path when required class files are under different packages?is it manadatory.
    I hope you understand my question,pass me any comments you may have.
    Thanks alot,
    Anu

  • The arrays class question

    consider the code below
    int[] list = {2, 4, 7, 10};
    java.util.Arrays.fill(list, 7);
    java.util.Arrarys.fill(list, 1, 3, 8);
    System.out.print(java,util.Arrays.equals(list, list));i understand line 2, it gonna fill 7 into the array,so the output would be Line 2: list is {7, 7, 7, 7}
    my question is line 3, how come the output would be {7, 8, 8,7} what does 1 and 3 represent in a arrary?
    the line 4 output would be {7, 8,8,7} again why?
    Thank you guys whoever is gonna take to respond me questions

    zerogpm wrote:
    but which 2 lists were comparing ? since i have list list with the same name1) You're not comparing lists, you're comparing arrays.
    2) You're comparing a single array with itself.
    3) Objects, including arrays, do not have names. Classes, variables, and methods have names. Objects do not.

  • Where is the getString() implementation for RS and Object class question

    Dear all,
    I had these two questions ringing since a long time.
    1)ResultSet is an interface.
    In my jdbc code I have generally written rs.getString() and rs.getInt etc.. without giving a second thought as to where exactly is this getter implemented !
    I have RTF API .. without too much help.
    Could some one kindly explain Where is the implementation of the getString method ?
    2) Could you please tell why the Wait() Notify() and NotifyAll methods have been implemented in the Object class ? What was the need to define em in the Object class ?
    Thanks in advance for your time spent on this.
    Rgds

    Sarvananda wrote:
    In the MySQL driver for example it's implemented in com.mysql.jdbc.ResultSet Right. Now it makes sense to me. Every single db that gives me a driver will have their specific implementation for the interface methods of ResultSet.
    >
    why do you need that?
    ..Thats a design decision
    One of my friends asked me this and I was caught unawares. Any ideas on what factors could have made this design decision ?
    Rgds
    >
    In the MySQL driver for example it's implemented in com.mysql.jdbc.ResultSet Right. Now it makes sense to me. Every single db that gives me a driver will have their specific implementation for the interface methods of ResultSet.
    >
    why do you need that?
    ..Thats a design decision
    One of my friends asked me this and I was caught unawares. Any ideas on what factors could have made this design decision ?
    A desire to not have to couple your code to a particular database and JDBC driver. It's a classic example of the abstract factory pattern

  • Inner classes question

    Hi guys,
    I have a question to ask - when i'm writing an inner class and i want to create a new instance from it, the Eclipse forces me to use an instance of the containing class to call new.
    Is it how it's done or am i doing something wrong?
    public class A
        // Some code here
        public class B
             //Some code here
    }Trying to create an instance:
    A a = new A();
    A.B b = a.new B();

    What you have defined is "non-static" inner class.A "non-static" can only be instantiated only if we create an object of outer class.True.
    >
    There are two ways to create "inner" class object,
    1)The way you have written the codeTrue.
    2)
        public class A
    {    // Some code here    
    public void createInner()
    classB b=new ClassB();
    public classB   
    //Some code here   
    That code won't compile. Even if you corrected it so that it did compile, it doesn't really help in the OP's situation. Did you read the advice of Saish and Jos about why class 'B' probably shouldn't be public, anyway?

  • Parent Class question

    I have a panel class with a slider on it .
    pseudocode:
    public class MyJSlider extends JPanel{
    private JSlider myjslider;
    private Color mycolor;
    public Color getColor(){return mycolor;}
    the action taken by the JSlider is to set mycolor to a new Color(r,g,b);
    My question, is there away to call the class that istantiated teh MyJSlider objects paint method from the
    JSlider action performed
    Something like
    slider_B.addChangeListener(
                   new ChangeListener()
                        public void stateChanged(ChangeEvent e)
         mycolor = new Color(R,G,slider_B.getValue());
    // super.paint() ????????

    If it's an inner class like that, it has access to the outer class's fields and final instance variables.
    You can access those methods implicitly.
    But you typically don't call paint() directly, you call repaint(), which issues a call to the GUI to repaint itself. (Although maybe it's different in Swing, I don't know.)
    When you post code please wrap it in &#91;code] &#91;/code] tags so it's easy to read.

  • JAXB class question

    does anyone know which jar file has the javax.xml.XMLConstants class? I'm getting an error while going through some examples for JAXB and I am almost positive that my classpath is messed up or not pointing to the right jars.

    Good job mate. That's the way!
    And you came back and let us know we needn't waste precious time answering a solved question. That's just exellent. Thanks.
    :)

  • Tutorial Q&E : Implementing Nested Classes, Question 2

    //1.3
    Taken from http://java.sun.com/docs/books/tutorial/java/javaOO/QandE/nested-answers.html
    import java.util.*;
    public class Problem {
    public static void main(String[] args) {
    Timer timer = new Timer();
    timer.schedule(new TimerTask() {
    public void run() {
    System.out.println("Exiting.");
    timer.cancel();
    5000);
    System.out.println("In 5 seconds this application will exit. ");
    Question 2: The program Problem.java (above) doesn't compile. What do you need to do to make it compile? Why?
    Answer 2: Add final in front of the declaration of the timer variable. A nested class declared within a method has access to any final, local variables in scope.
    Could somebody please elaborate on this answer for me? I don't really feel it gives enough information for me to understand fully the "why?" part.
    Thanks
    Mark

    Hi,
    the problem is that the instace of the nested class is still existing after the execution of the method has been finished. But how should it have access to a variable which doesn't exists anymore?
    The only way to solve this problem is to declare the variable as final. Because then the value of the variable is known when the instance of the nested class is created an can be copied. Then at each place in the nested class where the variable is used, the copy is used instead. This is only valid because the value of the variable cannot be changed after the creation of the nested class' instance.
    Andre

  • GUI class question

    Hi guys I use the NetBeans 6.0 and i build a project which has 2 Source packages on is my number game and the other I called GUI. In the GUI source package I drew a diagram which I want to use as my GUI to my number game but I don't know how to connect them. Now my question is this is it possible to connect them since they are in different packages? And my second queston is where should I code the action listenrs and where the event handler couse I am really new to gUI and that is my first one. Btw does net beans 6 provide some form of facility to join them both without much code? Thanks in advance!

    1.I would say that using packages in this case is bad, but i wont since everyone else here thinks its always good. I would just use plain .java/.class files in the same directory so that they have free access to each other and the other files.
    2. To use actions listener you first make your main class implement ActionListener, then addActionListener(this) to all your components that catch events, then use public void actionPerformed(ActionEvent e) to handle any events.

  • Really Basic OO Class Question...

    heres the complete code for my applet...As i understand it this should make a "Car" class then should be generating a "car" object with the constructors marked...then i just use the g.drawstring to output this...but i get a nasty error message. Its something really simple, but its completely vexed me...thanks in advance.
    import java.applet.*;
    import java.awt.*;
    public class Traffclass extends Applet {
         public void init() {
         public class Car {
              public int length, width;
              public Color carColor;
              public Car() {  //constructor?
                   length = 7;
                   width = 5;
                   carColor = new Color(200,10,60);
         private Car car = null;
         public void run() {
              car = new Car();
              repaint();
         public class Trafficlight {
              public boolean greenlight = true;
         public void paint(Graphics g) {
              g.drawString(""+car.length, 50, 60 );
         //     g.fillRect(car);
    }

    As stated the problem is solved now, but heres the error message in question...
    Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException
            at Traffclass.paint(Traffclass.java:39)
            at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)
            at sun.awt.RepaintArea.paint(RepaintArea.java:224)
            at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:254)
            at java.awt.Component.dispatchEventImpl(Component.java:4031)
            at java.awt.Container.dispatchEventImpl(Container.java:2024)
            at java.awt.Component.dispatchEvent(Component.java:3803)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
            at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
            at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    grantedIt wasn't a compiler message (what i am used to) so it threw me a bit.

  • Startup class question

    Hi,
    I haven't used startup classes but see a need for one now, to add a JMS
    receiver of messages. We're not on WL 6.0 yet and that doesn't appear to be
    an option. Anyway, my question relates to threading. Are startup classes
    like EJB's
    in that the server will instantiate > 1 if needed?
    Thanks,
    Bill

    Bill,
    Your threading needs depend on how you are using JMS. If you are using
    asynchronous delivery then the thread is provided by the JMS runtime when it
    makes the callback on to your listener.
    If you hope to use synchronous delivery then you'll need a thread to receive
    messages. A startup class could probably start a thread (or a pool of them)
    and use them to handle synchronous messages. However I would strongly
    recommend against this.
    You might investigate Message Driven EJBs. I suspect that they will be a
    better fit for your needs than a startup class.
    Regards,
    Adam
    "Bill Ennis" <[email protected]> wrote in message
    news:[email protected]..
    Hi,
    So if there is only one instance what happens if multiple requests come in
    at the same time?
    BTW, the startup class I am working on will be for a JMS client.
    I suppose you could thread the startup class?
    Where can I find detailed info on Startup classes beyonnd what have found
    in the developers manual?
    Thanks alot,
    Bill
    "Bill Ennis" <[email protected]> wrote in message
    news:3a69eaad$[email protected]..
    Hi,
    I haven't used startup classes but see a need for one now, to add a JMS
    receiver of messages. We're not on WL 6.0 yet and that doesn't appear tobe
    an option. Anyway, my question relates to threading. Are startup classes
    like EJB's
    in that the server will instantiate > 1 if needed?
    Thanks,
    Bill

  • Class question for Class

    I'm a dumb novice and have an assingment for school...
    I have to write a program that stores, manipulates and print student info
    I have to write 2 classes Student and Admisions. Student will have the fields I need and Admissions will manipulate the data.
    Student must have the following fields - Name , Address, Date (as Classes) and ID (as a string variable identifing the student)
    My question is if Student is supposed to be a class and also it's fields are to be classes, how do I write those classes(fields) under the class Student (are they supposed to be methods of the class student, is that what they mean?) Or do I just write other classes within the class Student ?
    Can someone show me an example how Name should be written within Student ? (Name is to have fields FirstName and LastName)
    Help!!!!!

    My question is if Student is supposed to be a class
    and also it's fields are to be classes, how do I
    write those classes(fields) under the class Student
    public class Student {
        private String name;
        private Date date;
        etc.
    (are they supposed to be methods of the class
    student, is that what they mean?)No. The fields will be objects (well references to objects, actually). You might have get/set methods to access those fields, but the fields themselves are just variables of the appropriate type.
    Or do I just write
    other classes within the class Student ?You don't define those classes inside Student. Student will use String, Date, and possibly other classes defined elsewhere--either in the core API, or by you. (Looks like just cor API here, but I didn't look that closely.)

  • Basic Class Question

    I'm a beginner at Java, stuck on one question...
    I'm supposed write a method, named isAlpha, that accepts a character parameter and returns true if the character is an uppercase or lowercase letter. Otherwise, it returns false.
    What's the proper way to write that?

    1- Write a class.
    2- Write the method named isAlpha with proper signature in this class.
    3- In this method body, you should use something like [url http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Character.html#isLetter(char)]Character.isLetter() to do the test.
    If you have any problem(s), post the code you did.
    And allways paste your code between code tags exactly like this:
    &#91;code&#93;
    your code
    &#91;/code&#93;
    Regards

Maybe you are looking for

  • Why can't I import anything or contact customer service?

    It really bothers me that I can't seem to find a way to directly contact customer service.  Let me know if I'm missing something here.  Otherwise I may be cancelling my subscription.  Also, I can't seem to import anything into Adobe Story and all I c

  • Odd Messages While Repairing Permissions

    Had that annoying spinning beach ball today, so I used software update and then repaired permissions after. Never had a message like this before in all my mac years: Warning: SUID file "System/Library/CoreServices/Finder.app/Contents/Resources/OwnerG

  • Error regarding update program

    hi i am facing an  error i.e Error when generating the update program Can any body give the solution for this question thanks gurkiran

  • Update error code -48

    i keep getting error code , the update downloads all the way then before it updates phone i get an error code and it says check your network setting or try again later .... has anyone else got this and does anyone know how to fix it .... also i have

  • DEP problems after install

    Hi all, after downloading and installing Itunes(with QT ), it refuses to open, and i get the message that DEP has prevented it from opening. I have done all i could find on the net : disabling DEP through AlwaysOn/Off/optin etc.. disabling it in the