Extending Math class

As I understand, in actionscript 2 you could extend flash's Math class to add your own functions, but this is no longer possible in actionscript 3.  I want to add a mod() function to the Math class, and I'm assuming I have to write a wrapper class to accomplish this.  How do I import the existing Math class into my MathPlus or whatever class?  Also, is there anything else I should know about this?

Thanks for the replies (very good to know about %).  The only reason I would prefer to extend Math or build a wrapper around it is if I were to write a sufficient number of additions such that trying to remember which were in Math and which were in my custom class became difficult.  I just think it would be nice to have access to all of my (and Flash's) math related code within one class.
It just occurs to me that I just need to make functions in my class that call the ones in Math.

Similar Messages

  • Good extended math + utility class

    It has proved surprisingly difficult to find a free "extended" math class for java - all I'm after is a utility class with things like erf, cosh, sinh... things that java.lang.Math lacks.
    I must be doing something wrong, but if some altruistic person could point me in the right direction, I'd be grateful. :)

    this might be even more useless to you, hehe. but you can have a look anyway:
    http://www.jiefei.pwp.blueyonder.co.uk/Computing/Coursework/GraphicCalculator/docs/index.html

  • Why Math class does not have any constructor.

    Math class does not have any constructor.
    But all the classes have a default constructor. Then why the math class is not having any constructor. Is math class having some other constructor or is the default constructor concept applicable only for user defined classes.

    Math class does not have any constructor.
    But all the classes have a default constructor. Then
    why the math class is not having any constructor. Is
    math class having some other constructor or is the
    default constructor concept applicable only for user
    defined classes.You cannot instantiate a new Math object, nor can you extend the Math class. All you can do is use Math's static methods and variables. Its a utility class, thats what its susposed to do.
    JJ

  • Java Math Class

    Looking for a math class method to calculate prime numbers up to 1000 and also perfect numbers up to 1000. Anybody know if one is available ?

    You can try the following if you think it might help:public class MyMaths extends Homework {
        public static int[] primesUpToN(int n) {
            researchTopics.add("Eratosthenes' Sieve");
            researchTopics.add("Prime Numbers");
            addKnowledge(researchTopics.performResearch());
            Algorithm al  = codeAlgorithm(knowledge, skills, resources);
            while (!al.testsSuccessful()) {
                Bug bug = al.debug().getNextBug();
                bug.quash();
            return al.apply(n);
        public static void main(String[] args) {
            System.out.println(primesUpToN(1000));
    }-- Scott

  • ?Is it possible to create a javafx class without extending Application class ? If yes, how

    Is it possible to create a javafx class without extending Application class ? If yes, how ?

      There is no  such thing as a javafx  class.  It is a regular  java class.  The Aapplication class is  the entry
    point  for JavaFX application.  You have to extend the Application class to create Javafx  application .

  • LoadClass    (error loading a class which extends other class  at run-time)

    Hey!
    I'm using the Reflection API
    I load a class called 'SubClass' which exists in a directory called 'subdir' at run-time from my program
    CustomClassLoader loader = new CustomClassLoader();
    Class classRef = loader.loadClass("SubClass");
    class CustomClassLoader extends ClassLoader. I have defined 'findClass(String className)' method in CustomClassLoader.
    This is what 'findClass(String className)' returns:
    defineClass (className,byteArray,0,byteArray.length);
    'byteArray' is of type byte[] and has the contents of subdir/SubClass.
    the problem:
    The program runs fine if SubClass does not extend any class.
    If however, SubClass extends another class, the program throws a NoClassDefFoundError. How is it conceptually different?
    Help appreciated in Advance..
    Thanks!

    Because i'm a newbie to the Reflection thing, i'm notI don't see reflection anywhere. All I see is class loading.
    sure what role does the superclass play when i'm
    trying to load the derived class and how to get away
    with the errorWell... hint: all the superclass's stuff is not copied into the subclass.
    I am quite sure it fails to load the superclass because of classpath issues.

  • Error while extending controller: class name is wrong or not included

    Hi All,
    I am getting this error while I port my extended controller class to the custom top and assign this controller to the page. I have made sure its the class file that is copied. The directory is correct, the permissions were given using chmod 775. There exists a soft link betwen the custom top and the oracle top as well. What else am I missing here?
    Error: oracle.apps.fnd.framework.OAException: Could not create Java class: (oracle.apps.ap.oie.entry.webui.XXEntryFlowPageCO) associated with region: (GeneralInformationPG). This is probably because the class name is wrong or not included in project.

    :( Started out with that Gyan. If i do give the path with xx. appended to it, it lets me save and when i log back in and there are no changes to the page. I go to the personalise option to find the modification has been overwritten. I was told that this is so because Oracle doesnt recognise the xx.path and since there exists a soft link already the standard path with the new controller name should work.
    i have really tried both of these options and am not sure what could be wrong. thanks for all your attempts to help. anything else i can try?

  • Java ME SDK 3.0 Math Class

    Using Eclipse and Java ME SDK 3.0
    When the Application Descriptor configuration is set to use DefaultCldcPhone1 or other emulators in the Java ME SDK 3.0 many of the Math class methods such as Math.sqrt(double arg0) are not available. However if I change the configuration to use a Nokia emulator all the Math class methods become available.
    This issue has just shown up since moving from WTK25 to Java ME SDK 3.0
    Note:
    Under Eclipse/Preferences/Java ME/Device Management the Configuration of all the emulators from the Java ME SDK 3.0 is listed as CLDC-1.0 whereas the other emulators from Nokia and from the Sun Java Wireless Toolkit 2.5 are listed as CLDC-1.1.

    It is related to the configuration of the emulator (CLDC 1.0 or CLDC 1.1)...
    If the configuration is CLDC 1.0 all the floating point data types (float, double, Float, Double) will not be available...
    If you change the configuration to CLDC1.1 , then all the previous types will be available.
    PS: I don't know how to do this in EclipseME

  • Loading external swfs extending from classes in the same shared codebase

    Hey there!
    I'm currently developing a game in flash and want to be able to divide up my .fla assets in a way that means artists can work on a game menu .fla in isolation from the game.fla and rest of the game code.
    If I could briefly explain how I've approached this so far, I would be extremely if people could shout in my general direction and tell me I am stupid, or even better still, give me helpful advice as to where I am going wrong and how I can correct it!
    My project is setup like this:
    HighScoreMenu.fla -> document class HighScoreMenu extending GameMenu class.
    game.fla ->document class game.as
    game.as class loads the published HighScoreMenu.swf and manipulates the menu i.e. animates on and off screen via inherited functions in the GameMenu class.
    Now this seemed to work to begin with, until my code evolved and upon going to publish my HighScoreMenu.fla flash started complaining about symbols being used in Game.as that were in Game.fla...  If I'm only publishing the HighScoreMenu which extends from GameMenu then why is it even looking to compile Game.as?
    Can you spot the problem in the way I am doing this, or is there a better approach I should try?
    Any advice greatly appreciated!
    Stevie.

    No it doesn't seem to, however though they both have a reference to the HighScoreManager so there is some overlap there between menu and game code, but the menu classes don't reference any symbols on the game.fla...
    Just to clarify, I have an fla HighScoreMenu.fla, which has a child symbol HighScoreMenu which uses the following class.
    public dynamic class HighScoreMenu extends GameMenu
         //convenient storage for competition Manager object
         private var _highScoreManager:HighScoreManager;
    The game then loads this class as follows:
    I load the swf "HighScoreMenu.swf" and once its loaded I obtain the menu class like so:
    var cls:Class = Class( applicationDomain.getDefinition("Menus.HighScoreMenu") );
    var object:* = new cls();
    ...and create a new instance of the menu.
    Is there anything fundamentally wrong with approaching it in this way?

  • Not able to pass values to variables in extended Tree class

    Hi,
    I have a as class that extends from Tree, additionally this
    custom class defines
    new class level variables as follows:
    public class MyTree extends Tree {
    public var arrayColl:ArrayCollection;
    and i call this tree from mxml as follows:
    <customTree:MyTree
    arrayColl={list}
    xmlns:customTree="../../.*"/>
    Though my 'list' collections is not null, when i place an
    alert in the constructor of extended tree class
    it shows as null.
    Please advice.
    Thanks,
    Lucky

    below is the canvas:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:mx="
    http://www.adobe.com/2006/mxml">
    <mx:Script>
    <![CDATA[
    import mx.collections.IViewCursor;
    import mx.collections.ArrayCollection;
    import com.citi.ascript.TreeData;
    import mx.controls.Alert;
    import com.citi.ascript.CitiTree;
    public var availableTreeDataColl:ArrayCollection;
    public var selectedTreeDataColl:ArrayCollection;
    public var treeData:TreeData;
    public var srcTree:CitiTree;
    public var availableTreeDataArray:Array = [{a:1},
    {b:2},
    {c:3}
    public function formTreeData():void {
    var tempColl:ArrayCollection = new
    ArrayCollection(availableTreeDataArray);
    availableTreeDataColl = new ArrayCollection();
    for (var i:int=0; i<tempColl.length; i++) {
    var tempTreeData:Object = tempColl
    treeData = new TreeData();
    treeData.a = tempTreeData.a;
    treeData.b = tempTreeData.b;
    treeData.c = tempTreeData.c;
    availableTreeDataColl.addItem(treeData);
    ]]>
    </mx:Script>
    <mx:VBox>
    <mx:Label text="Drag &amp; Drop the analysis sections
    that you would like to include in the report" width="450"
    height="20"/>
    <mx:HBox id="treeContainer"
    creationComplete="formTreeData();">
    <customTree:MyTree treeList={availableTreeDataColl} //
    here collection becomes null.
    </customTree:MyTree>
    </mx:HBox>
    </mx:VBox>
    </mx:Canvas>
    The collection of TreeData is iterated in the customTree to
    form xml which will act as dataprovider for tree.
    and this canvas is added as a child for a panel in my main
    application.
    Hope this gives an idea.
    Thanks,
    Lucky

  • How to map a custom enum list to a custom form property in an extended incident class

    Hi,
    I'm struggeling to understand how to map a custom enum list to a custom form property in an extended incident class.
    Here's what i want to have happen:
    I am going to publish a request offering on my SMPortal for allowing users to submit basic IT incidents. I want the form to include "Whom does this problem affect" (answers(This is the custom enum list): Me, Multiple Users, Whole department or Whole
    company), "What is the problem about", "Description" and "Attachments".
    Here's what i've done:
    In the authoring tool i created a MP for the custom enum list and put only the list in it. I sealed the MP and imported it.
    I created another unsealed MP called TST.Incident.Library for storing incident library customizations and extended the incident class to add an extension class i called ClassExtension_Affected scope with a custom property i called AffectedScope. Then i am trying
    to set the datatype of this property to "list". In the "select a list" dialog i cannot chose my previously sealed MP with the custom enum list in it. Why?
    - Do i need to scratch the sealed MP and put the custom enum list in the latter TST.Incident.Library MP instead?
    - If so, can i do that and keep this MP unsealed, or will i get an error on import saying "Unsealed management packs should not contain type definitions"
    - Should i create one sealed MP for both the custom enum list and the extension class + custom property?

    Hi,
    Authoring Tool simply isn't informed about your list. Open the sealed management pack where you define the root of the list in the Authoring Tool and in the same time open TST.Incident.Library. You will have two opened MPs in the Authoring
    Tool and be able to add a custom list for your custom field.
    Cheers,
    Marat
    Site: www.scutils.com  Twitter:
      LinkedIn:
      Facebook:

  • Abstract class extends other class?

    What happens when a abstract class extends other class?
    How can we use the abstract class late in other class?
    Why do we need an abstract class that extends other class?
    for example:-
    public abstract class ABC extends EFG {
    public class EFG{
    private String name="";
    private int rollno="";
    private void setName(int name)
    this.name=name;
    private String getName()
    return this.name;
    }

    shafiur wrote:
    What happens when a abstract class extends other class?Nothing special. You have defined an abstract class.
    How can we use the abstract class late in other class?Define "Late". What "other class"?
    Why do we need an abstract class that extends other class?Because it can be useful to define one.

  • How to extend a class in same package

    I have a class called LoginBean.java which extends the class ConnectDB.java
    this both files have a statement both the classes are under the directory pmtools.
    and both are included in package pmtools.
    (they both have statement "package pmtools; " at top)
    when i am trying to compile LoginBean.java, it is giving me following error,
    LoginBean.java:7: cannot resolve symbol
    symbol : class ConnectDB
    location: class pmtools.LoginBean
    public class LoginBean extends ConnectDB
    ^
    LoginBean.java:59: cannot resolve symbol
    symbol : variable dbConn
    location: class pmtools.LoginBean
    stmt = dbConn.createStatement();
    ^
    2 errors

    did you compile the other class already? donnow if ithahahaha!!!!!
    ok include the import statement
    import pmtools.ConnectDB;
    in the second class and than compile..

  • Extend base class to customize some properties

    Hi
    Using Jdev 11g
    I need to extend UIGraph class to change the defualt color of pie graph . anyone have a solution to it ? i already extend the class but i donot know what is next steps and what is the method i must to override ??

    Hi frank
    how can i use skinning to change default color of pie chart . for example i have 5 status and count them for every emp but i need specified color for every status ( green for done , red for not done ans so on) if one status missing ( the emp have not (,done status) for example) then the pie color rearranged for other status ???:)). i try to change color in EL but color attr of pie series donot support EL

  • How to Extend Java class in UI Module

    Hi All,
    I am trying to make z for one of the java file GenericSearchDynamicContent.java in the standard package com.sap.wec.app.common.module.catalog.ui.utils. Can anyone please let me know what are steps do i need to follow to extend the same java file in our customer namespace and make use of it.
    Thanks in Advance.
    Regards,
    Rahul.

    Hi Rahul,
    It's upto you whether you want to keep seprate packages for custom changes (then create your own package and keep all the Z class under this) or create a Z_GenericSearchDynamicContent.java and extend this class by GenericSearchDynamicContent.java.
    After doing this you can make your custom changes accordingly and you have to also make the changes in *config.xml (replace this entry GenericSearchDynamicContent by Z_GenericSearchDynamicContent.java.) files as mapping is done there.
    Could you please let me know if you need any further information.
    Thanks,
    Hamendra

Maybe you are looking for

  • How to add increment number to file name properly

    Hi, all: I have a simple question. As shown in the attached code, I need to add an increment number to file name and save the file. The problem is, if you run the code and put something like ".dat" in the extension name, you will see a blank space be

  • How to mantain restriction on condition type range

    Hi, Our sd consultant want to make restriction  on condition type on discount range, under VA01 when we create the sales order, there we give discount, which should fall under some range , say about 1 to 15 not beyond that, please assist how to go ab

  • Termination error when accessing resource tab in project template

    Hi, i am getting error when i am trying do resource in the project template. i have structured the project structure in the template. and i am trying to add roles for the project template but it is showing termination error when i click on "resource

  • Cant edit pdf on ipad anymore - can still edit on pc???

    I created an editable pdf which I was using on my iPad. At some point I stopped being able to edit it on my iPad but I can still edit it on my PC. Any help would be greatly appreciated.

  • Java system error: Exception in method processFunction in BEX Broadcaster

    Hi All, We are trying to broadcast a BI7 Webtemplate with our enterprise portal. While clicking on "Create New setting " iam getting the error " Java system error: Exception in method processFunction ". Detailed error description is *Diagnosis An err