Create object from AS3

im trying to create objects based on number i input on a textbox
here is the image and code :
// Image
// codes
import flash.events.MouseEvent;
var circle:Shape = new Shape();
var i:int;
var j:int;
myBtn.label = "Show";
var a:Number = Number(text1.text);
myBtn.addEventListener (MouseEvent.CLICK,createCircle);
function createCircle (event:MouseEvent):void{
    for (i = 1;i<=a;i++){
        for (j = 1;j<=a;j++){
            circle.graphics.beginFill(0xFF0000, 1);
            circle.graphics.lineStyle(5, 0x000000);
            circle.graphics.drawCircle(j*50 + j*20, i*50 + i*20, 25);
            circle.graphics.endFill();
            addChild(circle);
can someone help me ??
thanks

i can apply the mc with tween already
but the circle create tweening when other circle create which i want it to stop when it finish and then the other circle tween
i try using array to the mc but i think i mess up in the code
can some1 help me ??
// here is the code
import flash.events.MouseEvent;
import flash.ui.Mouse;
import fl.transitions.Tween;
import fl.transitions.easing.Strong;
import fl.transitions.TweenEvent;
var i:int = 1;
var a:int;
var myMC:MovieClip = new MovieClip();
var myTween:Tween;
var myArray:Array = new Array();
myMC.name = "mc1";
myBtn.label = "Show";
myBtn.addEventListener (MouseEvent.CLICK,showCircle);
function timing (event:MouseEvent):void{
    a = int(text1.text);
    var myTimer:Timer = new Timer(500,a);
    myTimer.addEventListener(TimerEvent.TIMER,  createCircle);
    myTimer.start();
function createCircle (event:Event):void{
    a = int(text1.text);
    myMC.graphics.beginFill(0xFF0000, 1);
    myMC.graphics.lineStyle(5, 0x000000);
    myMC.graphics.drawCircle(200, 150 + i*50 , 25);
    myMC.graphics.endFill();
    myArray.push(myMC);
    i++;
function showCircle (e:MouseEvent):void{
        a = int(text1.text);
        var myTimer:Timer = new Timer(500,a);
        myTimer.addEventListener(TimerEvent.TIMER,  createCircle);
        myTimer.start();
        addChild (myMC);
        myTween = new Tween(myMC, "x", Strong.easeOut, 50, 400, 2, true);
and the circle didnot restart when i input a new number to the inputbox
for example when i first input 3 in the textbox, it create up to 3 circle
when i change the number to 4 , the circle add 4 to the previous 3 circle rather than create new 4 circle
how do i solve this ??
thanks

Similar Messages

  • Problem Create object from superclass

    Hi,
    I have a problem with classes:
    I have one abstract superclass which has a method to create objecto for its children class.
    CREATE OBJECT R_FLIGHT TYPE (l_class_name)
         EXPORTING
           i_sflight = l_sflight.
    l_class_name: has the name of my children class
    My children class has this properties:
    A dump its triggered when I try to create object from the superclass.
    Best Regards

    Hello,
    I think that you defined the instantiation level of the superclass as PROTECTED & from the screenshot i can see that the instantiation level is protected & the class is marked as "Final".
    Are you having a factory method which returns the instance of the abstract class & you use it to achieve polymorphism?
    May be a little bit insight into your coding can help us
    BR,
    Suhas

  • How to create object from Table?

    Hi all,
    Is there any command to create an object type from a table?
    I i want to that command to create object type from emp table insted of typing the following command:
    CREATE TYPE emp_t AS OBJECT
    (empno NUMBER(6),
    ename VARCHAR2(25),
    job VARCHAR2(10),
    mgr NUMBER(6),
    hiredate DATE,
    sal NUMBER(8,2),
    comm NUMBER(2,2))
    any help would highly be appriciated.
    Thank you in advance,
    Alireza

    Hi Jafar,
    Thanks for your attention,
    I dont want to create synonym,
    I just want to create some Object types and work with XMLDB and create xsd or somthing like that using XMLDB packages.
    I supose There shold be a simple way to do that.
    Alireza

  • Creating objects from .xsd

    It is easy to construct objects in a oracle database that produce xml files with nested tables etc.
    What i'm looking for is a utility that creates the pl/sql code for the construction of those objects from a .xsd file !
    Anyone?

    You and me both, eppo.
    Supposedly 9iR2 has some tools that support this, but I don't know where to find them.

  • Having trouble with creating objects from instances created with ClassLoade

    Hi.
    I'm having a bit of trouble with casting an instance of an object from a custom ClassLoader. Don't worry - the code isn't for anything sinister - it's for one of those life simulation thingies, but I want to make it modular so people can write their own 'viruses' which compete for survival. You know the score.
    Anyway. I've got the beginnings of my main class, which seems to load the class data for all 'virus' classes in a folder called 'strains'. There is a abstract class called AbstractVirus which declares the method calls for how the viruses should behave and to get textual descriptions, etc. AbstractVirus is to be subclassed to create working virus classes and these are what my main class is trying to load instances of.
    Unfortuantely, I can't cast the instances into AbstractVirus objects. The error I've been getting is 'ClassCastException' which I presume is something to do with the fact that my ClassLoader and the Bootstrap ClassLoader aren't seeing eye-to-eye with the class types. Can anyone help? This line of programming is really new to me.
    My code for the main class is below:
    /* LifeSim.java */
    public class LifeSim {
      public LifeSim() {
        /* Get a list of all classes in the 'strains' directory and store non-
         * abstract classes in an array. */
        Class virusClasses[] = null;
        try {
          /* Get a reference to the file folder 'strains' and make sure I can read
           * from it. */
          java.io.File modulesFolder = new java.io.File("strains");
          if (!modulesFolder.isDirectory() || !modulesFolder.canRead()) {
         System.out.println("Failed to find accessible 'strains' folder");
         System.exit(-1);
          /* Get a list of all the class files in the folder. */
          String virusFiles[] = modulesFolder.list(new ClassFileFilter());
          if (virusFiles.length == 0) {
         System.out.println("No virus strains in 'strains' folder");
         System.exit(-1);
          /* Create an array of class objects to store my Virus classes. Ignore the
           * abstract class as I cannot instantiate objects directly from it.*/
          virusClasses = new Class[virusFiles.length];
          VirusClassLoader classLoader = new VirusClassLoader();
          int j = 0;
          for (int i = 0; i < virusFiles.length; i++) {
         String virusName = "strains/" + virusFiles;
         Class tempClass = classLoader.loadClass(virusName);
         if (tempClass.getName().compareToIgnoreCase("strains.AbstractVirus") != 0) {
         virusClasses[j++] = tempClass;
    } catch (ClassNotFoundException ncfe) {
    System.out.println("Failed to access virus class files.");
    ncfe.printStackTrace();
    System.exit(-1);
    /* TEST CODE: Create an instance of the first virus and print its class
    * name and print details taken from methods defined in the AbstractVirus
    * class. */
    if (virusClasses.length > 0) {
    try {
         // Print the class name
         System.out.println(virusClasses[0].getName());
         Object o = virusClasses[0].newInstance();
         strains.AbstractVirus av = (strains.AbstractVirus) o;
         // Print the virus name and it's description
         System.out.println(av.getQualifiedName());
         System.out.println(av.getDescription());
    } catch (InstantiationException ie) { ie.printStackTrace(); }
         catch (IllegalAccessException iae) { iae.printStackTrace(); }
    public static void main(String args[]) {
    new LifeSim();
    class ClassFileFilter implements java.io.FilenameFilter {
    public boolean accept(java.io.File fileFolder, String fileName) {
    if (_fileName.indexOf(".class") > 0) return true;
    return false;
    class VirusClassLoader extends ClassLoader {
    private String legalClassName = null;
    public VirusClassLoader() {
    super(VirusClassLoader.class.getClassLoader());
    public byte[] findClassData(String filename) {
    try {
    java.io.File sourcefile = new java.io.File(filename);
    legalClassName = "strains." + sourcefile.getName().substring(0,sourcefile.getName().indexOf("."));
    java.io.FileInputStream fis = new java.io.FileInputStream(sourcefile);
    byte classbytes[] = new byte[fis.available()];
    fis.read(classbytes);
    fis.close();
    return classbytes;
    } catch (java.io.IOException ioex) {
    return null;
    public Class findClass(String classname) throws ClassNotFoundException {
    byte classbytes[] = findClassData(classname);
    if (classbytes == null) throw new ClassNotFoundException();
    else {
    return defineClass(legalClassName, classbytes, 0, classbytes.length);
    Thank you in advance
    Morgan

    Two things:
    I think your custom ClassLoader isn't delegating. In general a ClassLoader should begin by asking it's parent ClassLoader to get a class, and only if the parent loader fails get it itself. AFAIKS you could do what you're trying to do more easilly with URLClassLoader.
    Second, beware that a java source file can, and often does, generate more than one class file. Ignore any class files whose names contain a $ character. It's possible you are loading an internal class which doesn't extend your abstract class.

  • Unable to create object from stored procedure

    Hi,
    we are trying to use a stored procedure to do data preparation.
    When we add the stored procedure to a universe, the procedure is executed succesfully and a table with one column, called "1" is created. When we try to create an object from this column, Designer does not allow us to do so.
    We already tried to alias the column name in the stored procedure but we still get an unusable column called "1" back.
    BO version used is XI R3.0. The stored procedure is written in Cobol on DB2 mainframe.
    Does somebody know what we do wrong ?

    Problem solved.
    First we aliased the result columns in the stored procedure, that got rid of the "1".
    Then we still could not create an object based on the column in the result set.
    Apparently this issue occurs when the length of the column of the result set is too long.
    We decreased the length and now we can create the object

  • Unable to create object from stored procedure universe

    Dear All Experts,
    I am facing a problem on unable to create object dimensions on a Stored procedure universe. Fyi, I have successfully insert a stored procedure ('SP_Sales') with input parameter (@date) into universe (Universe_1). But I unable create any object based on the the stored procedured ('SP_Sales') due to it show nothing from the Edit Select Statement of 'Object1', empty for Tables nd columns windows.
    Thefore, i unable to drag data in WEBI when i select univese as "Universe_1", it will not sure any object. Please advise.
    I am using XI4.0, MSSQL2008.

    Hi ,
    You wont be able to edit the object definitions.
    u2022 Designer generates one table per selected stored procedure (or many
    tables if multiple result sets) and one object per column returned by a
    stored procedure.
    u2022 The result set structure is determined when you describe the function.
    Please refer chapter 7(Page 451) of below document for more details.
    [Universe Designer Guide|http://help.sap.com/businessobject/product_guides/boexir31/en/xi3-1_designer_en.pdf]
    Hope this helps.
    Bilahari M

  • Create object from a different location

    I have a script object under Variables called Library. In it, I have a cat object:
    function Cat(name) {
    this.name = name;
    this.talk = function() {
    app.alert( this.name + " meow" )
    I want to instantiate an instance of Cat from form.initialize.
    If I do var myCat = new Library.Cat("Oscar"); I get exception.

    rman target /
    catalog start with '/other/archivelog/location';
    backup archivelog like '/other/archivelog/location/%' ... ;

  • Creating objects from traced image for video

    I want to take the traced star (and maybe the text) to use in a video project. I need to make individual objects that I can fill and animate in AE or Premiere. Is Illustrator the right app to use? And where is a tutorial on how this is done?

    Alex,
    The star is made of rather simple parts, and an obvious solution would be to recreate it using some of the Tools in the Rectangle Tool group and possibly the Pen Tool.
    For the text, the easiest way would be to use the Type Tool; you may use similar fonts amng the countless ones available, or look for the exact font at sites like
    http://www.identifont.com/
    http://www.whatfontis.com/
    http://new.myfonts.com/WhatTheFont/

  • 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

  • How to create Object!

    Hi all,
            Can anyone tell me how to create an object of the class CL_BP_HEAD_CORPACCOUNTDET_CTXT .
    Please reply as fast as possible.
    Regards,
    Vijay

    Hi Balasubramanian,
    The below steps might help u out.
    1.      Call the function Create Object.
    You have the following options:
    ¡        Choose Object ->New () in the main menu (or the pushbutton Create Object ).
    ¡        Position the cursor on a structure node in the navigation area and choose New () from the context menu.
    In this case, there are already entries in the Create Object dialog, corresponding to the position of the cursor in the navigation area.
    Integration Builder (Integration Directory): You have positioned the cursor on the Service node of a communication party. If you call the function Create Object from the context menu, there are already entries for the object type Service and the party field.
    You cannot create objects of type RFC or IDoc again.
           2.      Enter the required information. Select the object type first and then specify the object key.
    An input help  is available to help you specify the key values. To call the input help, use the icon . The value selection offered by the input help may depend on which values have already been defined for the other key attributes.
    Integration Builder (Integration Repository): The namespace selection depends on the selected software component version.
           3.      To confirm your entries, choose Create.
    This calls the object editor for this object. The specifications that you made when you created the object are displayed in the header. You can edit the object further in the work area of the object editor.
    Once you have confirmed your entries by choosing Create in the Create Object dialog, you can no longer change the object key.
    Reward if helpful.
    Thankyou,
    Regards.

  • Create Object menu not appearing

    For a particular group I have given the Create Subportal activity right and even though they can get to the Subportal Manager section they're not getting the Create Object from where they should be able to create subportals. Any ideas?

    Hi
    Your description is a bit vague - but here's something you
    can try
    If your using Text inside a MovieClip then you need to Embed
    the Font.
    Select your text and click the Embed button on the Components
    Panel - select all the Characters that are likely to appear in your
    text. Save and Run - See if there's a difference.
    Check your Alpha also you never know.
    Hope it helps

  • How to create multiple TYPES of objects from one menu?

    Q: How can I create a single class to create objects of multiple 'object classes' in a way that is not a huge switch statement?
    Explaination:
    Let's say that I have an application that I am building, that manages five hundred object types. A properly-built object subclassing tree is created, and I want to be able to create objects of any 'leaf node' of this subclassing tree using a single 'objectCreate()' method in a 'factory object'. The purpos of this method will be to create an instance of the correct object, pass a handle to a few collections for properly sorting and storing these objects in groups.
    Usually, one could create a switch in this function, testing for the type of object that the user wants to create from the menu. But in the case of having hundreds of possible object choices, this becomes harder and harder code to maintain (let alone performance).
    Any suggestions?

    But if my menu has:
    1. German Shepard
    2. Doberman Pinscher
    3. Malamut
    4. Persian Long-hair
    5. Siamese
    6. Tabby
    And my object class tree goes:
                                  [ Animal ]
                 [ Cat ]                              [ Dog ]
      [ various breeds ]                         [ various breeds ]How do I code the menu class to respond to the input, so that it runs the correct [breed] object's constructor?
    The line:
    Animal choice = new xxxxxxxx();
    I can't use a variable to replace 'xxxxxxxx' in run-time, but having a ton of choices in code sounds/looks unreasonable.
    if (choice == "Doberman Pinscher")
    Animal choice = new doberman();
    else if (choice == "Tabby")
    Animal choice = new tabby();
    Do you see what I am trying to avoid? I am not experienced enough to instantly realize how to avoid the latter, and instead, do a single instantiation command for the correct constructor.

  • Can you create an object from a string

    I have been working on creating a dynamic form, creating the
    form items from an xml file. I am getting very close to conquering
    this task. I will share it when it's complete.
    However, I am stuck at the moment trying to create an object
    from a string. For example, if the xml item is an HBox I want to
    create an HBox. Like this: parentObject = new arrayOfFormItems[
    index ]..type ()
    This isn't working. First, is this possible using some syntax
    I am unaware of in Flex? I don't want to use a large if or case
    statement if possible.
    Thanks in advance for your help!

    Thank you very much. Indeed that did solve the one problem. I
    missed the casting as a Display Object. That is awesome!
    I do still however, have to instantiate one of every item I
    want to dynamically create or I get the following error when I try
    to create a dynamic object that I have not instantiated before.
    ReferenceError: Error #1065: Variable HBox is not defined.
    at global/flash.utils::getDefinitionByName()
    at MyForm/buildForm()
    at DynamicForm/::onComplete()
    at
    flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/flash.net:URLLoader::onComplete()
    I read that you have no choice but to instantiate one of each
    type to force the linker to link the code for that class into the
    .swf. Unless you know another way to force it.
    This is what I have in my Application mxml to get it to work:
    <mx:HBox>
    <mx:Text visible="false"/>
    <mx:TextArea visible="false"/>
    <mx:TextInput visible="false"/>
    <mx:DateField visible="false"/>
    </mx:HBox>
    And those are the types I'm using to test with. . . I will
    have to add all the others I want to use as well . . .

  • Can I create a network object from CIDR format or do I need to use IP - netmask?

    Have a cisco ASA running ASA V 8.3
    Wondering what the correct syntax is or even if it is possible to create a network object from a list of IP's in CIDR format? 
    Typically just do this:
    Create network-object
    object-group network name
    network-object 1.2.3.0 255.255.255.0
    Would like to do this: 
    network-object 1.2.3.0/24
    thanks!

    Hi,
    As far as I know the ASA does not support entering a network/subnet mask in such format in any of its configurations.
    - Jouni

Maybe you are looking for