access to objects in other classes

MyApp.as

..

.// make a MyClass class
public var api:MyClass = new MyClass();

// make a MyOtherClass classpublic var object:MyOtherClass = new MyOtherClass();

// make a MyThird classpublic var object:MyThird = new MyThird();

...

MyOtherClass.as:

myButtonWasClicked(e:TypeOfEvent){

//run the method after the event!MyThird.method();

}

MyThird.as is just a library I put to gether... it does nothing but strings of process and things.

My question is how do I access an object (instance of MyThird, called object in the 1st decleration) within a DIFFERENT class, as I do in MyOtherClass.

the idea is that there are separate classes for my project (which are user interface elements mainly) that all need to access this library.  I only have one instance of the library of the MAIN class rather than the instances in EACH class.

Thank you!

Hello

If I'm right, you try to make your class behave as a static class, or in other words, a class that has only one instance during the life cycle of your application.

Although ActionScript has really a static class, you can get the same behavior by using static methods and properties in a normal class. Let's say you have:

package
{
    public class MyStaticClass
    {
        public static const MYVALUE:int = 100;

        public static function MyStaticFunction(): void
        {
            trace("you called that");
        }
    }
}

Then, you can call its methods and properties of any other class, as follows:

MyStaticClass.MyStaticFunction();
trace (MyStaticClass.MYVALUE);

I hope it helps.

Tags: BlackBerry Developers

Similar Questions

  • Access displays the objects within a class defined in a swc file?

    Is it possible to access display objects within a class defined in a swc file?

    To reproduce the problem:

    Step 1. I've set up a very simple FLA with an object defined in the library with the AssetView class:

    package

    {

    import flash.display.MovieClip;

    SerializableAttribute public class AssetView view extends

    {

    public var loader: MovieClip;

    public void AssetView()

    {

    Super();

    trace ("here it is:", charger);

    }

    }

    }

    In this object is a MovieClip with instance name loader. If the object is on the scene when the file is exported, you will see the trace:

    It's here: [object MovieClip]

    Step 2. I used Flash for publishing a swc, called "loader.swc".

    Step 3. I created a new actionscript project in Flash Builder and added "loader.swc" on the way to build ActionScript, the library, with the Type of link: merged into the code.

    Step 4. I instantiated "AssetView":

    var assetView:AssetView = new AssetView();

    I saw the trace:

    It's here: null

    --------

    I tried to delete the project actionscript AssetView class where it became priority during class with the CFC, but I still see no sign on the MovieClip.

    So, my question is, display objects are not accessible in the swc?

    + 1 for siniouse. The class definition does not contain the charger of the instance, but the symbol in the library only. If you need to

    var view: AssetView new MyLibrarySymbolLinkageName() as AssetView;

    What he says is quite likely to happen to you, but I thought I would add my 2 cents in the matter contributed to the clarification.

  • Instance of MovieClip Access on stage in the other classes

    Hello.

    I have the instance of movieclip on the stage.  Instance name qwe of the shiptype.

    I want to access it in other classes EnemyShip.as.

    I tried this.

    MovieClip (this.parent) .getChildByName ("qwe")

    but I got

    TypeError: Error #1034: Type coercion failed: cannot convert flash.display::Stage@26d03041 to flash.display.MovieClip.

    I don't have any class of document.

    Publish settings controlled on automatically declare stage instances.

    y at - it access qwe in EnemyShip.as anyway?

    And here is the link to my flash project:

    http://www.mediafire.com/?kf6uiunys20cyzz

    If the ship is created the instance of the enemy, you can pass the instance of the ship in the object of the enemy when you create it using something like...

    var enemyship: EnemyShip = new EnemyShip (this);

    and in your EnemyShip.as receive you and assign it to a variable, so that you can reference it beyond the EnemyShip function

    public var _qwe:MovieClip;

    public void EnemyShip(ship:MovieClip)

    {

    _qwe = ship;

  • Better way to access a class in reading/writing of several other classes?

    I need run to be retained on a class that gets read and written by the other classes. They share no common ancestor. The reads/writes will be synchronous, so there is no race condition to worry. My idea is to have just the class of all classes that need to access private data and make a 'transfer' between classes, e.g. bundling and unbundling in the classes that need it. This seems very messy. Any ideas?

    I use a data value reference in this situation.  You do just a digital recorder that contains your shared class, and then pass this DVR in all your other items to their initialization.  Given that everyone who needs to change the data has a reference to the data, anyone can modify it within their private methods through a Structure of elements in Place.

  • How to access the values of the object View Other or objects entities

    HelloW.
    I need help, I have the validation of the IUCN IUCN impl methods, I need to access the values of other objects in view o entities to validate.
    How do I?
    Help, please

    Go you to other entities via binding accessors when entities you will access are related by an association. Otherwise to access other objects in the view definition of your needs through accessors from view in the connected user reviews section.

    http://download.Oracle.com/docs/CD/E17904_01/Web.1111/b31974/bcentities.htm#insertedID12

  • To access the objects already on the stage...

    OK, so I'm sorry if it's a very easy thing to do but I have been the subject looking for awhile now and I can't seem to find a way to do this!

    I would like to be able to access some objects that are on the stage before the time of the compilation (e.g. in my .fla file). I can do this property of the document class using the names I have given to them, but I have to be able to do this from other classes (instantiated at run time) too.

    What is the best way to go about this? Can I use the variable placement (this is not probably from what I've read so far) somehow? Or I have to go in the references to these objects in my document class, when I create the instances of the class that needs to access? If so how much better would go to this topic?

    Cheers for any help guys

    mainTL is synonymous with main timeline.

    and Yes, you can access any display object once you have access to a display object.  you just need to use the correct path/name.

  • Transform the query inside cfscript to not access java objects

    When I downloaded my page, now my Web host says my questions to access java objects is not allowed. I can't find out how to change these queries, so that they do not use a java object.

    This is one of my questions. My other questions are in the same format:

    objFactory1 = CreateObject(
    "java",
    "coldfusion.server.ServiceFactory"
    );
    
    // Get the Data Source service from the service factory.
    objDataService1 = objFactory1.DataSourceService;
    
    // The data service object has access to all data sources
    // running on the server. Let's get a connection to our
    // datasource before running the query.
    objDataSource1 = objDataService1.GetDataSource(
    "myapp"
    );
    
    // Open the connection. Here, we have the option to pass
    // in a username and password. Since I am on the dev
    // server, no need to do so.
    objConnection1 = objDataSource1.GetConnection(
    // USERNAME, PASSWORD if needed //
    dsnlogin,dsnpwd);
    
    // Prepare the SQL statement that you want to run. Much
    // harder than the CFQuery tag, but not impossible.
    getevents = objConnection1.PrepareStatement(
    "SELECT " &
    "dtstamp, " &
    "eventname " &
    "FROM " &
    "events " &
    "WHERE MONTH(DATE(dtstamp)) = " & CurMonth & " AND DAYOFMONTH(DATE(dtstamp)) = " & i
    );
    
    // of object that we are all used to working with.
    getevents = CreateObject(
    "java",
    "coldfusion.sql.QueryTable"
    ).Init( getevents.ExecuteQuery() );
    
    // Close the connection.
    objConnection1.Close();
    
    

    I'm back the columns like this: getevents.eventname [intRow]

    I think I got it. Here is the solution for anyone who runs into the same problem

    q = new Query();
    
    q.setDatasource( "myapp" );
    
    // build the SQL statement
    //q.setSQL( "SELECT eventname FROM events WHERE MONTH(DATE(dtstamp)) =  :themonth AND DAYOFMONTH(DATE(dtstamp)) = :theday" );
    
    q.addParam( name="themonth", value=#curmonth#, cfsqltype="CF_SQL_INTEGER" );
    q.addParam( name="theday", value=#i#, cfsqltype="CF_SQL_INTEGER" );
    
    // run the query and get a query object
    getevents = q.execute(sql="SELECT * FROM events WHERE MONTH(DATE(dtstamp)) =  :themonth AND DAYOFMONTH(DATE(dtstamp)) = :theday").getResult();    
    

    Loop over the query results

    for (
    intRow = 1 ;
    intRow LTE getevents.RecordCount ;
    intRow = (intRow + 1)
    )
    
    {
    getevents.eventname[intRow]
    
    }
    

    Not as difficult as I thought, just REALLY long to find the solution.

  • Access to a Java servlet class

    Can make a servlet running on the access of the server has a class defined on server B?
    More information:
    I am new to Java servlet programming and want to make sure that my web application is secure. I've implemented a Java class that returns information from the user (name, address, e-mail etc.) and I put in place of the jsp and servlet pages that access the class through a 'import my.class...» "for servlets and a ' @page import ="my.class... ". ' 'for the jsp. Pages jsp and servlets do session verification and authentication, but the class has nothing of all this - it's methods simply return the requested data. I don't want to put all the identifications in the class, but I want to make sure that there no way to other web servers out there on the internet could access this class in my web application. I don't think it is possible, but my fear is that some hacker out there could do it somehow remotely a @page import "my.class...". "on my Web server and then access my methods of the class? These web applications are run within a Glassfish 3.0 application server.

    Thank you!

    No.. Servlet running on a server can not access anything on server B that are not accessible via HTTP.
    Your class/jar files (and in fact anything under the WEB - INF directory) are not public.

    In fact, if you have WebApplicationA running on the server has WebApplicationB on the same server cannot access the WebApplicationA classes.

    You should not have problems of security in this regard.

    see you soon,
    evnafets

  • Objects of the class defined by the user for an element of the ADF (button, inputfield)

    How to set a class object defined by the user for objects of the ADF?
    My requirement is that when I make a change to the object of the class, it should get reflectected to all instances on my page.
    For example:-I'll have the class object clsInputField, and all my fields entry in my pages are based on this object. So when I change clsInputField it should get reflected to all my controls based on this class object.
    Help, please!

    It's the classic use of a library of component declarative ADF.
    Put your postal code entry filed in an adf library, as well as any other code you will need to manage the entry, pack it as a library of the adf and reuse the item (and its formatting, validation) on each page as you like.
    If you change the component changes are global to all instances of the component.

    Take a look at this demo

    Timo

  • Error: cannot access dead object

    [JavaScript application] Error: cannot access dead object.

    This message appears repeatedly after using Gmail, sign out, close the tab, then open a new tab.

    Uploadd disabling Drag & Drop appeared to be... on my 7 machine. Now for my Vista laptop. Thank you.

  • Access disabled root but 'other '.... "still appears on the login screen

    I went into Preferences > users and disabled root access, but after reboot, 'other... '. "still shows up on my logon screen.   If Root access is disabled, why 'other... '. "still the poster on the logon screen?   I would get to only show my user login on the login screen only.

    If it is greyed out... It is the way that is supposed to be. I don't know any way to remove it. Unless unlock you the lock click on it and click on the negative area. Why would you want to get rid of it. If it is not gray. Click on the lock, click on the user and uncheck the allow to log on to this computer. You will need to enter your password each time that unlock you. This is done in system preferences.

  • I want to access and control my other laptop with wifi.

    * Original title: remote access

    I don't know anything then please help me from 0. I want to access and control my other laptop with wifi. I don't know where to start? Please?  Reference Dell w7 while the other is toshiba w8.

    (Moved from devices and drivers)

    You can do this with Remote Desktop.

    These can be useful:

    Remote Desktop connection: frequently asked questions

    The application of remote desktop help

    Remote Desktop in Windows 8

    John

  • With the help of several classes and create an object of a class and calling its method in a different class.

    Creating a new class, I need to move my main method class SaveDate DynamicTest class. Below I've listed the code of both classes. The goal is to be able to run my class DynamicTest program. I need help to understand the process of moving my main method of a different class and creating an object of a class and calling its method.

    public class {SaveData

    private public static final map < String, Object > myCachedTreeMap = new TreeMap < String, Object > ();

    public static final List < String > getLines (final String resourceParam, final Charset charset) throws IOException {}

    System.out.println ("please:" + resourceParam);

    If {(myCachedTreeMap.containsKey (resourceParam))

    Use the file cached, to avoid a further reading.

    System.out.println ("found in memory:" + resourceParam);

    }

    else {}

    Load the file from the disk

    System.out.println ("found in memory:" + resourceParam);

    }

    Returns a null value.

    }

    Public Shared Sub main (String [] args) throws IOException {}

    String target_dir = "C:\\myfiles\\config\\en";

    Line = "C:\\myfiles\\config\\en\\output.txt";

    File dir = new File (target_dir);

    File files [] = dir.listFiles ();

    If (file == null: files.length < 1) {}

    System.out.println ("file list is empty...");

    return;

    }

    Open the Printwriter

    PrintWriter OutputStream = new PrintWriter (output);

    try {}

    for (textFile file: files) {}

    If (textFile.isFile () & & textFile.getName () .endsWith (".txt")) {}

    readFromDisk (textFile);

    }

    }

    }

    {Finally

    outputStream.close ();

    }

    String fileNameFromCache = "en_synonyms.txt";

    Sheet1 = myCachedTreeMap.get (fileNameFromCache) object;

    System.out.println (fileNameFromCache + ": \n" + "Sheet1");

    }

    @SuppressWarnings ("resource")

    private static Sub readFromDisk(File textFile) throws FileNotFoundException, IOException {}

    BufferedReader InputStream;

    inputStream = null;

    String content = "";

    try {}

    inputStream = new BufferedReader (new FileReader (textFile));

    content = readFile (textFile);

    System.out.println ("bytes read =" + content.length ());

    Save the content

    FileContentsObject Sheet1 = new FileContentsObject (System.currentTimeMillis (),

    textFile.lastModified (), content,

    textFile.getName (),

    getLines (null, null));

    Add to the map

    myCachedTreeMap.put (textFile.getName (), Sheet1);

    }

    {Finally

    If (inputStream! = null) {}

    inputStream.close ();

    }

    }

    }

    private static String readFile(File f) throws FileNotFoundException, IOException, UnsupportedEncodingException {}

    Text of StringBuilder = new StringBuilder (1024);

    read int, N = 1024 * 1024;

    char [] buffer = new char [N];

    BufferedReader br = null;

    try {}

    BR = new BufferedReader)

    (new) InputStreamReader

    (new FileInputStream (f), 'UTF8'));

    While (true) {}

    read = br.read (buffer, 0, N);

    If (read > 0)

    Text.Append (new String (buffer, 0, read));

    if(Read < N) {}

    break;

    }

    }

    }

    {Finally

    If (br! = null)

    Br. Close();

    }

    Return text.toString ();

    }

    private static final class FileContentsObject {}

    private long cachedTime; currentTime

    private long lastModifiedTimestamp;

    private string content

    List < String > lines;

    private String fileName;

    public FileContentsObject (long cachedTime, long lastModifiedTimestamp,

    Content string, String fileName, List < String > lines) {}

    this.cachedTime = cachedTime;

    this.lastModifiedTimestamp = lastModifiedTimestamp;

    This.contents = content;

    this.fileName = filename;

    This.Lines = lines;

    SimpleDateFormat sdf = new SimpleDateFormat ("MM/dd/yy hh: mm :"); ")

    System.out.println ("time & Date:" + sdf.format (cachedTime));

    System.out.println ("' last modification timestamp:" ")

    + sdf.format (lastModifiedTimestamp));

    }

    /**

    *

    * @return the lines of the file

    */

    List < String > getLines() {}

    Return this.lines;

    }

    public String toString() {}

    "return"Sheet1 {}"+" fileName =' ' + filename + '------"+", content = "" "

    + content + "\"+ ", lastModifiedTimestamp ="

    + lastModifiedTimestamp + ', CurrentTime & Date ='

    {+ cachedTime + '}';

    }

    }

    }

    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    public class DynamicTest {}

    Public Shared Sub main (String [] args) {}

    Game characters charset = Charset.forName("UTF-8");

    try {}

    List < String > = CacheData.getLines lines ("en_synonyms", character set);

    If (rows! = null) {}

    System.out.println ("number of rows:" + lines.size ());

    for {(String ligne: lines)}

    System.out.println ("DynamicTest:" + line);

    }

    }

    } catch (IOException e) {}

    e.printStackTrace ();

    }

    try {}

    List < String > = CacheData.getLines lines ("en_stopwords", character set);

    If (rows! = null) {}

    System.out.println ("number of rows:" + lines.size ());

    for {(String ligne: lines)}

    System.out.println ("DynamicTest:" + line);

    }

    }

    } catch (IOException e) {}

    e.printStackTrace ();

    }

    }

    }

    I have read and watched videos about the creation of an object of a class and calling its method in a different class. I'm still confused on how to do it properly. By using the code below if someone can explain how to properly call the method of objects from my hand.

    Huh? You have NOT posted any 'hand' or any 'method of objects '.

    If you need help with the code, you need to view the code.

    The Java tutorials has dozens of trails "Classes and objects": what they are, how to create and how to use them.

    https://docs.Oracle.com/javase/tutorial/Java/javaOO/classes.html

    1. create an instance of a class

    2. call to one or more of the public methods of this class

    If the class has public static methods, you don't need to create an instance first.

    I suggest that you work your way through these tutorials. They include the WORKING example code.

  • How to choose the object that others will line up to?

    Hi I'm attacking with Illustrator, having been familiar with CorelDRAW X 5, and some of the fundamental things in artificial intelligence are just weird!

    A common operation is to have a bunch of stuff I want to align, where I spent the time of positioning on the particular object so I want that everything stays aligned him to this object. I can do it in artificial intelligence?

    For example, I have two rectangles A and B, separated horizontally with a greater than B. I want that the upper edge of the B to align to the top edge. I select A, then B and align top. It works - B moves upward.

    However if I want albums edge to align the top edge of the B, it does not work how I expect. B always moves. It doesn't matter if I choose first or second, B is the one who moves, when A is above B.

    It's frustrating when I have a lot of objects that are carefully aligned, and I want to align a new object with them. What often happens is that all of my objects placed move to align with the Unplaced object, so I spend a lot of time.

    Y at - it a simple way to choose the object that others in the choice of align on? In CorelDraw, it's the last selected object that determines how many others will be moved.

    Thank you

    Rob

    Select all the objects you want to align, and then click again on the object of the selection you want that all the others will match (object key).

    the key of the object will appear thicker than others.

  • Why public role to access the object sys/system to all users

    Hello
    I'm trying to find out
    What is logical to give access to these system sys objects / to
    everyone through public role. Why does everyone need to access these objects system/sys.

    Should we revoke this public access or leave them alone.
    What is the use of these tables.

    SYS AUDIT_ACTIONS
    SYS AW$ AWCREATE
    AW-SYS $AWCREATE10G
    SYS AW$ AWMD
    SYS AW$ AWREPORT
    SYS AW$ AWXML
    AW-SYS $ EXPRESS
    DOUBLE SYS
    SYS IMPDP_STATS
    KU SYS $ NOEXP_TAB
    KU SYS $ _LIST_FILTER_TEMP
    SYS ODCI_SECOBJ$
    SYS ODCI_WARNINGS$
    SYS OLAPTABLEVELS
    SYS OLAPTABLEVELTUPLES
    SYS OLAP_OLEDB_FUNCTIONS_PVT
    SYS OLAP_OLEDB_KEYWORDS
    SYS OLAP_OLEDB_MDPROPS
    SYS OLAP_OLEDB_MDPROPVALS
    PLAN_TABLE SYS $
    SYS PSTUBTBL
    SYS STMT_AUDIT_OPTION_MAP
    SYS SYSTEM_PRIVILEGE_MAP
    SYS TABLE_PRIVILEGE_MAP
    WRI SYS $ _ADV_ASA_RECO_DATA
    DEF SYSTEM $ _TEMP$ LOB
    HELP SYSTEM
    MVIEW SYSTEM $ _ADV_INDEX
    MVIEW SYSTEM $ _ADV_OWB
    MVIEW SYSTEM $ _ADV_PARTITION
    SYSTEM OL$
    SYSTEM OL$ HINTS
    SYSTEM OL$ NŒUDS

    PL see also these Docs MOS

    Be careful when the revocation of the privileges granted to PUBLIC Document Id [Document 247093.1]
    Default privileges assigned to Id of Document PUBLIC [Document 759684.1]
    Invalid objects after revocation RUN Id of Document PUBLIC privilege [Document 797706.1]
    AUDIENCE: Is a user, a role, a group of users, a privilege?          Document ID [Document 234551.1]

    HTH
    Srini

Maybe you are looking for

  • Autorun YouTube

    I left a youtube video that open in a tab I update every time it runs automatically. It only started happening. I want to refresh to see how the views she had. Running video, it distorts the figures. I have flashblock installed as an add on How can I

  • Allmytube and El Capitan Wandershare

    Upgrade to El Capitan (10.11.5) and (9.1.1) as a result of the upgrade OSX Safari. My Wondershare AllMyTubpe version 5.7.0 freezes when you download a video from Youtube and the Youtube upload function does not work. Any idea?

  • eror 646

    Works of eror 646 for that I can't install the update vista 32

  • Long boot

    It takes my computer 3.5 minutes to achieve the status of office.1 full minute to reach the Windows screen then balance of time a white screen appears.

  • Instrumentation of Java - Applications successful Capture

    Hello Question 1 I need help to identify why some requests are not captured by the Instrumentation of Java and a work around for the same thing. I recently instrumented WebSphere application servers for a new Application. However, I am unable to see