Question about class design

Hi:
I am trying to design a web game using JSP, servlets, etc. I have some ideas about the classes I have to create and how to split the work among them. I.e:
class Player
- contains the player data like name, nickname, age, etc...
- have a static method getPlayerById(id) which calls load(id) method.
- load method calls DBPlayer.load(id)
class DBPlayer
- uses Database objetct to get the connetion.
- static load(id) method executes a "select" query and gets the data from database and create a new Player instance sending the data by constructor
class Database
- get the connetion data and connect to database
I could have a JSP page named showPlayerInfo.jsp which gets the player_id by request. The page calls Player.getPlayerById(player_id) ans shows the data in html format.
would this be correct?
If I would like to show the list of players of a game. Could I have a GamePlayerList servlet which uses Database object, get an array of Player objects which can be shown using a JSP page or the GamePlayerList servlet? should the "retrieving player list data" be in DBPlayer instead?
Thanks in advance for your advices

There is no right answer. What you have is a model object (Player) a data access object (DBPlayer, normally this would be named something like PlayerDao) and a utilities class to connect to the database (Database or you could call it DatabaseUtil or DatabaseHelper, whatever) Another option for your Database class is to instead call it AbstractDao, have PlayerDao extend it, and in AbstractDao place methods like connect(), rollback() and commit(). One reason you want these methods in either a helper class or a superclass is so you can place your try-catch blocks there and not have to worry about cluttering up the rest of your code.
In terms of an overall architecture, you should take a look at the MVC pattern. Your Player and PlayerDao objects are your model. Your servlets are your controllers. And your JSP's are your view. It's a fairly standard way of organizing your application.
You have several options for how to load new players. The first would be as you have done, to place a static factory method in Player. Another option would be to create a separate PlayerFactory object that can create new or return existing or delete existing players. The Servlet would call the PlayerFactory which would delegate to the PlayerDao returning a Player object. In this design, your Servlet would either invoke the PlayerFactory or PlayerDao to save, etc. If you instead want a bit more encapsulation at the price of separation of concerns, you can have the Player object itself have methods like save(), delete(), etc.
There is no right answer. Designs involve trade-offs and to a large extent personal (or corporate or academic) preference.
- Saish

Similar Messages

  • Question about singleton design

    Hi all
    i have a question about singleton design. as i understood it correctly, this pattern garantees us a single instance of a class at any time. in a environment of concurrent access(multiple user access at the same time) , does this single instance put a constraint on concurrency(singleton == synchronization)? i have developed a service object that reads in properties and constructs some other objects. the reason i made it singleton is that i only want this service object to load the properties once. and when it is called to create other objects, it always has one copy of the propertis. making this service singleton, will it limit the threads to access it and construct other objects? thanks for your help.

    If there's no write access to the HashMap, then
    you're thread safe.You were probably typing at the same time as the previous post, which explicitly says there IS write access to the HashMap.
    I don't know what it is, but people seem to have this magical view of concepts. Singleton is just what it is. It doesn't have a magical aura that causes other things to behave differently. A singleton is just Java code that can have thread safety problems just like any other Java code. So to the OP: forget about the fact that this is a singleton. That's irrelevant. Ask if a method needs to be synchronized.
    (And yes, a method that tests if a variable is null and assigns an object to it if it isn't null does need to be synchronized if it's going to have multiple threads accessing it.)

  • Question about Classes

    I have a question concerning classes. In my main program I have a list box. I have gotten the index (using getSelectedIdex method) from the list box to use with my array. What I want to do is match the list box index with the array index to get the correct price from the array. I can do this in the main class, but was wondering if I could just do the calculations in another class. Can I pass the index of the list box to another class in order to do the calculations? I figure I could put the array in the other class too and match them. In order to do this, what would the class data member look like for the list box index that I have passed? I have tried and get errors, so was wondering if there was another way I can do this
    Thanks so much for your help

    I have a question concerning classes. In my main
    program I have a list box. I have gotten the index
    (using getSelectedIdex method) from the list box to
    use with my array. What I want to do is match the list
    box index with the array index to get the correct
    price from the array. I can do this in the main
    class, but was wondering if I could just do the
    calculations in another class. Yes you can, but why? The only reason to do this from a design point of view would be to seperate the logic into another class so that;-
    1. you might reuse the class in the future.
    2. the main method class has become large and cumbersome making it difficult to find all the methods.
    3. There are a variety of methods and subroutines in your application so that the logic in your program will be improved in terms of readability and future maintenance by creating seperate class files.
    4. 'whatever' other reasons (?)
    Can I pass the index of
    the list box to another class in order to do the
    calculations? I figure I could put the array in the
    other class too and match them. In order to do this,
    what would the class data member look like for the
    list box index that I have passed? I have tried and
    get errors, so was wondering if there was another way
    I can do this
    Sooner or later the would-be java programmer has to change or make the transition from using java as a procedural language and develop programs along more OOP lines. The answer to your question is "yes of course you can do this" and simply from the point of view of learning how to pass an argument to a different class, then yeah, learn how to do this.
    >
    Thanks so much for your help
    Gazoontite xxx

  • A few questions about the design of the scheme

    Hello, all!
    I want ask some question about design of the scheme.
    1) If i store info about user (for example: /Smith/Bob - /phone values{+1 964 258 46 52}), i can request information by user (input parameters: /Smith/Bob - /phone, output:+1 964 258 46 52), but if i want get username by phone i must generate in store second string /19642584652 values{Smith Bob}. But I must duplicate any string - very prodigally. Are existing some work aruond?
    2) if i want store some string with different minor key i put: ( /Smith/Bob - /phone, /Smith/Bob - /image, /Smith/Bob - /adress), but i already get duplicate date. Are existing any compressin major`s key? If yes - how it works
    3) Are existing in Oracle NoSQL something like secondary index? If exist - how it works?
    4) If i want get value by major key, im use get function(for example /Smith/Bob - /phone). How works searching algoritm? What mathematical basis of search?

    >
    So, some a few clarifying questions.
    1) Request comes from the client(to cluster). It identifies the major key. And any rep group understand: contained in it is this line?
    2) If contains - they use b-tree map to find the right key (as local index in Oracle DB).
    Is it correct?
    >
    No. Please read the doc and the other forum threads. They explain this issue.
    >
    Can i use any different algoritm to search, different indexes(function based) for example (on step 2)?
    >
    No.
    when the expected release of this option?Oracle employees cannot talk about future release dates and contents.
    What algorithm used to compress the prefix of the key. And how it work`s.If you're interested in the implementation details you can read the BDB JE documentation on key prefixing and the BDB JE source code. See com.sleepycat.je.DatabaseConfig.setKeyPrefixing.
    http://docs.oracle.com/cd/E17277_02/html/index.html
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Questions about classes

    Hi,
    I finally upgraded from Flash 5 to CS3 - big difference :-)
    Reading the first half of an ActionScript 3 book left me
    quite confused about classes - what they are, how you handle
    multiple classes, how you use one class from within another etc.
    Are there any simple-speak tutorials out there that explain
    more about how to use classes?
    Specifically:
    I am trying to use classes to run multiple animations at the
    same time, i.e. using randomized movement for multiple objects on
    my stage.
    First issue is: If I do what I learnt in the book and simply
    create one .as file and have that be the document class, how can I
    prevent it from being run before all the elements on the stage have
    been loaded through a slow network connection?
    Second issue: I'd rather have "dormant" classes sitting
    around and call them once my stage is ready, but I have no idea how
    to handle multiple classes. I played with it for a while and then
    gave up and put my code into a frame, but that caused further
    issues. Again, any tutorials out there or any other advice you can
    give me? I am trying to start some class code at a certain time and
    use it to attach a Frame Event listener to a Sprite that I create
    inside the class.
    It looks easy in the book, but when I try to do my own stuff,
    it just won't do it...
    The book assumes (so far) that you want to run your code
    immediately once your movie starts, but I don't want that...
    Thanks!

    Yes, I realized later that _root etc. is actually as1 code
    from my days of Flash 5 :-)
    All I need is to know how to access a movieclip on the stage
    that was placed using the IDE from within a class, and how to
    access a class and call its methods from within another, and I can
    teach myself the rest...
    So, if I place something with the IDE, doesn't it show up in
    the display list? I should be able to control those elements, too,
    shouldn't I?
    Or do I have to use Actions rather than classes for those
    elements?
    I probably read 5 different articles/ebooks on the topic of
    classes and OOP in AS3 already, and none gave me the answer I
    needed.
    But I will have a look at the site you mentioned.
    Thanks!

  • Question about Wireless Design and Controller

    Hi Everyone,
    Although I am not new to Cisco, I have somewhat limited experience with Wireless in general.  I was hoping to get your help with the following:
    We currently have a total of 8 1130AG, 4 on each floor.  They were configured a few years ago, and now we are looking to update the design a bit.  Each AP has its own SSID, and just provide internet access.  Looking at the configuration, I noticed that they are not configured to use proper channels, just random channels (9, 10, 11, instead of 1, 6, 11, etc.).  I noticed that when I roam between one AP to another, I lose about 4-8 pings before I re-establish connectivity again.
    Here are my questions:
    1.  Do I need a controller in order to use just one SSID for the whole setup instead of the 8 seprate ones we currently have?
    2.  Will the controller helps in providing seamless transition when a client roams between AP's?
    3.  Is it normal to loose connectivity roaming around?
    4.  Can I reconfigure the current setup to use just one SSID and provide better transition between AP without the use of a controller?
    5.  Which controller would you recommend?
    We don't have a need to anything fancy ,I am aware that I can enable multiple SSID, VLAN's, etc.  Just trying to keep it as simple as possible, yet reliable.
    Your input is appreciate.
    Thanks

    1.  With 8 AP's only, a WLC would be nice-to-have but not necessary. You can configure WLSE and it will do some limited functions.
    2.  This depends on the signal strengths, wireless coverage and configuration.  If you enable WLSE, for instance, and you have no wireless black spots, then roaming should be no issues.
    3.  See #2.
    4.  You can configure multiple SSID (up to 16 are broadcasted) but if one AP doesn't have the SSID you use for roaming, the association will drop when the client tries to join that particular AP.  It's like mobile phone towers.  If your carrier is not in the area, you sure won't be able to use your mobile phone in that area.
    5.  For 8 1130 APs, I'd recommend the smallest of the lot:  2106 with either 6, 12 or 25 AP licenses.  I'd recommend you the 25 AP licenses.  If your finances allow you something bigger, then consider either the 4402 (25 AP licenses) or the 5508.
    Cisco 2100 Series Wireless LAN Controllers
    http://www.cisco.com/en/US/prod/collateral/wireless/ps6302/ps8322/ps7206/ps7221/product_data_sheet0900aecd805aaab9.html
    Cisco 4400 Series Wireless LAN Controllers
    http://www.cisco.com/en/US/prod/collateral/wireless/ps6302/ps8322/ps6307/product_data_sheet0900aecd802570b0_ps6366_Products_Data_Sheet.html
    Cisco 5500 Series Wireless Controllers Data Sheet
    http://www.cisco.com/en/US/prod/collateral/wireless/ps6302/ps8322/ps10315/data_sheet_c78-521631.html

  • Question about classes/Directories

    I've been using Java to learn programming for a while now, so this question may not belong here. It seems to be more of a general question, however, not code related.
    How does java work with directories? Say I had a project, and for some reason I wanted different java class files to be in different directories. How does java handle this? Say for example:
    1.) Main class is in C:/blahblah/Project/ and the other classes were in C:/blahblah/Project/src/?
    2.) Main class is in C:/blahblah/Project/src/ and the other classes were in C:/blahblah/Project/?
    3.) Main class is in C:/blahblah/Project/src/ and other classes were in C:/blahblah/Project/bin/?
    I know these may be kind of stupid examples, but I just wanted to know how such things worked for future reference. Thanks a ton!

    {color:#3D2B1F}It sounds like you need to learn about packages: [http://java.sun.com/docs/books/tutorial/java/package/index.html] {color}

  • Question about app design - database + session object in JSP

    hi all
    i am studying this application built mostly with servlets and JSPs, and there are several questions i want to ask your guys' opinions about it.
    first of all, i noticed that the application hits database to get/save data very frequently. from one page to another it would save data collected from user to the DB, and retrieve data from DB to display on the next page. it does this a lot. would this decrease the overall performance of the application, i mean a DB hit requires network traffic overhead, wouldn't it be better if all data collected from user are stored in a session object temporarily, and all the data that are displayed on those pages retrieved at the start time? and do one save process in the end. it uses Oracle DB if it makes any difference. should we try to avoid db hit as much as possible?
    my next question is that is it good approach to keep information in session object? even if there is a lot of data to keep?
    another question is the db connection. in a pooled environment - weblogic server, we would use JNDI in the code to get connection from the pool, we use it and close it. when we close a connection with close() method, what really happens? does this connection gets return to the pool or it is being destroyed completely.
    i know this is a lot to ask, i appreciate your help very much. looking forward to seeing some feedback.

    No, I don't have tables of values. I have a java 1.5 enumeration, like for instance:
    public enum VelocityConvention {
       RELATIVISTIC,
       REDSHIFT;
    }and a class Velocity that contains a convention and a value like so:
    public class Velocity {
       public VelocityConvention getConvention() {...}
       public double getValue() {...}
       public void set(VelocityConvention conv, double value) {...}
    }When I persist the Velocity class to the database, I want a field called convention that holds the appropriate value of the enumeration. That much is done how I explained before.
    I want to have a selectOneMenu for setting the convention. Via trial and error, I found that MyFaces wasn't able to automatically convert from a string back to a proper VelocityConvention enum constant. It can, of course, convert from the enum to a string because it just calls toString(). But I need both directions for any UIInput element I use, be it a selectOne, or just a straight inputText.

  • Hey guys, I have a question about Web Design

    I have been trying to learn webdesign for a few months now, and so far, I am still learning HTML and some CSS. At the moment, my experience is still very thin, I am struggling with things, and I only know how to create simple, static pages. For example I still don't know how to produce "clean code". Or how one determines just how "clean" the code he has produced really is.
    I was wondering if someone could answer a few questions I have:
    I am still not sure how I will know when I am competent enough to work in Web Design... What are the best signs that an individual is good enough?
    I was also wondering what programming language I need to know to do the following:
    Create a WORKING Site Search. One like the search bar in the top corner of this page that will return search results from your website... Do I need to know how to program PHP? I've heard that you do need PHP to do this? The same goes for creating e-mail forms, and other forms like this. Do I need PHP for this?
    Another thing is CMS systems like Wordpress and Joomla. What is the reason for using these as opposed to just designing a website's pages in Dreamweaver, and then uploading them via FTP to your web server?
    And finally, can someone explain to me why CSS is groped like this when it is coded? Why has the Div ID "OuterWrapper" been styled multiple times?
    For example: #outerWrapper #feature {
    #outerWrapper #subcontentWrapper {
    #outerWrapper #subcontentWrapper #rightColumn {
    ^ Couldnt the designer simply have styled "~OuterWrapper" once and left it at that?
    Please see below:
    #outerWrapper #feature {
        height: 225px;
        width: 880px;
        margin-left: 0px;
        margin-bottom: 5px;
        background-image: url(images/feature.jpg);
        background-repeat: no-repeat;
        background-position: center top;
    #outerWrapper #subcontentWrapper {
        padding-right: 15px;
        padding-left: 15px;
        clear: both;
        padding-top: 20px;
        background-color: #FFF;
        padding-bottom: 40px;
        border-top-width: 4px;
        border-right-width: 4px;
        border-left-width: 4px;
        border-top-style: solid;
        border-right-style: solid;
        border-left-style: solid;
        border-top-color: #F90;
        border-right-color: #F90;
        border-left-color: #F90;
        background-image: url(images/footer-fade.jpg);
        background-repeat: repeat-x;
        background-position: bottom;
        height: 100%;
    #outerWrapper #subcontentWrapper #rightColumn {
        float: right;
        width: 220px;
        background-color: #DBE7FB;
        border: 1px solid #DCDFE4;
        margin-bottom: 15px;
    Also, regarding Javascript: How exactly does one become proficient enough to learn scripting for the thousands of little widgets, and navigation bars, and other functions that Javascript can do out there?
    I know a lot of these questions are strange and may be hard to answer, but I am really hoping some of you guys can provide some helpful advice/direction for me to improve with code. I studied as a Print Graphic Designer, and now it's really hurting me in this economy trying to find a job due to the fact that I lack full competency in Web Design... and the longer it takes me to get better at this, the slimmer my chances become at finding work!
    I really need help on this, so I would be extremely grateful for detailed and informative answers. Perhaps some links to very good video tutorials on learning how to effectively design webpages - Common things like Javascripted navigation bars, image slideshows, how to design working site search forms and contact forms, and how to use Wordpress. I ask this because there are so many terrbile tutorial videos out there (I know from experience) and it is next to impossible for myself, a beginner, to tell the good ones from the bad.
    Thankyou guys.

    CMS's like  WordPress, Joomla! & Drupal are popular open source (PHP & MySql) frameworks.  They contain all the backend PHP code needed to create a dynamic web site that contains capability for advanced functions:  site search, on-line editing, shopping carts, member log-in sites, blogs with comments, scripted contact forms, and so much more...
    The allure of Open Source frameworks is that they save developers time and money.  Instead of building everything from scratch (which can take months), an experienced developer can usually install WordPress on the client's server and be up & running in a few hours without customizations, or in a couple of weeks with customizations.   A firm understanding of PHP, how to set up a server-side database, backing up MySql, CSS theming, and HTML code are required skills to work with these frameworks.  WordPress is probably the easiest to set-up; Drupal is for more experienced coders.
    I am still not sure how I will know when I am competent enough to work in Web Design... What are the best signs that an individual is good enough?
    You're ready when you can look at code and understand what it means/does. Being able to problem solve, identify mistakes and fix them on your own is a must have skill. 
    Code Tutorials - http://w3schools.com/
    How to Develop with CSS?
    http://phrogz.net/css/HowToDevelopWithCSS.html
    CSS positioning in 10 Steps
    http://www.barelyfitz.com/screencast/html-training/css/positioning/
    Code Validation Tools
    CSS - http://jigsaw.w3.org/css-validator/
    HTML - http://validator.w3.org/
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/
    http://twitter.com/altweb

  • MenuStrip and a Question about Class win32_product

    Hello,
    I have a bunch of questions I'm hoping someone can answer.
    1.) I would like to add a menu separator and a checkbox under a dropdownitem for a toolstripmenuitem
         Similar to what you would see in ISE or Internet Explorer.
         I then need to pass the state of this checkbox into a function
    2.) I have created a file menu item and would like to create a separator and then add a list of MRU items restricted to only displaying the five previous opened config files.
    3.) Can someone propose an alternative to using the get-wmiobject win32_Product class
    The below function I wrote to get the Product Version for some VMware products, but it is slow making the initial connection.   Looking at the Uninstall registry key won't work because it doesn't contain the product version.
    I know it looks odd.  I could not find a good way to detect which servers the products were installed on.   So instead I pass the servers that would host these products based on our build standards.
    Function get-version($vcenter,$sso,$vum,$credentials) {
    Write-Host "Getting Version information. This usually takes awhile. Be Patient " -NoNewline
    $Roles = "VMware vCenter Server","VMware vCenter Inventory Service","VMware vSphere Web Client","vCenter Single Sign On","VMware vSphere Update Manager","vSphere Syslog Collector"
    $i = 0
    $output = @()
    $Servers = "$vcenter","$vcenter","$vcenter","$sso","$vum","$vum"
    $ErrorActionPreference = 'silentlycontinue'
    ForEach ($input in $Servers) {
    IF ($psversiontable.psversion.major -ge 3) { Write-Progress -activity "Getting Version Information - Takes awhile. Be Patient." -status $Roles[$i] -PercentComplete (($i / $roles.Length) * 100) } Else { ticker }
    $object = New-Object PSObject
    $object | Add-Member NoteProperty "Role" $Roles[$i]
    $object | Add-Member NoteProperty "Hostname" $Servers[$i]
    $object | Add-Member NoteProperty "IP Address" (Get-WmiObject Win32_networkadapterconfiguration -ComputerName $Servers[$i] -Credential $credentials | ? {$_.IPEnabled} | Select-Object IPaddress).IPaddress[0]
    $object | Add-Member NoteProperty "Version" (Get-WmiObject win32_Product -ComputerName $Servers[$i] -Credential $credentials | Where-Object {$_.Name -eq $Roles[$i]}).version
    $output += $object
    $i++
    IF ($PSVersionTable.PSVersion.Major -ge 3) { Write-Progress -activity "Completed Getting Version Information" -Completed } Else { write-host "...Done!" -NoNewline }
    write-host ""
    $output
    } # End Function get-Version
    Walter

    Your code doesn't relay make much sense.
    What is this line for:
    $Servers = "$vcenter","$vcenter","$vcenter","$sso","$vum","$vum"
    Funtion get-version($vcenter,$sso,$vum,$credentials
    Why are you using credentials.  Only and admin can call remotely?
    Are you trying to get all of these roles? Aren't these produces?
    $Roles  = "VMware vCenter Server","VMware vCenter Inventory Service","VMware vSphere Web Client","vCenter Single Sign On","VMware
    vSphere Update Manager","vSphere Syslog Collector"
    ¯\_(ツ)_/¯

  • A question about class and interface? please help me!

    the following is program:
    interface A{
    public class B implements A{
    public static void main(String [] args){
    A a = new B();
    System.out.println(a.toString());
    }i want to ask a question, the method toString() is not belong to interface A, why a can call method toString()? the interface call the method that isn't belong to, why? please help me...

    because a.toString() call the method toString() of class Object because B implements A, but extends Object and in the class Object there is a method toString(). infact if you override the method toString() in class B, a.toString() call toString() in class B.
    try this:
    interface A {}
    public class B implements A
      public String toString()
        return "B";
      public static void main(String [] args)
        A a = new B();
        System.out.println(a.toString());
      }by gino

  • General question about classes

    Hi every one,
    I have an application that works but i'll like to optimize it, regarding about speed and system ressources. For resume and represent diagrammatically the application I wrote, there is a first frame (the main menu) with severals buttons. When I push a button I show a new frame with a query resultset displayed inside.
    Theses second frames are all very similars, just a few things are differents between one and another (sql string of the query, and some controls may be visible or not).
    So there are many solutions to write it :
    1- I can make a class representing this second frame and each time I push a button from the main menu, I create a new Object with this class and when I quit this frame I do a "dispose" of it.
    2 - (the solution I got) I create an Object with the model of this second frame once and for all, and when I push a button I set visible this frame and call a method to change some parameters, when I quit the frame I set it hide.
    I think second option is not to bad and the first one is very heavy, but If I created a class B that extends my second frame A (that contains the main code for displaying results) and each time I push a button from the main menu I created an object from B type, is it a good idea ??
    Hope you understand my problem, and hope anyone will give me an idea...

    Hi rainek and ty for your attention,
    Yes you understood right :
    my app creates Frame 1 with buttons and show it, and I create on the background a raw version of Frame 2 shown, and with changed parameters when button is pressed.
    But I don't not extend Frame 2 with a SubFrame 2, I just wonder if it would be a good thing to create subframe 2 and instance it each time I push a button from Frame 1, instead to use the same Frame 2 raw version (storing it in a file config indeed) from the background. I wondered, if when I instance for the second time a subframe 2 it was speeder because an object subframe 2 as already been instancied before.
    You know my problem was also that when I created Frame 2 in the background before create Frame 1, it gave my troubles with Frame 1 display (cf. my topic :http://forums.java.sun.com/thread.jsp?forum=57&thread=231897), so now I create this frame 2 raw version the first time I push any button, but of course there is a litte big longer time answer this first time. (I thank too, to create Frame 2 raw version in a thread to avoid frame 1 display troubles)
    Hope I'm clear and you understand me, for resume in a generic problem, I wonder know if when i have this config :
    Frame 2,
    Subframe2 that extends Frame 2
    if i do
    Subframe2 myframe_a = new Subframe2 (<parameters_a>) and
    Subframe2 myframe_b = new Subframe2 (<parameters_b>)
    myframe_b is created more quickly because myframe_a as been instancied before
    Any way ty very much for your answer rainek !!

  • A question about classes

    Hi all,
    This is a general question, hope it is in the right forum.
    Lets say I have a main document class, declared in the property window. I can easily create new instances of a movieclip in my library by simply creating them in my document class and then using addchild to put them on the stage. Now lets say I have a separate external class that I am importing into my document class. How do I create instances of the movieclip from my library in that external class. All I want my document class to do is import classes and let them do the work so to speak. I know I can create the movieclip instance in the document class and pass it as a parameter when I import the external class but what if I want to create it there?
    I hope that makes sense, I am sure it is very simple but I am tired of having massive long document classes!
    Thanks in advance.

    Hi, sorry I know you answered this but I have just done a quick test file to try the instantiation,
    the movieclip is not showing, the movieclip is linked out with a class of mcSquare.
    //document class
    package {
        import flash.display.MovieClip;
        import external;
        public class document extends MovieClip
            public var externalClass:external = new external();
            public function document()
    //external
    package {
        import flash.display.*;
        import flash.utils.getDefinitionByName;
        public class external extends MovieClip
            public var square_mc1:mcSquare = new mcSquare();
            /*public var square:Class = getDefinitionByName("mcSquare") as Class;
            public var square_mc1:Object = new square();*/
            public function external()
                //square_mc1.x = 43.5;
                //addChild(DisplayObject(square_mc1));
                addChild(square_mc1);
    The commented code is just attempts after googling.
    Again apologies for reposting, I thought that had cracked it
    Thanks

  • Question about classes hyargie

    hello, my english is very bad so, but i think you can understand my problem:
    i'm creating a game, in Java using jEdit and have 3 classes: one application with the static main, called Memory. That one creates another one, called Game. It's a canvas. Till here no problem.
    But when I try to create from the the class Game a class Kaart, he'll give an error:
    the code looks like this
    public class Game extends Canvas
    private Kaart kaartje;
         public Game( int dinges )
    kaartje = new Kaart( 27, 16 );
    add( Kaartje ); //<---------------------
    this is the error:
    C:\Jan\proggen\Game.java:34: add(java.awt.PopupMenu) in java.awt.Component cannot be applied to (Kaart)
              add( kaartje );
    ^
    1 error
    anyone know about this..?
    thanks jan

    What are you trying to do?
    The message says that you need to pass a PopupMenu to add (you are calling add on the Canvas). So, apparently, kaartje is NOT a PopupMenu (or subclass). What does Kaart look like?

  • Question about class icons

    So I learned today that a child class's icon is created by merging the child's icon as displayed in the class properties with the parent's icon as it appears in the parent's properties (the child's icon being the top image in the merge and the parent's the bottom). This isn't obvious from normal operation since the default icons are the same size and thus the child's icon perfectly overlaps and thus displaces the parent's. However, I drew an icon that extends a little bit beyond the bottom of the border of where the default icon normally goes (in the parent icon). This change was propogated to my numerous child classes, and now the icon is cut off on like 100 vis and it looks dumb.
    Technically, this doesn't change anything about my program. Since I never actually place the child vi's on a block diagram, I never see the icons except when editing the child vis or when they are calling each other (one child vi calls the other, which is rare). The code is only brought into the main vi via dynamic dispatch. That said, I'd love to know if there is a way to override the default behavior of how labview builds these vi icons. It's driving the pedant in me crazy.

    Hi majoris
    could you post an example of this so I can look at it more closely?
    Joe Daily
    National Instruments
    Applications Engineer
    may the G be with you ....

Maybe you are looking for

  • Problems Installing trial Lightroom on laptop w/Vista

    Hello, I just purchased a new laptop and I downloaded the trial version of Lightroom.  I saved the exe file to my desktop.  I am now attempting to extract it.  I am trying to extract to c:Program Files, but receive the following message: " A problem

  • Office Files Will Not Open If Located On A Network Folder

    I have installed Office 2010 Professional on a Windows XP SP3 machine. This workstation is a domain member on a SBS 2003 network. My previous version of Office was 2003. When I attempt to open an Excel file that resides in the MyDocuments folder (whi

  • Problem saving fdf file with a file extenstion

    When I download a file with a 'FDF' extension, the file contains the name of the PDF template to be used. Preview or ADOBE is supposed to get the PDF and populate it with the data in the FDF file. This works fine with Firefox and IE under Windows, bu

  • Debug version & Release version on same machine?

    Hi all I'm new to sdk. I've few questions.. I've indesign cs3 realease version in my system. Now I need to install indesign cs3 debug version in the same. Will it make any problem?? or can I install it in different user in the same? will the debug ve

  • How can i see the containts of Raw datatype

    hi friends, I have an application in which some raw datatype is given i wanted to see through sql or plsql ,is any conversion function is there in oracle to see it,if no then how to see it . raj