New object (with string)

Hello,
I have a function which is getting as an input a string variable and needs to create an new object that has the same name as the input string.
How can I do it?
thanks

Hello,
I have a function which is getting as an input a
string variable and needs to create an new object
that has the same name as the input string.
How can I do it?For me the main question is why you want to do this? What difference is the name of the as long as you can find the object. I wonder if there is a better way of implementing what it is you want to do.
For instance, would tying your object to the string via HashMap be a better solution?
Do you have any sample code or pseudocode showing what you want to do?
Message was edited by:
petes1234

Similar Messages

  • New Object() with no reference

    I'm creating an object and don't want it to waste space after being created. It's a thread spawner and just want it to create the threads and wait auntil they finish.
    my idea was to write
    new Object();but don't know if it's a nice idea. This way there will be no reference. Maybe it's better:
    Object object = new Objeect();
    object = null;I'd rather use the first one. Any opinion? Thanks!

    malcolmmc wrote:Under no circumstances will the garbage collector recycle an active thread or the stackframes associated with it. That would crash the thread. So it doesn't matter if you retain a reference to it or not, except that if you want to wait for all the threads to finish then the respectable approach is to call join on all of them, for which you obviously need your own reference to the thread.Think about the spawner as a subprogram that creates threads, not as a thread itself. It would be INSIDE the spawner where threads would be created and joins would be executed. Once we would get out of the spawner, threads would be finished, so there would be no reference to them at all.
    I realized it was a bad idea to make it this way, so I'll launch it as a private method.

  • Why not use "new" operator  with strings

    why we not use new when declaring a String .because in java String are treated as objects. we use new operator for creating an object in java .
    and same problem wiht array when we declare array as well as initialize .here we are alse not using new for array
    why

    Strings aren't just treated as objects, Strings are Objects.
    As for why not using new for Strings, you can, if you want.:
    String str = "this is a string";
    and
    String str = new String("this is a string");
    do the same thing (nitty-gritty low level details about literals aside). Use whatever you like, but isn't it simpler not to type new String(...) since you still need to type the actual string?
    As for arrays, you can use new:
    int[] ints = new int[10];
    or
    int[] ints = { 0, 1, 2, 3, ..., 9 };
    But the difference here is you are creating an empty array in the first one, the second creates and fills the array with the specified values. But which to you often depends on what you are doing.

  • Creating Objects with String name

    How can i create an object, but just having the name as String?
    Like, instead of creating like JInternalFrame obj = new MyInternalFrame(), do it like JInternalFrame obj = createObject("MyInternalFrame") ( i just gave createObject as example, ignore it)...
    Does anyone knows how to do it? Because i have several windows, and by clicking, i dont want to be with a lot of if clauses checking each one to se wich one is the ritgh class to call...
    Tks,
    Bruno

    You need the Class class in package java.lang, specifically class (static) method forName() and instance method newInstance():
    JInternalFrame obj =
        (JInternalFrame) Class.forName("MyInternalFrame").newInstance();

  • Create MIME Object with String

    Hello,
    I have a string value containing a MIME message. What I want to do now is to parse the date out of this message. My idea was to create a MIME object type first and then using some getter methods to parse the DATE of the MIME header.
    So basically the question is how I create a MIME object out of the string. Any idea on this?
    Thank you very much.

    Hi again Florian,
    Maybe a glance at those pages could help you :
    http://jigsaw.w3.org/Doc/Programmer/api/index.html?org/w3c/www/mime/MimeParser.html
    http://docs.sun.com/source/816-6028-10/asd3j.htm#1047313
    http://james.apache.org/mime4j/apidocs/index.html?org/apache/james/mime4j/parser/MimeStreamParser.html
    Not sure those classes could be easily used and imported into XI/PI, but if you can avoid writing your own parser, that'd be great
    Chris

  • 2d object with multiple primitive types

    I've done some research and tried a few options and finally decided that I want a two dimensional object to handle several different types of primitives. My current plan is to just put them all in a 2d String array, then parse them to whatever type I need when I need to do calculations with the integers or doubles. But I also wanted to ask if there was already an object type that could handle this for me without the parsing. I need more than one value per key, so I don't think that a map will work (although I've admittedly never used one before and may not fully understand how it operates).
    My other thought was to just make a new object with several different arrays of different types and to use the indices to relate one to another. This would at least clean up my code and take out some repetitive parsing steps, but it seems a very roundabout way to handle the situation.
    Any suggestions?
    Should I just use a 2d String array?
    Should I make a new object?
    Does an object already exist for this application?
    Also, if I muddied any of this up by using improper word choice, please let me know so that I can try to clarify.

    Fair enough. I'm working on analyzing some data for a videogame. I want to find the optimal set of items on a character by trying every combination and analyzing it's effectiveness. In order to do this, I want to store about a dozen different stats (some integers, some doubles) for about 30 different items along with the item's name, then use some nested loops to evaluate each combination. There is no 'perfect answer', so I need to perform this process multiple times under varying circumstances. I figure this would be easiest to accomplish if every stat is associated with an x value and every item is associated with a y value because I could then use the index of a for loop to process the information.
    In short, I have several different data types that I want to store in a manner that allows me to load and retrieve all the information using loops. Each set of data has the exact same format (String, int, int, double, double, double...).
    I know it doesn't sound like an important project, but I like to take any opportunity I can to practice my programming. I think it's an important skill in today's world and I'm always trying to improve.

  • SCCM Client entry in SCCM console for new VM with same hostname

    HI,
    I have Hyper V server with several VM's running with server OS. Recently I have stopped 2 VM's with OS windows server 2008 & 2012 & recreated new VM's with same hostnames & IP addresses. Problem is I am unable to install SCCM client on New VM
    as old enrty lies in SCCM consle with client status Active. I tried to uninstall the client from console, But its showing "can not ping".
    So is it ok to simply delete this entry from console so new entry will come in front?

    Hi,
    You can delete the object in the SCCM Admin Console,you can also install the client manually and then they will register again creating a new object with the same name.
    Regards,
    Jörgen
    -- My System Center blog ccmexec.com -- Twitter
    @ccmexec

  • RegisterObjet (for a new object) return a clone form a different object

    Hello,
    when I register a new object with registerObject method, I sometimes receive an object from the same class but a clone from an other objet.
    How is that possible ?
    thanks
    Annabelle

    Hello Annabelle,
    When you call registerObject(someObject), TopLink will perform an existence check to see if the object passed in is new or existing, then return a working copy of the object passed in. It the object was previously registered, it will pass the same working copy back, otherwise, it will clone the object passed in to use as the working copy.
    Are you using sequencing?
    If registerObject is passing back the same working copy for multiple new objects, there might be a problem with the object's primary key - which is used for identity.
    Try printing off what is in the identity maps using the session.getIdentityMapAccessor().initializeIdentityMaps() api on the UnitOfWork. This should show all the objects in the cache as well as the primary keys they are cached under, which might help to identify the problem object and how it got in the cache.
    Best Regards,
    Chris

  • Issues when adding new objects

    A few questions regarding changes in Toplink from 2.5 to the current version.
    Say I had object A which contains a collection of Bs and a collection of Cs.
    Now when I want to save A and Bs and Cs to the database as an insert.
    Is the following code correct ?
    A a = new A();
    A cloneA = (A)uow.registerObject(a);
    Vector bCollectionClone = uow.registerAllObjects(new Vector(bCollection));
    Vector cCollectionClone = uow.registerAllObjects(new Vector(cCollection));
    uow.commit();
    This seemed to work in 2.5. According to the API java docs this should work even today.
    The reason I am asking is all of these -A, B and C are new objects. Should they be registered with registerNewObject();
    Is it incorrect to register a new object with cloning ?

    I forgot to add a couple of lines of code to that snippet
    A a = new A();
    A cloneA = (A)uow.registerObject(a);
    Vector bCollectionClone = uow.registerAllObjects(new Vector(bCollection));
    Vector cCollectionClone = uow.registerAllObjects(new Vector(cCollection));
    cloneA.setBCollection(bCollectionClone);
    cloneA.setCCollection(cCollectionClone());
    uow.commit();
    A few questions regarding changes in Toplink from 2.5
    to the current version.
    Say I had object A which contains a collection of Bs
    and a collection of Cs.
    Now when I want to save A and Bs and Cs to the
    database as an insert.
    Is the following code correct ?
    A a = new A();
    A cloneA = (A)uow.registerObject(a);
    Vector bCollectionClone = uow.registerAllObjects(new
    Vector(bCollection));
    Vector cCollectionClone = uow.registerAllObjects(new
    Vector(cCollection));
    uow.commit();
    This seemed to work in 2.5. According to the API java
    docs this should work even today.
    The reason I am asking is all of these -A, B and C
    are new objects. Should they be registered with
    registerNewObject();
    Is it incorrect to register a new object with cloning

  • New Object Creation vs. Field Setters

    I know this is massively context dependent, but is there some rule of thumb to follow when it comes to deciding between
    i) Making an class's fields final and creating a new object with new field values when needed, and
    ii) Leaving a class's fields mutable and using setter methods to alter the field.
    I tend toward option one, because not only do I tend to shy away from setters, but also because it helps prevent me from accidentally maintaining an old reference. However, purely from a performance standpoint, which option should you assume is better? How many object's of X size do I have to be making per unit of time before the performance benefits of "final" are lost?
    Thanks!

    I've been wishing for a while that Java would add a language level concept of immutability. Either an immutable keyword or an annotation. The compiler would bitch if you declared a class immutable and each of its fields was not final and either a primitive or a reference to an immutable class. Or perhaps it could simply check that there was no assignment to any field.
    It would be handy for me as a user of a class to know that it's immutable, for things like copying and thread-safety. It might or might not allow for runtime optimizations too.
    As for whether to make a given class immutable, like others say--it depends on the semantics of the class. If it's intended to represent something dynamic--e.g. a clock, or a piece on a board whose position changes with time, or the state of a network interface including packet sent and received--then it will make your code clunky and nonintuitive if you have to create a new object everytime the state of the thing you're modeling changes. But if it's something that changes less frequently, or that represents a fairly static entity or "value", then make it immutable.
    I do agree with duffymo: Better that an object comes out of construction in a valid and useful state. So even if the object is mutable, pass field values to the c'tor or set them to reasonable defaults inside the c'tor (e.g., "now", etc.)

  • All the references should Point to New Object.

    Hi..
    I have a problem with manipulating the references of an Object.
    Let me explain my problem,assume i have an object and that object is referred by some 5 references...
    Eg:
    class Box
    int x;
    Box b = new Box(5);
    Box a = b;
    Box c = b;
    Box d = b; etc.
    if i say d.x = 65; all the references x value is changed to 65
    Nuv I want to replace this Object with another new object with one of the references.
    b = new Box(10);
    here only b points to the new Object and all the references point to the same object,but I need all the references to point to this new object..at a stroke.Huv do i do it..(Note I need generic code..)this number of references can be more or less..,needless to say i want to work with references of an Object.Does any one know how to achieve it?
    Any help is appreciated
    Regards
    Siva

    You r rite.
    In fact I was tryinnn to do the same thing when I said
    d.x = 65;
    but assume u want to create a new object,not this one.(because in my application the object is not small..)
    then when u create the new object.and once that object is equated by
    one of the reference, other references still point to the original object. I dont know whether I m able to explain you clearly..

  • New Local Move Request fails with error "Multiple objects with Guid hex octet string were found."

    I can find nothing searching online.  Trying to move the last user mailbox from one server to another, but it fails with this error.  I have checked all mailboxes for the same GUID but can't locate it anywhere.  Anybody have some suggestions?

    Does anyone know if there is a way to perform a search based on mailbox GUID?  Maybe I could find all objects with the same and it could lead me in the right direction.
    Hi,
    To find the object that belongs to a GUID, you can refer to this blog.
    http://blogs.technet.com/b/ehlro/archive/2010/04/22/how-to-find-the-object-that-belongs-to-a-guid.aspx
    Best Regards.
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]
    Lynn-Li
    TechNet Community Support

  • Setting the name of a new object from a string

    Is there anyway I can set the object name of a newly created
    object from a string?
    eg.
    (the code below generates a compile time error on the
    variable declaration)
    public function addText(newTxt:String, txt:String,
    format:TextFormat):void {
    var
    this[newTxt]:TextField = new TextField();
    this[newTxt].autoSize = TextFieldAutoSize.LEFT;
    this[newTxt].background = true;
    this[newTxt].border = true;
    this[newTxt].defaultTextFormat = format;
    this[newTxt].text = txt;
    addChild(this[newTxt]);
    called using>
    addText("mytxt", "test text", format);
    I could then reference the object later on without using
    array notation using mytxt.border = false; for example
    There are many a time when I want to set the name of a new
    object from a string.
    In this example I have a function that adds a new text object
    to a sprite.
    The problem is, if I call the function more than once then
    two textfield objects will exist, both with the same name. (either
    that or the old one will be overwritten).
    I need a way of setting the name of the textfield object from
    a string.
    using
    var this[newTxt]:TextField = new TextField()
    does not work, If I take the "var" keyword away it thinks it
    a property of the class not an object.
    resulting in >
    ReferenceError: Error #1056: Cannot create property newTxt on
    Box.
    There must be a way somehow to declare a variable that has
    the name that it will take represented in a string.
    Any help would be most welcome
    Thanks

    Using:
    var this[newTxt]:TextField = new TextField()
    is the right approach.
    You can either incrment an instance variable so that the name
    is unique:
    newTxt = "MyName" + _globalCounter;
    var this[newTxt]:TextField = new TextField();
    globalCounter ++;
    Or store the references in an array:
    _globalArray.push(new TextField());
    Tracy

  • Inserting a new row in a BC4J View Object with an attribute of type BFileDomain

    Hi all,
    I've to insert a row in a View Object with an attribute of type oracle.jbo.domain.BFileDomain.
    I do this within an Application Module's method, which has an input parameter of type byte[]. This parameter will be the content of the BFILE.
    What's the right way for doing that?
    I've tried with the following code, but I've got an exception in committing the transaction:
    public int serializeDocument(int codDomanda, int codSorgente, byte[] content, String est, int type, int cost, String title, String arg) throws JboException {
    int code = 0;
    //File f;
    DocumentiTwoView = getDocumentiTwoView();
    java.sql.Statement stmt = ((DBTransaction) getTransaction()).createStatement(1);
    try {
    Row docRow = DocumentiTwoView.createRow();
    SequenceImpl seq = new SequenceImpl("documenti_seq", getDBTransaction());
    Integer next = (Integer) seq.getData();
    code = next.intValue();
    docRow.setAttribute("Coddocumento", new Number(code));
    docRow.setAttribute("Titolo", (String) title);
    docRow.setAttribute("Argomento", (String) arg);
    docRow.setAttribute("Costo", new Number(cost));
    docRow.setAttribute("Tipo", new Number(type));
    docRow.setAttribute("Coddomanda", new Number(codDomanda));
    docRow.setAttribute("Codsorgente", new Number(codSorgente));
    //f = new File("Doc" + code + "." + est)
    BFILE src_lob = null;
    ResultSet rset = null;
    rset = stmt.executeQuery ("SELECT BFILENAME('DOC_DIR', 'Doc" + code + "." + est + "') FROM DUAL");
    if (rset.next()) {
    src_lob = ((OracleResultSet)rset).getBFILE(1);
    BFileDomain bfd = new BFileDomain(src_lob);
    bfd.setBytes(content);
    bfd.saveToDatabase(getTransaction());
    docRow.setAttribute("Contenuto", (BFileDomain) bfd);
    catch (Exception ex) {
    getTransaction().rollback();
    throw new oracle.jbo.JboException("Impossibile creare il nuovo documento:\n" + ex.getMessage());
    finally {
    try {
    stmt.close();
    catch (Exception nex) {
    try {
    // Commit the whole transaction
    getTransaction().commit();
    catch (Exception e) {
    e.printStackTrace();
    getTransaction().rollback();
    throw new JboException("Impossibile eseguire il commit della transazione:\n" + e.getMessage());
    return code;
    Thanks a lot in advance!
    Christian
    null

    Odd, have you disabled caching and indirection? (NoIdentityMap, dontUseIndirection, or alwaysRefresh/disableCacheHits). If so, then this could be the issue.
    Otherwise please include the sample code you use to perform this, and verify that you do not have any unusual code in your set/get methods or in descriptor events. Also turn TopLink logging on and include a sample. Also ensure that you do not modify your objects until after registering them in the unit of work, and only modify the unit of work clones.

  • New user with an  massive array/string headache

    Working with a large (365 source files, 65 mxml files) SDK 3.6.0 project in FB 4.5 and continually get :
    Resource
    Path
    Location
    Description
    Type
    TB4.mxml
    /the0bot_1/src/the0bot/gui
    line 1
    1067: Implicit coercion of a value of type String to an unrelated type Array.
    Flex Problem
    TB4.mxml
    /the0bot_1/src/the0bot/gui
    line 1
    1184: Incompatible default value of type String where Array is expected.
    Flex Problem
    It is a very strange error, as you can see, line #1 is my language declaration!
    <?xml version="1.0" encoding="utf-8"?>
    This error is virtually non-removable.  It usually attaches to a component, or an ArrayCollection, and even if I delete the accused violator, the error will find a new point of attachment.?  This is the only page in the project that involves two-way data binding.  I had at first attributed the error to a yahoo.astra.com timestepper drop-in, but even rebuilding the page without that component does not remedy the trouble....
    Any help at this point would be appreciated, There are countless hours invested in the project and this has been a hold-up for several days now. 
    Thank you.

    Nothing had changed project-wise originally. I am simply adding a new mxml component to a perfectly good runnable project. I have since moved my workspace twice to a clean folder, and if  I remove the module everything is back to normal.
    I do notice that it won't show up if I have a normal error (i.e add a visual component but have not added code yet or forget a brace or such) but then when I clear the last error and validate, the cursor will jump to the top of the page mmediately.
    currently the errors are
    Resource
    Path
    Location
    Description
    Type
    TB4.mxml
    /the0bot_1/src/the0bot/gui
    line 296
    1067: Implicit coercion of a value of type String to an unrelated type Array.
    Flex Problem
    TB4.mxml
    /the0bot_1/src/the0bot/gui
    line 296
    1184: Incompatible default value of type String where Array is expected.
    Flex Problem
    (they have moved off the header to the reinstalled numberformatter)
    the code:
    Some may seem a little unconventional, but I have been getting strange errors like 
    Resource
    Path
    Location
    Description
    Type
    TB4.mxml
    /the0bot_1/src/the0bot/gui
    line 222
    1105: Target of assignment must be a reference value.
    Flex Problem
    which is why the 2 " tbean(t) = n; " lines are commented out.     ( tbean = object, t = string, n = number)???
    (all the bindings are an attempt at elimination....)
    <?xml version="1.0" encoding="utf-8"?>
         <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
                             xmlns:gui="the0bot.gui.*"
                             width="418" height="289">
              <mx:Script>
                        <![CDATA[
                                  import com.evony.common.beans.*;
                                  import com.evony.common.constants.*;
                                  import com.google.analytics.debug._Style;
                                  import flash.events.*;
                                  import flash.utils.*;
                                  import mx.collections.ArrayCollection;
                                  import mx.controls.Button;
                                  import mx.events.*;
                                  import mx.events.ItemClickEvent;
                                  import mx.events.PropertyChangeEvent;
                                  import mx.utils.ObjectUtil;
                                  import the0bot.common.*;
                                  import the0bot.event.CityManagerUpdateEvent;
                                  import the0bot.management.*;
                                  import the0bot.management.CityManager;
                                  import the0bot.player.*;
                                  import the0bot.scripts.*;
                                  private var cityManager:CityManager;
                                  private var city:CityState;
                                  public var _THE0BOT:String = "the0bot";
                                  public var the0bot:Boolean;
                                  public static const yes:Boolean = true;
                                  public static const no:Boolean = false;
                                  public static const zero:int = 0;
                                  public static const resource:Array = ("food", "wood", "stone", "iron", "gold");
                                  [Bindable]public var text:String;
                                  [Bindable]public var value:Number;
                                  [Bindable]public var tb2Heroes:ArrayCollection;
                                  [Bindable]public var tb2Troops:ArrayCollection;
                                  [Bindable]public var tb3Queue:ArrayCollection;
                                  [Bindable]public var tb2Resources:ArrayCollection;
                                  [Bindable]public var tb2Cities:ArrayCollection;
                                  [Bindable]public var selectedIndex:int;
                                  [Bindable]public var selectedCity:String;
                                  [Bindable]public var selectedHero:String;
                                  [Bindable]public var selectedtb3:String;
                                  // Rom
                                  public function init(citymanager:CityManager,City:CityState) : void {
                                            cityManager = citymanager;
                                            city=City;
                                            the0bot = (this.cityManager.getConfig(_THE0BOT, 0));
                                            resettb2Data();
                                            listCities;
                                            cityManager.addEventListener(CityManagerUpdateEvent.TYPE, onUpdate);
                                            Context.getInstance().addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, onContexthandler);
                                            Context.getInstance().addEventListener(CityManagerUpdateEvent.TYPE, onUpdate);
                                            Refresh();
                                  public function unInit() : void {
                                            if (cityManager.hasEventListener(CityManagerUpdateEvent.TYPE))
                                                      cityManager.removeEventListener(CityManagerUpdateEvent.TYPE, onUpdate);
                                            if (Context.getInstance().hasEventListener(CityManagerUpdateEvent.TYPE))
                                                      Context.getInstance().removeEventListener(CityManagerUpdateEvent.TYPE, onUpdate);
                                            cityManager = null;
      public function Refresh() : void {
                                            this.callLater(updateHeroes);
                                  [Bindable]private var travelTime:Number;
                                  [Bindable]private var campTime:Number;
                                  private function onContexthandler(event:PropertyChangeEvent) : void
                                            campTime = (Number(campMinutes.text)* 60000) + campSeconds.value * 1000;
                                            var t =(Utils.getServerTime() + travelTime + campTime)as Date;
                                            _arriveClock.text = TFseconds.format(t);
                                            (xSpin.value >= 800)? xSpin.value=0 : (xSpin.value <= -1)? xSpin.value = 799 :t=null;
                                            (ySpin.value >= 800)? ySpin.value=0 : (ySpin.value <= -1)? ySpin.value = 799 :t=null;
                                  private function onUpdate(event:CityManagerUpdateEvent) : void {
                                            if (event.CastleId == cityManager.id || event.CastleId == -1) {
                                                      switch (event.UpdateType) {
                                                                case CityManagerUpdateEvent.TROOPS:
                                                                case CityManagerUpdateEvent.PRODUCTION:
                                                                          Refresh();
                                                                          break;
                                  private function updateHeroes():void
                                            if (heroMenu.selectedIndex != zero) return;
                                            tb2Heroes.disableAutoUpdate();
                                            tb2Heroes = new ArrayCollection;
                                            for each (var hero:HeroBean in cityManager.heroes){
                                                      if (hero.isIdle == yes){
                                                                var obj:Object = new Object;
                                                                obj.label = hero.name;
                                                                tb2Heroes.addItem(obj);
                                            obj = {label:"any"};
                                            tb2Heroes.addItemAt(obj, 0);
                                            obj = {label:"none"};
                                            tb2Heroes.addItemAt(obj, 0);
                                            tb2Heroes.enableAutoUpdate();
                                            heroMenu.selectedIndex = zero;
                                  public function resettb2Troops() : void
                                            var tb2:Array = new Array();
                                            for (var t:int = 0; t < TroopType.justTroopIntNames.length-1; t++ )
                                                      tb2[t].label = TroopType.justTroopAbbr[t];
                                                      tb2[t].data = 0;
                                                      tb2[t].type = TroopType.justTroopIntNames[t];
                                            tb2Troops = new ArrayCollection(tb2);
                                  private function resettb2Resources():void
                                            var tb2:Array = new Array;
                                            for (var i:int = 0; i < resource.length-1; i++);
                                                      tb2.label = resource[i].charAt(0) + ":";
                                                      tb2.data = 0;
                                                      tb2.type = resource[i];
                                            tb2Resources = new ArrayCollection(tb2);
                                  private function listCities():void{
                                            tb2Cities = new ArrayCollection;
                                            for each (var gcity:CityState in Context.getInstance().cities){
                                                      var obj:Object = new Object;
                                                      obj.label = gcity.cityManager.castle.name;
                                                      obj.id = gcity.cityManager.castle.fieldId;
                                                      (obj.id == this.cityManager.castle.fieldId) ? tb2Cities.addItemAt(obj, zero) : tb2Cities.addItem(obj);
                                  private function resettb2Data():void
                                            resettb2Troops()
                                            resettb2Resources()
                                            updateHeroes();
                                            listCities();
                                  public function doesHaveEnsign(): Boolean {
                                            var player:* = Context.getInstance().Player;
                                            for each (var item:* in player.itemsArray) {
                                                      if (item.id == null) continue;
                                                      if (item.id == "player.troop.1.a") return true;
                                            return false;
                                  protected function campSwitchClick(event:MouseEvent):void
                                            /* if (campSwitch.selected = yes) arriveSwitch.selected = no;
                                            else {campMinutes.text = "0";
                                                      campSeconds.value=0;
                                  protected function arriveSwitchClick(event:MouseEvent):void
                                            if (arriveSwitch.selected = yes){
                                                      campSwitch.selected = no;
                                                      travelTime=0;
                                            else travelTime = getArmyMarchTime();
                                  public function tb2troopsToBean():TroopBean{
                                            var tbean = new TroopBean;
                                            var tb2:Array = tb2Troops.toArray()
                                            for (var i:int = 0; i < tb2.length-1; i++ )
                                            var n:Number = tb2[i].data;
                                            var t:String = tb2[i].type;
                                            //tbean(t) = n;
                                            return tbean;
                                  public function tb2resToBean():ResourceBean{
                                            var tbean = new ResourceBean;
                                            var tb2:Array = tb2Resources.toArray();
                                            for (var i:int = 0; i < tb2.length-1; i++ )
                                                      var n:Number = tb2[i].data;
                                                      var t:String = tb2[i].type;
                                                      //tbean(t) = n;
                                            return tbean;
                                  private  function spinCoordsString():String
                                            return xSpin.value + "," + ySpin.value;
                                  private  function missionTypeIndex():int
                                            var s:int=marchMenu.selectedIndex+1;
                                            if (s==4)s++;
                                            return s;
                                  private  function spinnersToFieldID():int{
                                            return (int(ySpin.value)*800 + int(xSpin.value));
                                  private  function fieldIDtoSpinners(fieldID:int):void
                                            xSpin.value = Map.getX(fieldID);
                                            ySpin.value = Map.getY(fieldID);
                                  public function getArmyMarchTime():Number{
                                            return cityManager.getAttackTravelTime(this.cityManager.id, spinnersToFieldID(), tb2troopsToBean(), missionTypeIndex());
                                  protected function xySpin_changeHandler():void
                                  protected function sendSwitchClick(event:MouseEvent):void
                                            var t:TroopBean = tb2troopsToBean();
                                            var r:ResourceBean = tb2resToBean();
                                            var camp:String = "";
                                            var time:String = campMinutes.text + ":" + campSeconds.textSnapshot;
                                            camp += (arriveSwitch.selected) ? "@:" + time : (campSwitch.selected) ? "c:" + time : "";
                                            if (!useEnsignSwitch.selected == yes)
                                                      this.city.sendTroops(spinCoordsString(), TroopType.troopBeanToString(t,","), missionTypeIndex(), heroMenu.text, r, camp);
                                            else this.city.sendBigTroops(spinCoordsString(), TroopType.troopBeanToString(t,","), missionTypeIndex(), heroMenu.text, r, camp);
                                            heroMenu.selectedIndex = zero;
                                            updateHeroes();
                                  protected function citycloseHandler(event:FlexEvent):void
                                            for each (var gcity:CityState in Context.getInstance().cities){
                                                      if (gcity.cityManager.castle.name == cityMenu.selectedLabel){
                                                                fieldIDtoSpinners(gcity.cityManager.castle.fieldId);
                                  private function herocloseHandler(event:Event):void {
                                            selectedHero = ComboBox(event.target).selectedItem.label;
                        ]]>
              </mx:Script>
              <mx:DateFormatter id="TFseconds" formatString="J:NN:SS"/>
              <mx:HBox width="415" height="288" horizontalGap="5" horizontalScrollPolicy="off" paddingTop="5"
                                   verticalScrollPolicy="off">
                        <mx:VBox width="277" height="280" horizontalAlign="center" horizontalScrollPolicy="off"
                                             verticalGap="4" verticalScrollPolicy="off">
                                  <mx:HBox x="0" y="0" height="276" horizontalGap="5" paddingLeft="5" paddingTop="3">
                                            <mx:VBox height="267" horizontalScrollPolicy="off" paddingTop="5" verticalGap="4"
                                                                 verticalScrollPolicy="off">
                                                      <mx:HBox id="troopCountBox" width="125" height="25" borderColor="#2B1296"
                                                                           borderStyle="solid" borderThickness="2" cornerRadius="5"
                                                                           horizontalAlign="center" horizontalGap="0" horizontalScrollPolicy="off"
                                                                           verticalScrollPolicy="off">
                                                                <mx:Label width="37" paddingTop="2" text="Army" textAlign="center"/>
                                                                <mx:Text width="70" paddingTop="2" text="125,000" textAlign="left"/>
                                                      </mx:HBox>
                                                      <mx:DataGrid id="table1" width="125" height="226" backgroundAlpha=".1"
                                                                                     backgroundColor="#EADFF2" borderColor="#400AAF" borderStyle="solid"
                                                                                     borderThickness="2" dataProvider="{tb2Troops}"
                                                                                     lockedColumnCount="2" lockedRowCount="12"
                                                                                     resizableColumns="false" rowHeight="20" selectionMode="singleCell"
                                                                                     showHeaders="false" sortableColumns="false"
                                                                                     variableRowHeight="false">
                                                                <mx:columns>
                                                                          <mx:DataGridColumn width="35" dataField="abbr" editable="false"
                                                                                                                      fontSize="10"/>
                                                                          <mx:DataGridColumn width="90" dataField="data" editable="true"
                                                                                                                      editorDataField="value" fontSize="10"
                                                                                                                      formatter="{nf}"
                                                                                                                      itemEditor="mx.controls.NumericStepper"/>
                                                                </mx:columns>
                                                      </mx:DataGrid>
                                            </mx:VBox>
                                            <mx:VBox width="131" height="268" horizontalAlign="center" paddingTop="5" verticalGap="4">
                                                      <mx:HBox width="125" height="25" borderColor="#2B1296" borderStyle="solid"
                                                                           borderThickness="2" cornerRadius="5" horizontalAlign="center" horizontalGap="0"
                                                                           horizontalScrollPolicy="off" verticalScrollPolicy="off">
                                                                <mx:Label width="31" paddingLeft="0" paddingRight="0" paddingTop="2" text="Res."
                                                                                      textAlign="right"/>
                                                                <mx:Text width="80" paddingTop="2" text="999,999,999" textAlign="left"/>
                                                      </mx:HBox>
                                                      <mx:DataGrid id="table2" width="125" height="139" allowMultipleSelection="false"
                                                                                     backgroundAlpha=".1" backgroundColor="#DBE4F5" borderColor="#400AAF"
                                                                                     dataProvider="{tb2Resources}" lockedColumnCount="2" lockedRowCount="5"
                                                                                     resizableColumns="false" rowHeight="20" selectionMode="singleCell"
                                                                                     showHeaders="false" sortableColumns="false" variableRowHeight="false">
                                                                <mx:columns>
                                                                          <mx:DataGridColumn width="35" dataField="abbr" editable="false"
                                                                                                                      fontSize="10" headerText="Type" textAlign="right"/>
                                                                          <mx:DataGridColumn dataField="data" editable="true"
                                                                                                                      editorDataField="value" fontSize="10" formatter="nf"
                                                                                                                      headerText="Amt." textAlign="right">
                                                                                    <mx:itemEditor>
                                                                                              <mx:Component>
                                                                                                         <mx:NumericStepper doubleClickEnabled="true"
                                                                                                                                                    maximum="{resMax()}"
                                                                                                                                                    stepSize="1"/>
                                                                                              </mx:Component>
                                                                                    </mx:itemEditor>
                                                                          </mx:DataGridColumn>
                                                                </mx:columns>
                                                      </mx:DataGrid>
                                                      <mx:HBox horizontalScrollPolicy="off" verticalAlign="middle"
                                                                           verticalScrollPolicy="off">
                                                                <mx:Label width="33" height="19" text="Arr:" textAlign="right"/>
                                                                <mx:Text id="_arriveClock" width="76" height="21" paddingLeft="2" paddingTop="1"
                                                                                     text="00:00:00" textAlign="left"/>
                                                      </mx:HBox>
                                                      <mx:HBox width="84" horizontalGap="0" horizontalScrollPolicy="off" verticalScrollPolicy="off">
                                                                <mx:TextInput id="campMinutes" width="23" fontWeight="bold" maxChars="3"
                                                                                                 restrict="0-9" text="00" textAlign="right"/>
                                                                <mx:Text width="7" fontWeight="bold" selectable="false" text=":"
                                                                                     textAlign="right"/>
                                                                <mx:NumericStepper id="campSeconds" width="49" fontWeight="bold" maximum="59" value="" textAlign="left"/>
                                                      </mx:HBox>
                                                      <mx:ComboBox id="marchMenu" width="100" editable="false" fillColors="black,blue"
                                                                                     textAlign="center">
                                                                <mx:dataProvider>
                                                                          <mx:Array>
                                                                                    <mx:String>transport</mx:String>
                                                                                    <mx:String>reinforce</mx:String>
                                                                                    <mx:String>scout</mx:String>
                                                                                    <mx:String>attack</mx:String>
                                                                          </mx:Array>
                                                                </mx:dataProvider>
                                                      </mx:ComboBox>
                                            </mx:VBox>
                                  </mx:HBox>
                        </mx:VBox>
                        <mx:HBox width="125" height="280" borderColor="#400AAF" borderStyle="solid"
                                             borderThickness="2" cornerRadius="5" horizontalGap="3" horizontalScrollPolicy="off"
                                             paddingLeft="4" paddingTop="4" verticalScrollPolicy="off">
                                  <mx:VBox width="115" height="269" horizontalAlign="center" horizontalScrollPolicy="off"
                                                       verticalGap="5" verticalScrollPolicy="off">
                                            <mx:RadioButton id="useEnsignSwitch" width="65" label="Ensign"/>
                                            <mx:HBox width="100%" height="27" borderColor="#3F2AC1" borderStyle="solid"
                                                                 borderThickness="2" cornerRadius="5" horizontalAlign="center"
                                                                 verticalAlign="middle">
                                                      <mx:Button id="editSwitch" width="45" height="20" label="Edit" enabled="false"
                                                                             paddingLeft="1" paddingRight="1" toggle="true"/>
                                                      <mx:Button id="FMJSwitch" width="45" height="20" label="F.M.J."
                                                                             click="campSwitchClick(event)" enabled="false" paddingLeft="1"
                                                                             paddingRight="1" selected="true" toggle="true"/>
                                            </mx:HBox>
                                            <mx:ComboBox id="tb3Menu" width="100" dataProvider="{tb2Heroes}" editable="false"
                                                                           close="tb3closeHandler(event)" fillColors="black,blue" selectedIndex="0"
                                                                           textAlign="center">
                                            </mx:ComboBox>
                                            <mx:ComboBox id="cityMenu" width="100" dataProvider="{tb2Cities}" editable="false"
                                                                           close="citycloseHandler(event)" fillColors="black,blue" selectedIndex="0"
                                                                           textAlign="center">
                                            </mx:ComboBox>
                                            <mx:ComboBox id="heroMenu" width="100" dataProvider="{tb2Heroes}" editable="false"
                                                                           close="herocloseHandler(event)" fillColors="black,blue" selectedIndex="0"
                                                                           textAlign="center">
                                            </mx:ComboBox>
                                            <mx:HBox width="100" height="28" horizontalAlign="center" horizontalGap="0" paddingBottom="0"
                                                                 paddingLeft="0" paddingRight="0" paddingTop="0" verticalAlign="middle">
                                                      <mx:Label text="X:"/>
                                                      <mx:NumericStepper id="xSpin" width="55" change="xySpin_changeHandler(event)"
                                                                                                  maximum="800" minimum="-1" value="0"/>
                                            </mx:HBox>
                                            <mx:HBox width="100" height="28" horizontalAlign="center" horizontalGap="0"
                                                                 horizontalScrollPolicy="off" paddingBottom="0" paddingLeft="0" paddingRight="0"
                                                                 paddingTop="0" verticalAlign="middle" verticalScrollPolicy="off">
                                                      <mx:Label text="Y:"/>
                                                      <mx:NumericStepper id="ySpin" width="55" change="xySpin_changeHandler(event)"
                                                                                                  maximum="800" minimum="-1" value="0"/>
                                            </mx:HBox>
                                            <mx:HBox width="108" height="26" borderColor="#3F2AC1" borderStyle="solid"
                                                                 borderThickness="2" cornerRadius="5" horizontalAlign="center"
                                                                 horizontalScrollPolicy="off" verticalAlign="middle" verticalScrollPolicy="off">
                                                      <mx:Button id="sendSwitch" width="45" height="22" label="Send" borderColor="#60C592"
                                                                             click="sendSwitchClick(event)" paddingLeft="1" paddingRight="1"/>
                                                      <mx:Button id="clearSwitch" width="54" height="22" label="Clear"
                                                                             click="clearSwitch_clickHandler(event)"/>
                                            </mx:HBox>
                                            <mx:HBox width="100%" height="27" borderColor="#3F2AC1" borderStyle="solid"
                                                                 borderThickness="2" cornerRadius="5" horizontalAlign="center"
                                                                 verticalAlign="middle">
                                                      <mx:Button id="arriveSwitch" width="45" height="20" label="Arrive" enabled="true"
                                                                             paddingLeft="1" paddingRight="1" toggle="true"/>
                                                      <mx:Button id="campSwitch" width="45" height="20" label="Camp"
                                                                             click="campSwitchClick(event)" enabled="true" paddingLeft="1"
                                                                             paddingRight="1" selected="true" toggle="true"/>
                                            </mx:HBox>
                                  </mx:VBox>
                        </mx:HBox>
              </mx:HBox>
    </mx:Canvas>

Maybe you are looking for

  • Tab key in the ActiveX AcroPDF crashes application

    Hello everybody, I wonder whether any of you had this problem working with an ActiveX which displays a PDF file.  This is the situation:  -  I've designed a VI which displays a pdf file in the ActiveX container (see attached) using LabVIEW 2009 Proff

  • Reader 8.2

    Does anyone know where I can download Reader 8.2 for distribution. I need an msi so I can distribute it with group policy. When I go through the Distribution Agreement I only have the option of downloading version 9. And version 9 is causing me probl

  • Ichat not connecting for video chat

    hi when i try to video chat with my buddys it wont connect. it gives me a pop up box saying "there was a communication error during your chat" and it tells me that it failed to start video chat because I did not respond. this message comes up both wh

  • Audigy 2 ZS plat live drive prob

    Hey everyone, I've had this problem for several months now (since I first got this card and li'vedri've, actually). The deal is that when I plug my headphones + mic into the li'vedri've in front and set the Creative Surround Mixer settings to Line 2/

  • Officejet J4500 All in one printer

    I am trying to print business cards and they come out great on a test sheet.  On the business card itself, Avery Matte the print does not come out aligned on the cards.  The printing starts on the tear away margins so I have wasted a pack of 150 card