Create a circle class

Hey guys,.

I'm trying to do something very simple which doesn't

I have a custom class that creates a circle:

create package

{

import flash.display.Shape

public class circle

{

public function circle()

{

var circle: Shape = new Shape();

circle.graphics.lineStyle (5, 0, 1);

circle.graphics.drawCircle (50,50,20);

}

}

}

And I have a main mxml file that has a button that when pushed must execute the code in the custom class costructor and add the circle on the stage:

<? XML version = "1.0" encoding = "utf-8"? >

" < = xmlns:fx s:WindowedApplication ' http://ns.Adobe.com/MXML/2009 "

xmlns:s = "library://ns.adobe.com/flex/spark".

xmlns:MX = "library://ns.adobe.com/flex/mx" >

< fx:Script >

<! [CDATA]

import creat.circle

protected function createCircle_clickHandler(event:MouseEvent):void

{

}

]]>

< / fx:Script >

< s:Button id = "createCircle" x = "27" y = "122" width = "35" label = "Button".

Click = "createCircle_clickHandler (event)" / >

< / s:WindowedApplication >

What code should go in the createCircle function to make it work? I tried creat.circle (); and it gave me the error that says: I need 1 argument in part (). That is confusing
Someone at - it help him?
Thank you
Chris

Hello

Create your class circle as below: -.

Class circle: -.

package
{
import flash.display.Sprite;
   
Import mx.core.UIComponent;

SerializableAttribute public class Circle extends UIComponent
{
public function Circle()
{
var circle: Sprite = new Sprite();
           
circle.graphics.lineStyle (5, 0, 1);
           
circle.graphics.drawCircle (50,50,20);
this.addChild (circle);
}

}
}

And use it in your Application as below:

YourApplication;


http://ns.Adobe.com/MXML/2009.
xmlns:s = "library://ns.adobe.com/flex/spark".
xmlns:MX = "library://ns.adobe.com/flex/mx" >


        protected function btnHandler(event:MouseEvent):void
{
var circle: Circle = new Circle();
circleConatiner.addChild (circle);
}
]]>
   


       
   

   
   

   
   

with respect,

Wallerand

Tags: Flex

Similar Questions

  • Substitution of the class, how to create the child class and then the base class

    I started to write a program for a DMM smart, that the problem is all versions of DMM greet the change company communication.

    My idea is to write a child class for each version, DMM and each Subvi child will replace the Subvi base class.

    My problem is, I first want to create a child class and after I see everything is working, start creating the base class. in this way, I'll see if think the right way.

    My question is

    How can I create a child class and then create the base class and configure the Subvi class of the child to be the substitution of the base class?

    I tried searching in the property of the class, but I don't see anything.

    Thank you

    This can be done and I did on occasion.

    You create the base class with the methods of dynamic distribution, you need (Connector components must be identical to those of the class of the child).

    Set then the legacy of the class inherits this base class.  If your method is defined as a dynamic distribution method in the parent, you will probably now have some errors (unless your method of child was already DD, in which case you might be OK already).

    To change the inheritance of a class, right-click on the properties of the class in your project, and then select Properties.  According to me, the tree of estate is at the lower end of the property.  Click on the 'legacy of change' (or something similar) to choose the class from which you now want to inherit.

  • My EO fields are numeric values, but when I create the EOIMPL class they are converted to INTEGERS numbers. Why, please explain.

    Mr President

    My EO fields are numeric values, but when I create the EOIMPL class they are converted to INTEGERS numbers. Why, please explain.

        public static final int PURQTY = AttributesEnum.Purqty.index();
        public static final int STAXRATE = AttributesEnum.Staxrate.index();
        public static final int UNITPURPRICE = AttributesEnum.Unitpurprice.index();
        public static final int SALQTY = AttributesEnum.Salqty.index();
        public static final int UNITSALPRICE = AttributesEnum.Unitsalprice.index();
        public static final int PARTICULARS = AttributesEnum.Particulars.index();
        public static final int AMOUNT = AttributesEnum.Amount.index();
    

    Can keep us in digital format.

    Concerning

    No.... These int values not the type of display object attributes. These integers is the index of attributes.

    To determine the type of the VO attributtes, you should see the Get accessor of the attribute and the setter

    as

      /**
       * Gets the attribute value for the calculated attribute CountDockets.
       * @return the CountDockets
       */
      public BigDecimal getCountDockets()
      {
        return (BigDecimal) getAttributeInternal(COUNTDOCKETS);
      }
    
      /**
       * Sets value as the attribute value for the calculated attribute CountDockets.
       * @param value value to set the  CountDockets
       */
      public void setCountDockets(BigDecimal value)
      {
        setAttributeInternal(COUNTDOCKETS, value);
      }
    

    This means that the attribute type CountDockets BigDecimal

  • Creating a circle clear ole

    My selection tool automatically creates a circle with a double line (a bit like a circle inside another circle).  I would like to create a unique double circle.  (For some reason my screenshot is not sticky :-().

    Hi virtualista,

    To create a circle, you do not want to use the 'Ellipse tool'.

    In the toolbar, you should find an oval/circle shape. It may be disguised in another form (for example, a square) you last used.

    Simply click and hold down on the parameters form. It should look like this:

    With the Ellipse tool selected, you can create cirlces and ovals by clicking and dragging on the canvas. Now 'shift' when you drag, you can create perfect circles.

    I hope this helps!

    Clarice

  • How to create a circle of multiple segment?

    Hi guys,.

    I need some advice on how to create a circle segmented as shown in the picture as an attachment. I have it as a jpg, but I want to create it in Illustrator so I could have more control over the parts. For example, while the image shows three segments, I may have to add another in the image (this is the part of a demo of process).

    Advice/help greatly appreciated.

    See you soon

    Carlroundtrip.jpg

    Carl,

    You can (all circles are concentric):

    (1) create two circles, indoor and outdoor, and oppose > compound path > make.

    (2) create an auxiliary outside circle, extending outside the extreme parts to make arrows

    (3) create a tip of arrow in the center of the circles; to avoid its pointing outwards (too), you can place its Center (rather than the part which can / base) in the Center.

    (4) move a copy of the arrow by the width of the desired interval, cut to side anchors and remove the base segment (and filling) If you have a path composed of two curved segments.

    Movement 5) a copy of 4) at the top of the arrow Tip 3).

    6 move 3) 4) and 5), in position with the centre between the two circles (from the average of the rays) and turn all of them as well as the circle auxiliary so that you get all the arrows placed in the right way (120 3, 90 degrees to 4 degrees, etc.).

    (7) hide/remove the auxiliary of the circles,

    (8) hide arrowheads,

    (9) select (Ctrl / Cmd + A) and Pathfinder > divide and remove unneded parts, namely the gaps and the funny thingy in the middle.

    Now you have the parts of the circle in a simplified version since they would be without the sides of arrow sticking out (some do),.

    (10) show arrowheads, and then select each with the corresponding part of circle and Pathfinder > unit (or Add to shape area or whatever it is called in your version).

    (You can color the parts as desired in connection with 9 arrow/circle) or 10).

  • Failed to create a circle using the ellipse (using CS4 on Macbook Pro 11.0.2) tool

    I'm used to be able to create a circle with tool ellipse in shift-key while dragging, long-standing method.  That is no longer works and I can not understand why.  The ellipse remains as an ellipse, regardless of what I do.  I restarted the program but that had no effect on the problem.  Any suggestions?  Thank you

    Did you get fixed report selected in the options bar?

    [EDIT]  Just noticed a typo in my last post.  'Aspect ratio' not 'aspect ratio' Doh!

  • How to create a new class

    Hello

    I am trying to create a new class called Questions, which has two properties (type and condition).
    Action script is saved in the myComponents the project folder.

    When I compile the application, I get the following error message:
    "1172 definition myComponents:Question is not found."
    Why?

    How to call a constructor for a new class, which is not an extension of an existing class?

    Concerning
    / Acke

    //-----------Class----------//
    myComponents package
    {
    Import all classes in the package mx.events
    Mx.events import. *;

    public class {Question

    Public constructor.
    public var {Question()}
    Call the constructor of the superclass.
    Super();
    }
    Define properties and methods.
    Define the public vars.
    public var type: string;
    public var status: string;
    }
    }

    //------Main----------//
    <? XML version = "1.0" encoding = "utf-8"? >
    "" < mx:Application xmlns:mx = ' http://www.adobe.com/2006/mxml ' layout = "absolute".
    xmlns:mycomp = "myComponents.*" >

    < mx:Script >
    <! [CDATA]
    Import mx.controls.Alert;
    Import mx.events.CloseEvent;
    Import myComponents.Question;
    etc, etc...

    Stupid me!

    I have two projects, Quest and AutoQuest, and I recorded it under that bad!.

    Thus, it is important now as it should.

    Thank you all for your efforts.

    Concerning
    Acke

  • How to get the menuitem created in another class

    Hello

    I created a class. on the inside I added a few menus using addMenuItem (Map);

    final class UserInterfaceTouch extends MainScreen
    {
    
     UserInterfaceTouch() {
            super();
    
            LabelField title = new LabelField("Nutiteq SDK Map Sample",
                    LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
    
            setTitle(title);
            addMenuItem(_test);
    
        }
    MenuItem _otest = new MenuItem("Testing, 10, 10) {
            public void run() {
                --- code for doing some thing
            }
        };
    }
    

    How do I acess the menu in the class thus form another class, is it possible to do so.

    Thank you

    SujithRavindran

    Sorry for posting this.

    I got the answer.

  • Create a circle incomplete stroke

    Please could someone advise a simple way to the following

    How to create any outline circle percentage in illustrator, mainly if the circle is empty - just a stroke and her with, i.e. a 33%, 57% or whatever

    but the circle is not complete, it would be useful for an info-graphic.

    It would be nice to put pictures behind it, so should be as said earlier, incomplete.

    See you soon,.

    Simon.

    Simon,

    If you mean less than a full circle, you can select directly one of the 4 segments and press DELETE to remove 25%; for the other angles, you can use the scissors tool or a path as described below.

    If you want the part circle to be filled, you can add straight segments of the Center to the ends of the circumference, otherwise the fact already in connection with the cut that in the solution below.

    You can click where you want to cut with the scissors tool, or you can create a straight path that goes from the Center to the circumference, turn then a copy around the center of the desired angle, then select both and Ctrl / Cmd + J to join them, then object > path > divide objects below, and then delete the unwanted path. The remaining part will take place through the partial circumference and in the Center.

  • How to create a circle from the Center?

    Hello. I'm using PS CS3 and I want to create a perfect circle around the Center. How do you do that?

    I know not pressing SHIFT while dragging makes it perfectly round. I also read that pressing alt at the same time he draws in the Center, but it does not work, it just all just with the eyedropper tool. Am I missing something or is there another way to do it?

    Thank you.

    Hello

    If you click and hold the mouse pointer and press the Alt key and drag, it should work.

    In addition, once you start dragging, add the SHIFT key to constrain to a circle.

  • How to create Chinese circles

    I am a novice with illustrator using CS3. I'm trying to create a Chinese circular pattern for my family reunion - see attachment. is there an easy way to do this? can I start with a pattern of right and somehow manipulate it in a circular pattern? any help would be greatly appreciated. Thank you!circle.gif

    Yes. Draw a flat shape.

    Drag it to the Panel forms.

    Choose the model of brush, and then click OK. Then click OK in the second window.

    Now draw a circle, and then click the brush that you did in the Panel forms.

  • can we create a static class in actionscript 3.0

    Hi if yes please send me piece of code.

    Thank you

    Hi Julie,.

    There is not specifically a static class in Flex you can declare it at compile time. However, you can have static variables and methods in your class and you can call them by using the class name itself without creating an instance of this class.

    Here is the piece of code...

    package com.constants
    {
    [Bindable]
    public class ConsumerMessageConstants
    {
    public static const = "10000" UNABLE_TO_ENROLL_PLANS_MESSAGE_ID:String
    public static const "10001"; = MARITAL_STATUS_UPDATED_MESSAGE_ID:String
    public static const "10002" = ERROR_IN_EDITING_MARITALSTAUS_MESSAGE_ID:String
    public static const "10003" = SMOKER_STATUS_SAVED_SUCCESSFULLY_MESSAGE_ID:String
    public static const = '10004 '; PASSWORD_RESET_REQUIRED_MESSAGE_ID:String
    public static const "10005; = ADDRESS_UPDATED_SUCCESSFULLY_MESSAGE_ID:String
    public static const "10006; = UNABLE_TO_REMOVE_THIS_DEPENDENT_MESSAGE_ID:String
    public static const "10007; = EMPLOYEE_SALARY_UPDATED_SUCCESSFULLY_MESSAGE_ID:String
    public static const "10008; = ERROR_IN_EDITING_SALARY_MESSAGE_ID:String
    public static const "10009; = PLEASE_SELECT_A_CONSIDER_PLAN_MESSAGE_ID:String
    public static const "10010" = YOU_MUST_CHOOSE_A_PLAN_COVERAGE_LEVEL_MESSAGE_ID:String
    public static const "10011" = PLEASE_SELECT_PLAN_TO_LOCK_PORTFOLIO_MESSAGE_ID:String
    public static const "10012" = DEEPDIVE_INFORMATION_SAVED_SUCCESSFULLY_MESSAGE_ID:String
    public static const "10013" = NO_DATA_TO_DISPLAY_MESSAGE_ID:String
    public static const "10014" = NO_PLANS_AVAILABLE_TO_ENROLL_MESSAGE_ID:String
    public static const "10015" = NO_PLANS_TO_BE_ENROLLED_MESSAGE_ID:String
    public static const "10016 = PASSWORD_CHANGED_SUCCESSFULLY_MESSAGE_ID:String."
    public static const "10017" = NEW_PASSWORD_AND_CONFIRM_PASSWORD_SAME_MESSAGE_ID:String
    public static const "10018; = YOUR_DATA_IS_UPDATED_SUCCESSFULLY_MESSAGE_ID:String
    public static const "10019" = HEALTH_PLAN_IS_UPDATED_SUCCESSFULLY_MESSAGE_ID:String
    public static const = '10020 '; HEALTH_PLAN_IS_ADDED_SUCCESSFULLY_MESSAGE_ID:String
    public static const = '10021 '; MONEY_PLAN_IS_UPDATED_SUCCESSFULLY_MESSAGE_ID:String
    public static const "10022; = MONEY_PLAN_IS_ADDED_SUCCESSFULLY_MESSAGE_ID:String
    public static const = '10023 '; PROTECTION_PLAN_IS_UPDATED_SUCCESSFULLY_MESSAGE_ID:String
    public static const "10024" = PROTECTION_PLAN_IS_ADDED_SUCCESSFULLY_MESSAGE_ID:String
    public static const "10025" = UNABLE_TO_RETRIEVE_PATHS_MESSAGE_ID:String

    Public Shared function func1 (): Void
    {
    ////

    }

    Public Shared function func2 (): Void
    {
    ////

    }
        
    public void ConsumerMessageConstants()
    {
    }
    }
    }

  • How to create multiple Sources/Classes with a Script

    I'm trying all my java sources or classes, enter a script so that I can pass them all to another server without having to compile each file individually. When I concatenate two files and you try to compile I get an ORA-29536: badly formed source error.

    How can I get multiple definitions into a single file and compile all classes?

    Thank you

    Gregory

    Gregory:
    If you want to download several Java classes in a manuscript of the solution is .sql file, for example:
    ---------------------------------------------------------------------------------------------------------------------
    definition of set?

    create or replace and compile the java source named 'my. Sleep' as
    package my;
    java.lang.Thread import;
    public class {sleep
    Public Shared Sub main (String [] args) survey java.lang.InterruptedException {}
    If (args! = null & args.length > 0) {}
    s int = Integer.parseInt(args[0]);
    Thread.Sleep(s*1000);
    } else
    Thread.Sleep (1000);
    }
    }
    /

    create or replace and compile the java source named 'my. Did app»
    package my;
    public class App {}
    Public Shared Sub main (String [] args) survey java.lang.InterruptedException {}
    System.out.println(args[0]);
    }
    }
    /

    output
    ---------------------------------------------------------------------------------------------------------------------
    Then the .sql file can be analyzed using the tools SQLDeveloper, JDeveloper, or SQLPlus.
    HTH, Marcelo.

  • problem in creating xml import classes.

    I am trying to create a class. In a small trial, I can not succeed to create an instance of my class newly created and import XML data.
    I can import xml data into a prototype, but some how the instance does not receive this info.
    Can someone help me with a suggestion?

    I have a zip with the testfiles (fla, .as, and xml): http://www.flashfocus.nl/forum/attachment.php?attachmentid=5646

    Thanks in advance for the help,

    To remedy this:
    Add a stop() action to the code on frame 1 of the fla.
    Insert a keyframe (framework 5 for example) and add the code:
    Stop();
    trace (asTest1.getProperty1 ());

    Add the last line in the onLoad handler in TestClass.as:
    _root.gotoAndPlay (5); This is line 54 of the code.

    the trace now comes with the correct value

  • Failed to create the DVD__Invalid class string

    This happens in Windows DVD maker and has just started a few days ago, I can't think of any modification of the software just before that, I installed the recommended Codec pack but it was a few weeks ago

    The "invalid class string" problem: it can be solved by repairing the DirectShow filters in the system. Some guys do it manually by editing the registry. But there is a simpler solution: "Codec Tweak Tool" oder "Filmerit. (The first is one of the last and can be used with Windows 7 without problem).

    Codec Tewak Tool (Version 4.9): http://www.codecguide.com/download_other.htm

    Filmerit: http://paul.glagla.free.fr/filmerit_en.htm

Maybe you are looking for