Pass a variable to the main class to a MovieClip

Hello!

I have a document with the main class.

I have also a few clips that have their own class and functions.

I'm trying to pass a variable in my main class to one of these clips.

I tried a few things, nothing has worked.

Who can help?

Match_Easy looks like a class name.  You must use the name of the instance.

Tags: Adobe Animate

Similar Questions

  • fieldChange get variables from the main class

    I'm doing a simple calculator that users enter numbers, press on calculate, and the answer is displayed in the status bar.  The problem I have is that when I try to get the EditFields values in the fieldListener, I get an error that says that the variable was not found.  Here is an example of the code that I have:

    public class MyScreen extends MainScreen {
        public MyScreen() {
            super();
            LabelField title = new LabelField("Automotive Loan Calculator", LabelField.ELLIPSIS | LabelField.FIELD_HCENTER);
    .
    .
    .
            EditField sell = new EditField("Selling Price: $", "", 10, EditField.FILTER_REAL_NUMERIC | EditField.FIELD_RIGHT);
    
            EditField taxrate = new EditField("Tax Rate: ", "", 5, EditField.FIELD_RIGHT | EditField.FILTER_REAL_NUMERIC);
    .
    .
    .
    ButtonField button = new ButtonField("Calculate Payment", ButtonField.FIELD_HCENTER);
            CalcButtonListener calculate = new CalcButtonListener();
            button.setChangeListener(calculate);
    .
    .
    .
     final class CalcButtonListener implements FieldChangeListener {
            public void fieldChanged(Field field, int context) {
    
            String sellData = sell.getText();
            float sellVal = 0;
            if (sellData != null && sellData.length() > 0) {
                sellVal = Float.parseFloat(sellData);
            }
            String taxrateData = taxrate.getText();
            float taxrateVal = 0;
            if (taxrateData != null && taxrateData.length() > 0) {
                taxrateVal = Float.parseFloat(taxrateData)/100;
            }
    
            total = sellVal * taxrateVal + sellVal    
    
                LabelField newpmt = new LabelField("Total: " + total, LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH) {
                public void paint(Graphics g) {
                    int x=  g.getColor();
                    g.setColor(Color.GRAY);
                    g.drawRect(0,0,this.getWidth(), this.getHeight());
                    g.fillRect(0,0,this.getWidth(),this.getHeight());
                    g.setColor(Color.WHITE);
                    super.paint(g);
                }
            };
            setStatus(newpmt);
    
            }
        }
    

    Nevermind, I figured it.  I forgot to set them in my code.

  • Passing an object of the UiApplication class reference

    Hi all

    I am very new to the development of BB and have struggled for hours on something that I think should be very simple. What I have, this is the main class that extends UiApplication and a second class that implements Runnable. From a method in the UiApplication class, I create an instance of the Runnable class. After that, I call a method to start from this class and pass an object originally from the UiApplication class reference - so that I can call a method, once completed the processing of the Runnable class.

    The problem I have, is that once past the object through a call to method reference, the reference instantly cancels and causes a NullPointer exception when trying to call a method in the original class. The structure is as below, but with all the surrounding code subscribed:

    public class MainApp extends UiApplication {
    
        MainApp _MainApp;
        OtherClass _OtherClass;
    
        public static void main(String[] args) {
        MainApp _MainApp = new MainApp();
        _MainApp.enterEventDispatcher();
        }
    
        private void createOtherClass() {
            _OtherClass = new OtherClass();
            _OtherClass.someMethod(_MainApp);
        }
    
        public void response() {
            // code here
        }
    }
    
    public class OtherClass implements Runnable {
    
        MainApp _MainApp;
    
        public void someMethod(MainApp MainAppRef) {
            _MainApp = MainAppRef;
            // _MainApp object reference is null here
    
            new Thread(this).run();
        }
    
        public void run() {
            // stuff here
            // once done, call a different method
            sendDetailsBack();
        }
    
        public void sendDetailsBack() {
            _MainApp.response(); // causes a NullPointerException
        }
    }
    

    I rewrote this to only show the code at the source of the problem. I don't quite understand why the object reference is not passed correctly - I have tried many other ways to call back to the UiApplication function, including static calls.

    Any help on how I do it is very appreciated!

    Will be

    I suspect that your problem is here:

    MainApp _MainApp = new MainApp();

    I think you meant just

    _MainApp = new MainApp();

  • error message "cannot load the main class.

    I ran windows update yesterday and installed the recommended updates, restarted my laptop today the error message "Unable to load the main class" appears in a box and I couldn't do anything until I had closed this box, after the loading of firefox it displays a message not responding, then a bar indicating that plugin adobe did not start successfully so I clicked to reload page Then, I rebooted my laptop to see if this solves the problem, but the same error message appeared and firefox have responded in the same way, someone has an idea how I can fix this problem?  I run anti-virus software and malware from comodo and my OS is windows vista 32. I also downloaded an update for adobe flash yesterday but the problem has not produced until after I had done the updates of windows.  Thank you

    Hello Fiona,

    Thank you for your response.

    You are facing this problem might because of Java program on your computer.

    I suggest you perform the clean boot and check the status of the issue, which will help you identify the problem.

    Keep the computer in a clean boot and check the status of the issue. If everything works well after a clean boot, you can deduce that some third-party services are at the origin of the problem. Continue with the remaining steps to pin-point on the third party service. After find you the program that is causing the problem, you will have to perhaps to update or install a newer version of the program, if you rarely use that you should consider uninstalling the software.

    How to perform a clean boot for a problem in Windows Vista, Windows 7 or Windows 8.

    http://support.Microsoft.com/kb/929135

    Note: please go through the section:How to reset the computer to start as usual after a clean boot troubleshooting section of Kb to start the computer to a normal startup after you fix the problem.

    Hope his helps.

  • Could not load the manifest attribute of the main class of C:\program files\frostwire\commons - connect

    original title: I need to know what means this message and I can remove it from my computer

    doess someone knows what this message means? Could not load the manifest attribute of the main class of C; \program files\frostwire\commons-logging, pot every time I look at this subject in my file, it appears, I'm not good at all with computers but I know im short-term memory or space on this computer and I tried to go into my programs and delete, can you please help me understand what I can and can not delete to give me more space? Thanks, im running Windows Vista! If you would like more information, I'm sorry, just ask me? Thanks again, I hope someone can help me! :(

    This discussion forum on Microsoft Security Essentials antimalware. You can get help in the Microsoft Vista answers forums - http://answers.microsoft.com/en-us/windows/forum/windows_vista

    Jim

  • "Could not find the main class" Java error on Windows 7, but not Windows XP

    Hi all

    It's the first app I try to package and virtualize with ThinApp.

    It is an old business application that usually runs on Windows XP SP3 x 86.

    The. MSI that I generated with Thinapp works very well when it is installed on a Windows XP SP3 x 86.

    However, our main goal to use Thinapp is to install on a Windows 7 SP1 x 64.

    But in doing so, the application triggers a Java Virtual Machine Launcher error message saying: "could not find the main class. Program will exit. »

    I thought that it was because the app includes a 1.4.2 JVM and that my XP has not any JVM pre-installed, but the main image on my W7 has a 1.7 JVM. But even after I uninstalled the 1.7 and installed JVM 1.4.2 on the W7 machine, I kept getting the error message so I guess that it is not bound.

    Y at - it an option that I missed during my MSI generation so that it can run on a Windows 7 x 64?

    Thank you all for your help.

    D.

    With the help of Lachi, we found that the app natively works on W7, no need for ThinApp it if the goal is just to make it work on W7, from a XP world.

    The only change we had to make (and the error was the same ThinApp-ed, which is what I originally shared) is that the application should work with Windows 7 in "classic" mode "of the screen (without Aero and the menu start XP-style). This is because the application runs an old integrated version of Java (1.4) and it makes the system calls seeking specific .dll to display, which are not accessible by default if Aero is enabled.

    Closed topic

  • How can I access a variable on the main timeline of a movie nested in HTML5 Canvas

    Hello

    This should be pretty simple, but for some reason, it does not work if I have the wrong syntax.

    But I have a movie clip with a bit of code in it.

    It is a timer.

    I want to be able to program the wait time: since the main scenario and that the timer read this variable on the main timeline.

    I implemented the delay var = 1000 on the main timeline, but then I do not seem able or knows how to get this variable in my code in the nested MC. It is quite difficult to find the reference of the paradigm flash timelines on H5 support pages, so I really appreciate the help.

    tl2 var = this;

    TL2. Stop();

    var delay = delayMain;

    var startTime is createjs. Ticker.getTime ();

    createjs. Ticker.addEventListener ("tick", f);

    {function equation

    If (createjs. Ticker.getTime () - startTime > delay) {}

    TL2. Play();

    createjs. Ticker.removeEventListener ("tick", f);

    }

    }

    If you want to get to a variable defined by a feature any at any depth, you can use the window. As:

    Window.Delay = value;

    in a deeply buried movieclip, can be read in any other level of the project.

  • The main class is not found

    Hi all
    I am facing problem when I try to create the JAR file.
    After creating the Jar file I tried to run but error message
    Main class not found.

    I follow these steps
    (1) my WordNetOK.java
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.util.Scanner;
    import edu.smu.tspell.wordnet.*;
    
    
    public class WordNetOK{
    
        public static void main(String args[]) throws FileNotFoundException {
    
    System.setProperty("wordnet.database.dir", "C:\\Program Files (x86)\\WordNet\\2.1\\dict\\");
    WordNetDatabase database = WordNetDatabase.getFileInstance();
          String result = "";
            NounSynset nounSynset;
            NounSynset[] hyponyms;
       
            //creating File instance to reference text file in Java
            File text = new File("C:/javacode/WordNetin.txt");
          
            //Creating Scanner instnace to read File in Java
            Scanner scnr = new Scanner(text);
          
            //Reading each line of file using Scanner class
            int lineNumber = 1;
            while(scnr.hasNextLine()){
                String line = scnr.nextLine();
          Synset[] synsets = database.getSynsets(line);
          for (int i = 0; i < synsets.length; i++) { 
          String[] wordForms = synsets.getWordForms();
         for (int j = 0; j < wordForms.length; j++) {
    System.out.println(wordForms[j]);
         }
              }

    //System.out.println("line " + lineNumber + " :" + line);

    lineNumber++;
    }

    }

    }
    2) Javac WordNetOK.java
    
    it create a class file
    
    3) i create Manifeast.txt 
    Main-Class: WordNetOK
    4) i run this
    C:\Javacode > jar cvfm WordNetOK.jar Manifest.txt WordNetOK.class
    Adding manifests
    adding: WordNetOK.class(in = 743) (out = 435)(deflated 41%)
    5) i tried to execute it as * java -jar WordNetOK.jar *
    
    But error appear could not find main class
    C:\Javacode > java-jar WordNetOK.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: WordNetOK
    Caused by: java.lang.ClassNotFoundException: WordNetOK
    in java.net.URLClassLoader$ 1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged (Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    to Sun.misc.Launcher$appclassloader$ AppClassLoader.loadClass (Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    The main class is not found: WordNetOK. Program ends.

    C:\Javacode >
    Note : i execute the classpath at beginning
    set PATH = C:\Program Files\Java\jdk1.6.0_32\bin;
    set the classpath = C:\Program Files\Java\jdk1.6.0_32\bin;\javacode.
    Edited by: Ayham on Apr 6, 2013 7:39 AM
    
    Edited by: Ayham on Apr 6, 2013 7:41 AM
    
    Edited by: Ayham on Apr 6, 2013 7:45 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        

    Why are you creating your own manifest file? Let just for you Java.

    It works for me using 1.6

    C:\Javacode>jar cfe WordNetOK.jar WordNetOK WordNetOK.class
    
    C:\Javacode>java -jar WordNetOK.jar
    Hello World.
    

    Generally, you should leave a tool (e.g., Netbeans, Ant) create the manifest because they know how to do it properly.

  • How to pass a variable to the nearby operator

    Hello! does anyone know how can I pass a variable to the proximity operator?

    with this query variable1 and variable2 are read as words, not as variables.

    SELECT *.
    FROM t1
    WHERE CONTAINS
    (essay, "near ((variable1, variable2), 1)'") > 0;

    Thank you!

    Best regards
    Sara

    You may not use a link within a string variable. This is not a restriction of Oracle text, it's just the way bind variable work in Oracle.

    You can build a string literals and variables, although, like this:

    SELECT *
    FROM t1
    WHERE CONTAINS
    (test, 'near(('||:variable1||', '||:variable2||'), 1)') > 0; 
    
  • How to set a variable in the main timeline of in a symbol?

    Just get started with Animate and coming from Flash, it may be apparent to my question. How do you define a variable for the main timeline of in a symbol?

    I have 24 pairs of clickable elements, each in their own symbols, and 24 of these symbols to sit inside another symbol. I want every 24 to set the global variable even when you click on it. I do not find that this question is anywhere, which makes me think that I can be stuck in a mentality from Flash and approaching the task in a bad way. (However, there are MANY discussions address showing how objects to different levels in the hierarchy.) Which is well covered).

    By the way, how to access a function on the main timeline of in a symbol?

    Adobe should consider putting on foot (or pages) support just for people migration form Flash. In the documents that I've met so far there seems to be a studied effort to refrain from mentioning Flash somehow. I imagine that there are many people out there like me who have a deep background in coding Flash, but start with Animate. We don't need help with most of the basic concepts, but we still have some pretty basic questions on how to achieve certain things in Animate because our knowledge of Flash gets in the way.

    Hi Bill,

    There are a lot of discussions here on the scope, but here's a way to create a global variable:

    code on Stage.compositionReady

    sym.myGlobalVar = 1;

    Then, anywhere in your project, you can check/set this var as follows:

    sym.getComposition () .getStage () .myGlobalVar = 2;

    And here is a way to create a global function:

    code on Stage.compositionReady

    sym.myGlobalFunction = function() {}

    Console.log ('myGlobalFunction');

    }

    Then, anywhere in your project, you can call this function as follows:

    sym.getComposition () .getStage () .myGlobalFunction ();

  • How can I build and pass a variable to the function getField?

    I need to know how to build and pass a variable to the function getField():

    I have a form of several sections similar to a spreadsheet.  Each section contains 5 rows of 11 columns.  Currently I have calculations in the field I want to consolidate and move to the level of the document.  The field names in each column are identical except for a row identifier.  For example, in the 1st row: a_debtType1, a_debtTerm1, adebtRate1, etc.  I want to be able to pass to a function of level document line identifier and that connect a function "getField.  Here is an example:

    Document-level:

    function calculateLoan (lineNumber) {}

    var myDate = getField("a_debtType"+lineNumber).valueAsString;

    var myDate = getField("a_debtTerm"+lineNumber).valueAsString;

    .. few treatment

    return

    }

    Level of the form:

    change the information in the form is ready for line 1

    function calculateLoan("1");

    Thanks in advance for any help.

    It seems good except how you call the function of what you have. The calculation script should be something like:

    Custom calculate script

    calculateLoan("1");

    Note that you can also get the line number if it is contained in behalf of the field that calls the script if you don't disturb him passing as parameter, assuming you named the fields correctly.

    For example, to calculate the field is called "row_total.1", you can get the line number in the script like this:

    var no_lig = event.target.name.split(".") [1] ;

  • The main class is not found: HelloWorldSwing

    First lines of the file "HelloWorldSwing.java".
    package start;
    import javax.swing.*;
    public class HelloWorldSwing {
    I've successfully compiled the file.
    When I type the following command
    C:\>java HelloWorldSwing
    I get the following error Message:
    Could not find the main class: HelloWorldSwing.  Program will exit.
    I'm sure that the absolute path of the file is:
    C:\start\HelloWorldSwing.Java
    and I issued the command of
    C:\

    Your class is in a package. Its fully qualified name is start. HelloWorldSwing

    DB

  • access the property of the main class in loaded swf.

    Hello

    I have a main.fla, its document class is main.as. the code in main.as is

    package

    {

    import flash.display.MovieClip;

    SerializableAttribute public class Main extends MovieClip

    {

    private var loading: loading;

    public var trovami:Number = 10;

    public void Main()

    {

    stage.frameRate = 31;

    loadSWF();

    }

    private function loadSWF (): void

    {

    loading = new Loading (this);

    }

    }

    }

    LOADIND. ACE is another class where I load another swf name is my_swf.

    class loading code is:

    package

    {

    import flash.display.MovieClip;

    to import flash.display.SimpleButton;

    import flash.text.TextField;

    import flash.display.Loader;

    import flash.events. *;

    import flash.net.URLRequest;

    SerializableAttribute public class loading extends MovieClip

    {

    private var _fla:MovieClip;

    private var url: String;

    public var val: String;

    private var loader: Loader;

    public void Loading(fla:MovieClip)

    {

    _fla = fla.

    init();

    }

    private function init (): void

    {

    URL = 'my_swf.swf';

    var request: URLRequest = new URLRequest (url);

    loader = new Loader();

    initListeners (loader.contentLoaderInfo);

    Loader.Load (request);

    }

    private void initListeners(dispatcher:IEventDispatcher):void

    {

    dispatcher.addEventListener (Event.COMPLETE, complete);

    }

    private void completato(event:Event):void

    {

    _fla. AddChild (Loader);

    Loader.y = 10;

    Val = "Hello".

    }

    }

    }

    and the class of the loaded swf document is Main2. in my_swf.fla, there is a text, that his name is:

    a_txt.

    I so use class in Main2 for loading text property.

    Code of Main.as is

    package

    {

    import flash.display.MovieClip;

    import flash.text. *;

    Main2/public class extends MovieClip

    {

    public void Main2()

    {

    a_txt.text = val;

    }

    }

    }

    where val is the property of class loading.

    so, how do I access.

    You have a reference to your movie loaded into your class loader - instead of simply set val to string - add a method in your class Main2 - and call it loading - passing the string which him. Push not pull...

    Hand 2 becomes:

    public void Main2() {}
    a_txt. Text = Val;

    }

    public void setText(val:String):void {}
    a_txt. Text = val;

    }

    And then in your class loader - when you have finished loading only call setText:

    private void completato(e:Event):void

    {
    addChild (loader);
    Loader.y = 10;
    MovieClip (loader.content) .setText ("hello");
    Val = "Hello";
    }

  • Define the main class in the project

    Hi, I have a project in Eclipse with several main methods as I test different things. My question is: How can I change the main method of the project? Because Eclipse is still running the same major and I want to run the code using different network. Thank you

    Greetings.

    For the record, make sure you have only one main method that serve as the entry point for the application.

    But like you said that your goal is now to make a quick test, do a right-click on the class that contains the entry point (main method) you want to test, click on run as-> Blackberry Simulator.

    Make sure that the class you are testing extends the request or UiApplication in order to run it. Otherwise, this entry point will be useless at all.

    In case you want to define an entry point for the project, just delete all the alternative entry points (main methods).

    Good luck. I hope this helps.

  • Hello. How can I pass a variable as the name of file in writeStringToFile.

    When I try to pass a variable as writeStringToFile it is ignored.

    For example:

    getVariables () .set ("ts", "{{@today (YYYYMMddHHmmss)}}", Variables.Scope.GLOBAL);

    Path String = "C:\\OracleATS\\OFT\\Databank\\";

    String file = "test .csv {{ts}}";

    String completedOrders = path + file;

    Info (completedOrders);

    utilities.getFileService (.writeStringToFile) (file, "CreatedDate, customer, iteration, OrderNumber" + "\n");

    In the previous case.

    a. the console returns the correct file name: C:\OracleATS\OFT\Databank\test20151005133343.csv

    b. the file system will not be: test .csv {{ts}}

    Thank you for taking the time to consider the issue. I found another way to achieve this. It must be as follows:

    Import:

    import java.util.Date;

    import impossible;

    Format of date as follows:

    Path String = "C:\\OracleATS\\OFT\\Databank\\";

    String file = new SimpleDateFormat("'scriptOut_'YYYYMMddHHmmss'.csv'").format (new Date());

    String completedOrders = path + file;

    Info (completedOrders);

    utilities.getFileService () .writeStringToFile (completedOrders, 'CreatedDate, customer, iteration, OrderNumber "+" \n");

Maybe you are looking for

  • Satellite L10-202 guarantee

    I buy 1-3 years warranty extension, but when I check warranty status sound still 1 year.

  • Line and microphone input

    Hi, I want to know if I can use the output port as input in a 2010 Macbook Pro 15' or how to line it with a microphone. Thank you

  • Sub - VI does not open (error 3 could open the front panel)

    I work for the VI (the version of Labview 2011 trail), I created a Subvi. At the same time, I opened this Subvi to adjust terminals connection - what I've done before - and after saving the file and its closure, the Subvi is remained unadjusted. In f

  • Excell

    I try to import data into an Excel worksheet, no title or text, fair values.  I tried to use playback frpm spreadsheet, but all lines and first line outputs remain at 0... does anyone know of an effective way to import data from Excel?

  • Windows Aero problem

    I've had my dell laptop inspiron about 3 years ago. It runs on windows vista. Since I used it first, windows aero is enabled and works perfectly includingtransparency. Yesterday, I tried a new theme for my computer and now my computer won't let me co