The difficulty to access the get function class

Salvation;

I am writing a flash AIR application.

I have a class of document attached to a FLA to put the elements on the stage, he then instantiated and puts myClass1 one scene. MyClass1 puts more elements on the stage and sets the value of a variable _myValue to . MyClass1 also incorporates a public get accessor function that returns _myValue.

The class of document then instantiated MyClass2, which is a reference to MyClass1passed. MyClass2 must Access _myValue MyClass1.

The structure of following code generates an error. While not exact, the code below should show haw what it has been implemented. I condensed the code to make it understandable.

If you want to see all of the code, I'll try.

DocumentClass.as

package ui {
          import flash.display.Sprite;
  
          public class DocumentClass extends Sprite {
  
                    public function DocumentClass() {
                              var  myClass1:MyClass1 = new MyClass1();
                              addChild(myClass1);
  
                              var myClass2:MyClass2 = new MyClass2(myClass1);
                              addChild(myClass2);
                    }
          }
}

MyClass1.as

package ui {
          import flash.display.sprite;
  
          public class MyClass1 extends Sprite {
                    private var _myValue:int;
  
                    public function MyClass1() {
  
                              //some code to add stuff to the stage.............................
                              _myValue = 10;
                    }
  
                    public function get myValue():int {
                              return _myValue;
                    }
          }
}

MyClass2.as

package ui {
          import flash.display.Sprite;


          public class MyClass2 extends Sprite {


                    public function MyClass2(referenceMyClass1:Sprite) {
                              var ref:Sprite = referenceMyClass1;
                              var myValue:int = ref.myValue();


                    }
          }
}

It gives me an error

MyClass2.as, line 39 1061: call to a method may be undefined for myValue through a reference with static type flash.display:Sprite.

Thanks for your reply. It was one of the problems.

As it turns out another problem was:

public void MyClass2(referenceMyClass1:Sprite)

should have bee

public void MyClass2(referenceMyClass1:MyClass1)

Tags: Adobe Animate

Similar Questions

  • How the get function is available or not on the loaded swf file

    I have 100 swf file in one of my projects. And there is a common feature in some of the SWFs. All these files are loadded in the file main.swf. Here's my Question, "If have the common function is the swf file that is loaded, int how to trigger this funciton of the main.swf.

    Quite simply,.

                if(movieclip.test){
                    movieclip.test();
                }
    

    ('movieclip' is the loaded SWF file and "test()" is the function)

  • The "Get" function does not anywhere in my Dreamweaver CC 2014, why?

    Impossible to have the function of any where in my Dreamweaver and I have the latest latest version!

    Tried anywhere in the workspace, even in the "window" it does not appear!

    Even in "edit > preferences" I don't have a line for 'extract '! Why? And the tutorial at the launch of shows me that I'm supposed to be able to use...

    Thank you

    Hi Mike,.

    You can go to help > about and let know us the version you see?

    Thank you

    Preran

  • Events on the getter/setter function binding

    I found this snippet, when I was walking in a Flex3.6 project:

                    [Bindable(event='currentPageChanged')]
              public function get currentPage ():int {
                   return this._currentPage;
              }
              
              protected function set _currentPage (value:int):void {
                   if (this._currentPage == value){
                        return;
                   }
                   this.__currentPage = value;
                   this.dispatchEvent(new Event(BookEvent.CURRENTPAGE_CHANGED));
              }
    
              protected function get _currentPage ():int {
                   return this.__currentPage;
              }

    What is it meant to do by declaring an event that can be bound above the getter function immediately?

    Thank you very much.

    No, var age: int = classname.age; will be re-run.  But lets think about that for a second, when classname.age is changed, what is the State of 'age', he might be out of range, or specify a different value, and so on.  DataBinding usually manifests in mxml components tied to the data they represent.  If you want to link 'age' classname.age then you must use BindingUtils and implement binding yourself, it is not difficult but can be weird with its syntax in the beginning.

  • How to manage the getter and setter in flex?

    I want to create getter and setter for a shared variable ways. How to create aid may be related?

    and how to call the accessor get and Set of a class of model?

    for ex:

    (1) in the IDMLEditor.mxml file

    [Bindable] public var currentDoc:IdmlDocument = null;

    private var _currentDoc:String;

    [Bindable]

    public function get currentDoc (): {IdmlDocument}

    return currentDoc;

    }

    public function set currentDoc (idmlDoc:IdmlDocument) {}

    this.currentDoc = idmlDoc;

    }

    (2) how to get from EditorModel.as?

    public class {EditorModel}

    [Bindable] public var currentDoc:IdmlDocument = null;

    You don't need to use underscore (_) to access the variable in the getter, setter class. You can immediately access the variable by using the name of the method

    myClass.currentDoc

    That's all

  • Determine the name of class LVOOP? d ' a class of child...

    Hello

    I have a number of modules (classes) that inherit from a base class called "Module".  I have all these in an array of type 'Module', I would like to save some information of each of these modules, but I need to make the distinction between each module.

    Is there a way to determine the class name of the data cable?

    Can I use the flattened string Variant, but I was wondering if it had built in property for this node/function?

    Thank you
    Jonathan

    Examples of joint:

    Malkieri,

    There is no generation in function that does exactly what you are looking for, but you can use the 'Get LV class Path' VI to return the *.lvclass of an object path given.  Using this way, you can either parse the name, or you can use Server VI to get the name of the class, as shown in the picture as an attachment.

    Chris M

  • Don't know how to get rid of the key functions F (_)

    F my laptop (Insert here #) buttons have orders, as put volume up/down, mute, disconnect the wireless business, etc.  I was wondering if I could get rid of their functions.  I play a game that uses them and I can't do certain things without access to the keys F. thanks!

    Hello

    These secondary functions usually require the use of the fn key to access the multimedia functions. Perhaps you have a fn-lock active? Or the key fn itself is blocked?

    Normally, those who are part of the keyboard supporting the driver specific to the manufacturer, so there is little, you can do to remove them.

    Good luck, Rick Rogers, aka "Crazy" - Microsoft MVP http://mvp.support.microsoft.com Windows help - www.rickrogers.org

  • Can we get all the contacts that are in the Blackberry phone using the PIM functionality that is, JSR 75?

    Hello guys,.

    I need to develop an application that should support devices such as the Bold 9700 and Pearl, Storm, Blackberry Curve 8900. If I go for j2me / MIDP, what will be the limits that I face in blackberry? Is it recommended to go for j2me or device-specific development of RIM.

    Can we get all contacts into the Blackberry phone using PIM JSR 75 i.e and other native features features if developing an application in j2me for blackberry. I guess that the user interface will be completely different, but we support all the controls that supports the JDE?

    Is someone can you please tell me if I can get access to all contacts present in the Blackberry phone using 'javax.microedition.pim' API - that is not specific to the RIM. Has anyone tried this one virtually on the phone or emulator?

    Y at - it something like a website where I can test my application on Blackberry devices as in the Nokia Forum Sites?

    Thanks in advance.

    Kind regards

    Raki

    JSR75 is supported

    However, there are some extensions specific "Blackberry" for the base PIM classes. These add a few extension Blackberry PIM data. I think that you can only use the JSR 75 classes as long as you don't need BB extensions.

    For the test, the development environment provides the device simulators.

  • Access the method of class (impl) view of bean object (or vice versa)

    Halo everybody, I use JDeveloper 11.1.2.1.0

    I use a UsersViewImpl class with a method that update the table as below.

    public void resetEmployeeSearch() {}
    removeApplyViewCriteriaName ("viewCriteria");
    executeQuery();
    }

    and I have a UserBean class with a method that reset the values of fields of research such as below.

    {} public void resetInput (ActionEvent actionEvent)
    ........ RichInputText = entry...
    input.setValue("");
    AdfFacesContext.getCurrentInstance () .addPartialTarget (searchForm);
    ........
    }


    I want to implement that, once I press a button, the two methods are called.

    I tried to call method of bean using vs UsersViewImpl = new UsersViewImpl... who does not and will not work.
    I've read about something as ViewObject vo = am.findViewObject ("DeptView1") but I duno how to use because I can't have a good example.

    Any suggestion on access to the method of class (impl) view of bean object (or vice versa)?
    Or is it possible to combine the two method in the same class?


    Thanks :(

    and then create a link to this effect in your page. > Sorry, dun get this part. You create the link from the button to the UsersViewImpl method?
    The code below should be method (binding) in UsersViewImpl, right?
    OperationBinding op = ((DCBindingContainer) BindingContext.getCurrent () .getCurrentBindingsEntry ()) .getOperationBinding ();
    op. Execute();

    What I meant to say call this code your method of bean... this way you can call both the logic in your bean and the method of VO together!

  • access XML data outside the charger function

    Hello

    I want to load my XML, wait the full loading and then be placed to access the XML data loaded in the major part of my program. I do so because I want to load and process, such as XML or superior to 10 in this project... Its here the code that I wrote

    Thanks for help

    import flash.net.URLLoader;

    var c:XML;

    var b:URLLoader = new URLLoader();

    function fxxml(): {URLLoader

    b.Load (new URLRequest ("testxml.xml"));

    Return b}

    fxxml () .addEventListener (Event.COMPLETE, processbase);

    function processbase(e:Event) {}

    var a: XML = new XML (e.target.data);

    trace (a)

    I could find my updated XML here could not access outside this function

    }

    I want to be placed to get the XML here outside the loadin function

    Why did you declare c? Just use it inside processbase, instead of one, and you can use it elsewhere...

    function processbase(e:Event) {}

    c = new XML (e.target.data);

    trace (c);

    }

  • When the Manager of the custom function in a configuration of link file gets error?

    The question she get error when the Manager of the custom function in a config file in the plan to include the link.
    When she went to join the custom function Manager in the debugger, everything is OK.

    <? XML version = "1.0" encoding = "utf-8"? >
    < configuration >
    < custom function platform = "DotNet".
    library-path="G:\RB1\Include\CustomFunctions.dll".
    Class="Viking.CustomFunctions.CustomFunctions"/ >
    < / configuration >

    THS, category and path is correct.
    So is there any problem for < custom function platform = "DotNet"?

    OPA version 10.2

    OPA error message translated from the Germany into English: Exception has been thrown by the target of a call

    In general, you should not give the full path of the custom function, it should be rather in relation to the project include file.

    for example:

    and then make sure that the CustomFunctions.dll file is copied into the project folder until the project is built.

    In addition, if you use 10.2 for a new project, the mechanism that you use is now replaced. An extension of the custom function is the new thing, and it will look much nicer when it is used in the rules. Refer to the section 'Write a Custom function Extension' in aid of developer for more information.

  • To access the data that is loaded by the XML Loader class

    Hi guys,.

    I have trouble accessing the data loaded by external class.

    Here is my code:

    Main class:

    package {}

    import flash.display.MovieClip;
    nucleus of import. XMLLoader;

    SerializableAttribute public class Main extends MovieClip {}

    var projectSetupMainMenuXML:Boolean = true;

    public void Main() {}

    If {(projectSetupMainMenuXML)
    var mainMenuXML = new XMLLoader ("menu.xml");
    }
    }
    }
    }

    XMLLoader class:

    package base {}

    import flash.display. *;
    import flash.events. *;
    flash.net import. *;

    public class XMLLoader {}
    private var mainMenu:XML;
    private var urlLoader:URLLoader;

    public function XMLLoader (mainMenuPath:String) {}
    var urlRequest:URLRequest = new URLRequest (mainMenuPath);
    urlLoader = new URLLoader();
    urlLoader.addEventListener (Event.COMPLETE, completeListener);
    urlLoader.load (urlRequest);
    }

    private void completeListener(e:Event):void {}
    mainMenu = new XML (urlLoader.data);
    e.target.removeEventListener (Event.COMPLETE, completeListener);
    }
    }
    }

    Now, I want to create another external class (called MainMenu) which will be launched from the main class.

    This class should create the menu based on the loaded XML class.

    My question is, how can I make use of the loaded content through the XMLLoader class within the class MainMenu XML?

    Thank you.

    I think you have to use XMLLoader as a singleton - with the properties and static methods. In this way, you can load XML only once and make available XMl data to any object in the application.

  • If I have the first generation iWatch I'll be able to get the update for new applications and look at faces?  I know that I couldn't display or the waterproof function to the water.

    If I have the first generation iWatch I'll be able to get the update for new applications and look at faces?  I know that I couldn't display or the waterproof function to the water.

    Hello

    The next operating system update, watch OS 3, will be available for all Apple Watch models, including the first generation watches.

    We should go out on 13 September, after which it can be installed by following the steps detailed here:

    More information:

    http://www.Apple.com/Watchos/

  • How to get out of the callback function key before it complete the LabwindowsCVI

    Hi all

    In my program I use the command button (called SCAN) to analyze the setting on the serial port. When I press SCAN button callback fuction starts to send command on the series for the scan on the serial port setting. There are 99 order send and read. It takes about 3 minutes. It works very well. Now, I want to stop scanning and exit the callback function that is called by the button SCAN. Now when I press the SCAN button that it completes all 99 recommend and control then come to the interface user. So I'm not able to stop and get out of this loop. Y at - it a why to exit this loop if the user wants to get out? otherwise it will finish the scan.

    -Vishnu

    Hello

    I'll give you 3 options:

    1. If you want to go programaticly you can use simple break when stopping 'event' occur.

    2. If you want to go with a Cancel button, you can use this post:

    http://forums.NI.com/T5/LabWindows-CVI/few-general-CVI-questions-how-the-compiler-works/m-p/1440984

    where I already asked that it is not the recommended option for the panels.

    3. the best option is to use the multi threading separate each button in thread...

  • Why do I get error 200524 for the generating function 2 code example?

    I get the following error message:

    Error-200524 occurred at the generating function 2 channel_lv86.vi

    Possible reasons:

    Scripture cannot be performed because the number of data channels does not match number of channels in the task.

    When writing, provide data for all channels in the task. You can also change the task so that it contains the same number of channels as the written data.

    Number of channels of task: 1
    Number of data channels : 2

    Task name: _unnamedTask

    When I downloaded and ran the 2 channel here code: https://decibel.ni.com/content/docs/DOC-3545

    I have a card pci-e DAQ 6259 and a block BNC-2110

    Why I get this error?

    When I open the VI I selected ' Dev1/ao"under physical channels. I tried all the other options (a0 - a3) which gave the same error message.

    If you have 2 channels in your data (as indicated in the error message), then you must choose 2 channels in your task control (the error message says that you have selected only 1.)

    You saw in the example how they were able to identify the 2 channels of analog output?

Maybe you are looking for

  • iNode files

    Can I safely delete files iNode in lost + found without causing problems to the OS / X?  I have two of these files of more than 5Gigabytes each.

  • Tecra M5 (PTM51E) - where can I find drivers and specifications?

    Hello I bought a laptop Tecra M5 opportunity to a computer recycling company. Now, I'm looking for information on the machine. Unfortunately, the serial number has not been found on the support Web page. How can I get more information that is right s

  • Family tree software does not run on Windows 7, Help!

    I use a PC running XP for my family tree research and wouldn't buy a laptop to facilitate this, but the software I use--Family Tree Maker 2006 - doesn't have a patch of windows 7 and Family Tree Maker say they have no intention to create one, too muc

  • recorded in documents ___folders

    When you save files in 'Documents', you just open a file and documents are everywhere it place, how do you put them in alphabetical order?

  • What allows a sound 5.1 surround

    I am trying to connect a speaker Dell 5650 (5.1) system to a new computer Dell 3847. The computer has 3 audio ports (Mic, Line out, Line in ~ pink, green and blue, respectively). Speakers black, green and yellow color 3 caps. I tried different config