[Noob questions] Model oriented programming OBJECT and event Flex

Hello, I have two very easy questions for an expert - I think.

(1) issue-oriented object

If I have a

UserElement extends the Image

UserImage extends UserElement

UserText extends UserElement

...

UserSomething extends UserElement

Each UserSomething derived from UserElement has an editElement method that can be placed in the superclass UserElement needs to look exactly because in this journal.

Now, from the root of the Application, I have to call the editElement, but I'd rather not be forced to have a giant switch inelegant structure... There is a way to dynamically cast to the right class?

(2) issue of event model

I read the documentation and googled around, but if I have this structure

Application

Canvas1

Control1

Canvas2

CONTROL2

and I send Control1 event, the full path is Application > Canvas1 > Control1 > Canvas1 > Application. But if I need control2 to know that this event is FAILED, the only way I see is to call a method in the Application control2. Is this correct or there is a way to redirect the event in a way to broadcast?

Thanks in advance for anyone who wants to answer

maestro91,

Answer, no, protected Alexander is very good and I used it in this way - protected is visible to inherited classes OK.

You should be able to:

var r: derivedClass;

a = new derivedClass();

function do_something (b: baseClass)

{

test to find out which class that I was adopted, then derived

((derivedClass) b) .editelement ();

above must call the correct method

}

You must explicitly cast to ensure the right call gets shot, but you used baseClass as an argument, so you can send your derived through classes.

Richard

Tags: Flex

Similar Questions

  • remove objects and events

    Hello

    If I do a removeChild on a button, did remove the EventListener or what I have to do this first?

    Harry

    Hey Harry,.

    According to the ASDocs:

    http://www.Adobe.com/LiveDocs/Flash/9.0/ActionScriptLangRefV3/Flash/display/DisplayObjectContainer.h...

    just by using the removeChild() function child objects parent null and property "dissociates" he of the parent object by assigning the value null. If the object is still floating around just, without a parent object and therefore eligible for garbage collection. However, if there is an eventlistener on the abducted child I don't think only one active garbage collected because there is always a reference to this object even if it is not visible. I think that it is confirmed by this line of the doc:


    «.. . the object is garbage collected if no other references to the child exist. »

    its always good practice however, to have your own function dispose() on a class that removes all listeners and sets the object to null. garbage collection in actionscript is not flawless, so I think they recommend that you reuse objects rather than try to remove them and to create later.

  • noobie question about 2 guest OS and virtual HARD disk 1

    I want to know if this is possible and what possible impact, it may cause, as appropriate.

    Set up:

    2 Guest OS in VMware, both using different drives virtual of course since you cannot use the same operating system file invited on multiple instances.

    Then I set up another virtual HARD drive, lets call it SharedMyDrive, and this HARD drive will contain all my data and programs.

    Can I do both guest OS use this SharedMyDrive? (Should be possible with the options of parameters allowing to add more hard drives) but then my question is; How are the data in this manipulated shared HARD drive?

    If I turn both the OS and both of them make changes in SharedMyDrive, it's just a matter of who makes changes that records everything first? It would cause windows errors such as messages "this file is already in use" if I try to delete a file on OS1, but its use in OS2?

    In order to use shared storage, you need an operating system that is aware of this and handle it correctly. ESXi is an example of such operating system. Access to the same storage operating system that cannot manage shared access causes data corruption.

    André

  • Pre-Noob question, Flash Builder for PHP and MySQL... can pack and write?

    So I am COMPLETELY new to Flash Builder and Flex universe, but I'm familiar with PHP / MySQL. One thing that has not been specifically stated to me, is what Flash Builder with (Zend) PHP with the MySQL database when it is packaged and exported? If he did enter the database and is able to execute the query PHP application to the MySQL database within the application?

    I'm confused if she needs to go on the web and communicate with the server. Can he communicate with a LOCAL database?

    Thank you!!

    No Flash Builder package not the final result with data base and

    webserver. To run your application locally you would need to have a

    PHP and Mysql Web server running on your local computer.

    Maybe watch using wamp http://www.wampserver.com

    http://www.imonggo.com/> on your local computer.

    Otherwise I suggest you will probably need to create your program in

    Java who can speak directly to local databases without the need for php.

  • NooB question: Cup titles and a schedule of transfer

    Let's say I have tons of tracks.  In the Middle, I find I want to firm up a few seconds of footage.  I can cut, or delete the clip, but I still have to select all the following clips and make sure they move upward.  There must be a smarter way of removing a few seconds of footage and moving upward?

    Sorry for the noob question, I searched on google and didn't know what to look for.  I am open for more information that can help me to tighten my research thus.  See you soon.

    The answer will probably depend on more factors:

    Are there in your Timeline, Clips above the area of the Clip you want to Trim?

    What you want to happen to those?

    Are you only concerned to "strengthen" the Clips on the same video track where you cut, or Clips on other tracks video too?

    It is likely that the tool Edit Ripple, or Rt-click and Ripple delete, will do what you want, but who can count on the other Clips on other tracks, and video that you need.

    Good luck and please let us know a little more.

    Hunt

  • I'm still not sure how custom control and object-oriented programming interact, can someone enlighten me please?

    I spent some time trying to understand the relationship between the custom controls and object oriented programming. However, it is not quite clear to me yet.

    What I want to do:

    I want to have a custom control and hide its workings from the rest of the blockdiagram, so I don't have to wire for each similar object. Not only because I'm lazy , but also to keep the clean pattern and avoid mistakes.

    for example, a graph, a numerical factor and a button.

    When the button is pressed, the x scale must be changed according to the factor.

    So, this looks like a job for me to object-oriented programming. Once I created something that can do this, I can use it all through my program. The code that redraws the figure when you press the button as part of the object, so I can't connect extra wires and add a value change event when I add a new chart.

    Is this possible at all? I tried, but did not quite understand this time. I have to admit that I'm pretty new to OO programming and make custom controls. I use typedef clusters ' ed most my code so far, which works very well. But it's always a cluster of stupid, the only way to have nothing at all is in the block diagram in VI you use it in.

    The only thing I could come up with so far is to add an "event handler" Subvi who does and that he accepts a reference or a local variable to an object. Then, this sub - VI and the variable or reference can be put in parallel with the other stuff in the main loop of the program. But there must be a better way somewhere?

    I don't think I can solve this problem of definition of the objects of the Panel before custom and methods so that it can interact with the objects that it represents without help. I get the feeling that I must have missed it somewhere. The pointers will be appreciated.

    Thank you!

    Jacco.

    Jacco K wrote:

    What I want to do:

    I want to have a custom control and hide its workings from the rest of the blockdiagram, so I don't have to wire for each similar object. Not only because I'm lazy , but also to keep the clean pattern and avoid mistakes.

    ...

    The only thing I could come up with so far is to add an "event handler" Subvi who does and that he accepts a reference or a local variable to an object. Then, this sub - VI and the variable or reference can be put in parallel with the other stuff in the main loop of the program. But there must be a better way somewhere?

    Thank you!

    Jacco.

    Hi Jacco,

    These two things are exactly what are the Xcontrols, a basic VI with a façade that has an event structure (the façade VI).

    If you have any questions, I'm happy to guide you.

    Tone

  • 'Normal' code and OBJECT-oriented programming code in the same project

    Hi guys,.

    Have large existing application written in ordinary data workflow code.

    Thought to add a new module, but he wrote in OOP - to learn.

    Is it possible to add OBJECT-oriented programming code to an existing project?  If so, it's a good idea or not?  What kinds of things should I be conscious re. mix of types of codes?

    Thank you.

    LVOOP is a natural extension of type-def clusters in libraries, so he has no problem mixing with 'normal' LabVIEW code  The only precaution that I recommend is the following:

    Class libraries always loading all their confined subVIs (called "methods" in the jargon of OBJECT-oriented programming), and the standard libraries of LVLIB always loading libraries contained everything (including class libraries).  This behavior "one thing costs so everthing charge" may be a domino effect through your project with all sorts of unnecessary things from loading.  To avoid this, be careful putting classes inside libraries and don't always put subVIs in classes if they do not need to be (I often have a regular library to hold 'to support' subVIs to a set of classes.)

    -James

  • Queue in object-oriented programming

    Hello

    I'm currently building multiple classes for the different data acquisition devices. What they all have in common, is that they use a 3D array of integer in the data buffer. I want to be able to switch between devices, so I decided to create a VI called "Record.vi" and the use of dynamic allocation to decide what device to call at run time.

    But I don't want a buffer to separate data for each device, so I will try to figure out how to create a more "global" space to save my data. Now, I decided to use a queue for this (as I don't want to LabVIEW to make copies of my table 3D all the time). My question is now how the queues are really handled in object-oriented programming, because in non-object oriented programming, if I create a queue and name it, say, 'data' and create the queue even elsewhere (again with the ' data' as name), I have access to the first queue created and do not get a new one. If I create now, for my problem, a class parent where all devices data inherit from and make a member variable "queue in 3d-table", what will happen? All the data devices that inherit from this class calls the same queue? Or it is duplicated? What is the best way to use common storage place in all the data devices? A global variable in the parent (that is, a static variable) class? Or should I create a 'normal', accessible global variable of all the screws?

    Thanks for the help!

    Christian

    If you do not want the child to use the buffer of parents can create an override for the child who creates his own stamp.

    Named queues the override VI could use its name in the name of the queue.

    For non designated queues, just pass the reference.

    Notes:

    DVR (data value reference) is also another way to share a buffer.

    3-d arrays:

    Unless all dimensions of thre sense I generally avoid them because they rate of N cut into cubes where "N" is the largest of its very small size (or something like that) so just a slice of the buffer bigger (because of processing delays) the blow (voice of experience speaking).

    Ben

  • Navigation in AS3 OBJECT oriented programming Menu does not

    OK, so frame 1 in the timeline/layer, I have this code

    Stop();

    var btn1:MCButton = new MCButton();

    Btn1.x = 1048;

    Btn1.y = 300;

    Btn1.label_txt. Text = "play";

    addChild (btn1);

    Btn1.gotoAndStop (10);

    var btn2:MCButton = new MCButton();

    btn2.x = 1048;

    btn2.y = 380;

    btn2.label_txt. Text = "help";

    addChild (btn2);

    var btn3:MCButton = new MCButton();

    btn3.x = 1048;

    btn3.y = 460;

    btn3.label_txt. Text = "highscore";

    addChild (btn3);

    and now I have a MCButton class (.as)

    package {}

    import flash.display.MovieClip;

    import flash.events.MouseEvent;

    SerializableAttribute public class extends MovieClip {} MCButton

    public void MCButton() {}

    manufacturer code #.

    Stop();

    this.buttonMode = true; a class film btn

    this.addEventListener (MouseEvent.MOUSE_OVER, sensitive); listen for a score event mouse

    this.addEventListener (MouseEvent.MOUSE_DOWN, down); listen for a mouse down event

    }

    private void hover(e:MouseEvent):void {}

    this.removeEventListener (MouseEvent.MOUSE_OVER, sensitive);

    this.addEventListener (MouseEvent.MOUSE_OUT, out);

    this.gotoAndStop (2);

    }

    private void out(e:MouseEvent):void {}

    this.removeEventListener (MouseEvent.MOUSE_OUT, out);

    this.addEventListener (MouseEvent.MOUSE_OVER, sensitive);

    this.gotoAndStop (1);

    }

    private void down(e:MouseEvent):void {}

    this.removeEventListener (MouseEvent.MOUSE_OVER, sensitive);

    this.addEventListener (MouseEvent.MOUSE_DOWN, down);

    this.gotoAndStop (3);

    }

    }

    }

    OK so I want btn1 (which is in my diapers) to frame 10, where I have a different menu for 'easy', 'medium' "hard", I put btn1.gotoAndStop (10); but that doesn't seem to work, so I'm really confused on what im doing wrong.

    Please help me,

    Thank you.

    You can not remove sth. not created:

    removeChild (btn6);

    ...

    var btn6:MCButton = new MCButton();


    you try to remove btn6-9, before they were created

    I understand why you want to do, but you must make sure that the part to be removed is left side first.

    You can do this by ensuring that the button you are trying to delete is really there

    Change each line that removes sth. TO:

    {if(btn6!=null)}

    removeChild (btn6);

    }

    {if(btn7!=null)}

    removeChild (btn7);

    }

    etc.

    Caution:

    Trying to set up a Navigation like this can not be considered good practice to OBJECT-oriented programming.

    That's why I said you should be aiming for a solution that does not rely on navigation of the timeline.

  • (help) how to extend textbox of scene to the method of object-oriented programming

    Hi guys, just a simple question. I have a box of text inside the scene. I just want to know how will access using the methodology of object-oriented programming. Thank you for your help guys.

    Select the textfield and then assign it and the name of the instance in the properties panel. If you do not see an option for this in the properties panel, you must change this setting to be a dynamic textfield.  Once you have an instance name are entrusted to him, you use this name to target for what you want to do with it.  For example, if you call it 'tField', then to give him a text you would use...

    tField.text = "of the text."

  • OBJECT-oriented programming using global vars, best way to do it?

    LS,

    Im a beginner when it comes to OOP.

    Not wanting all through calls to the class, I want to be able to have some application globals.

    Can set their standard package?

    Should I create a static class globals.as with vars?

    What is the right way to do this?

    Any help is greatly appreciated.

    Mac

    first of all, I would say that there are few cases where, you would need global variables, I have not used any in a long time and at the moment, I can't imagine any situation where I would do it. Although saying that it may be the easiest solution if you are new to OBJECT oriented programming.

    If I had to I would use a static class with vars, as you say

  • A matter of OBJECT-oriented programming

    I am new to OBJECT oriented programming, this is probably a stupid question, but if I want to create an app that involves students it is necessary to create a class of studen in as3.0? If so, it is also necessary to call this class when I'm querying data from my db?

    Thank you.

    Well, more like a question of application of an OO one design!

    in any case you do not have to! But it is certainly a good idea to have an object representation of your business domain artifacts.

  • Globals (LV7.1) and the programming of the event?

    I have a problem with a LabVIEW 7.1 application I'm developing.  I've used LabWindows/CVI and used for programming of the event - drivent in the morning.  My request is to and reading data from a dozen test instruments (all types), according to what the user wants to do.  The diagram of the application is a While loop with a Structure of the event inside.  The while loop runs until a "stop" button is pressed, and the structure of the event manages each different instrument.  I initialize all the parameters of the instrument outside the loop so that they have default values, but allow the user to modify them as you wish via one of the events.

    When I first implemented this application, I used the comment nodes and it seemed to work ok, but as the application to expand I came across a problem where the values have been reset after each event.  I thought that maybe the Globals would get around that, so I changed the structure to look like in the attached code (photo for those who do not LV7.1).  However, now the problem is that the value change event does not actually change the values-, they will reset back to default values each time.

    Someone at - it suggestions on how to fix this (or a better way to apply it)?

    Thank you!

    Michael Tracy
    Synergy microwave

    Well, of course things get back to default values. You do not pass the new values for your Subvi SetNums, so it can only display the default values the next time, it's called. The use of globals does nothing. Here is a picture of how the main VI and Subvi can be rewritten. I can't post them as 7.1.

  • Hello.. I'm from the programming, but new to actionscript. I would like to ask if there was a library where all built in functions, methods, and events can be searched. As for VB, MSDN (of Microsoft Developer Network) used to be there. More than once it h

    Hello.. I'm from the programming, but new to actionscript. I would like to ask if there was a library where all built in functions, methods, and events can be searched. As for VB, MSDN (of Microsoft Developer Network) used to be there. More than once it happens that I write a few lines of code, but a built-in function already exists for the same thing. Is there a way to check it out ahead of time?

    An online resource are QAnywhere® to Adobe ActionScript 3 (AS3)

  • Question about the scope of the object and memory.

    I created a class that extends Sprite.

    In this class, I have a private type BitmapData var

    I then add the Sprite as a child to another Sprite on the stage.

    Later, I delete the second Sprite (parent) of the scene and I put the variable referring to it to null.

    After the garbage collection (assuming that it happen correctly) there is no trace of the BitmapData?

    No, unless you did something extra.  If you cannot reference your bitmapdata object (and has no listener), he is eligible for gc.

Maybe you are looking for

  • XP SP3 - slows down several times a day

    There is no running scans Manager tasks indicates the low CPU usage Nothing is using too much memory Taak Manager does not show multiple processes for anything other than shows to multiple instances of a specific application.  This application displa

  • using the wrt54G as access point WiFi for iPod

    I have this Setup:(I'm in a trust of a larger network LAN]. [Campus network: 192.168. *. *]------------------------------|+ [local switch]--------------|+ various machines (in 192.168.10.xxx)+ Pc1+ pc2+ ...+ [Linksys WRT54G] (for WiFi)---------------

  • Design of switching between Nexus7K and active / standby firewall

    In the attached diagram, Nexus7K is used in two ways: on the left side, pair NX7K connects to the firewall as layer 2 trunks. vPC VLAN are shared through resources. The firewall is a pair in Active mode / standby. On the right side, another pair of N

  • How rehide files protected system

    I followed a contributors suggesting to get rid of the CREDHIST FILE and UN marked the 'show hidden files' and the Hide protected operating system files' I need to know how to check these files for protection again. Thanks for your help.

  • Lumetri give me some little weird problem on high contrast clips.

    I got a project PP e-mail file editor.  When he made and export the video, it was happening on its end.  When I visited and export it gives me this weird effect.  I don't know how to solve this problem.  Ive tried to remove effects and re-colouring,