? Derive a clicked button's 'level' and instance  name?

I am trying to do something that I did quite often in Flash.
When a button is clicked, I need to understand it's instance name
and heirarchy as the application would identify it when looping
through the DisplayList.
For example, if a button, 'myButton', is clicked on in the
application ' myApp', I need to get its programatic name as
referenced by the application with 'myApp0.myButton'.
In Flash, with AS2, I could have the button tell me its
programatic name with:
myButton.onRelease=function(){
trace(this);
The result in Flash would be '_level0.myButton';
How can I get this type of informtion with Flex? Is it
different with MXML and AS3?
For reference, I am using a similar function to that below to
'index' the list of objects in Application.application:
function traceDisplayList(container:DisplayObjectContainer,
indentString:String = ""):void {
var child:DisplayObject;
for (var i:uint=0; i < container.numChildren; i++) {
child = container.getChildAt(i);
trace (indentString, child, child.name);
if (container.getChildAt(i) is DisplayObjectContainer) {
traceDisplayList(DisplayObjectContainer(child), indentString
+ " ")
Any information and examples would be appreciated.
Thank you.

Ok, I found a partial solution, but I could still use some
help with event listeners. The solution I found is:
Within Flex, on a button click, the application can list the
click target when an event is called. So, when a user clicks a
button, in the 'click' action of the button, the following code
will return the object information I was looking for.
<mx:Button label="myButton"
click="trace(event.currentTarget)"/>
Now I am interested in seeing if I can dynamically "listen"
for clicks without adding an event command to the buttons. For
instance, on the button above, I can have the button tell me its
name, as shown above, or I could listen for the click and derive
it. For example:
<mx:Button label="myButton"
click="trace(event.currentTarget); sayName(event)"/>
Then I can have AS code listening for that event:
private function sayName(event:MouseEvent):void {
trace(event.currentTarget);
The problem with the listener solution 'sayName', is that it
requires a button to pass the event to 'sayName()'. I am really
looking for a solution which listens for ANY button click, checks
to see if it is a button, or a text link, or any object that might
act as a button (as opposed to a graphic or movie without 'semantic
events' with the application performing a resulting action).
So this is what I have tried:
In an AS Class, I added the following to the main class
function to initialize it:
addEventListener(MouseEvent.CLICK, clickHandler);
addEventListener(MouseEvent.DOUBLE_CLICK,
doubleClickHandler);
Then, within the class I added the following functions:
//possible event listeners?
private function clickHandler(event:MouseEvent):void{
var tempES:String = "type : "+event.type+" objectName :
"+event.currentTarget;
trace(tempES);
private function doubleClickHandler(event:MouseEvent):void{
var tempES:String = "type : "+event.type+" objectName :
"+event.currentTarget;
trace(tempES);
I get nothing. I suspect that I get no results because the
Application has the buttons and these listeners are not referencing
the application properly to listen for button clicks.
Am I off base? Can anyone help me understand how to listen
for click activity and get the object information even though the
listener code is in an imported class?
Thank you

Similar Messages

  • Buttons null; losing stage instance names

    Hello, I apologize if this question has already been asked but as the title states I'm having problems with the instance names of my buttons. I am using Actionscript 3 with Flash CS5. I apologize in advance for being verbose but it'd be best if I explained my problem in detail.
    I have my project set up so that everything occurs in one MovieClip and buttons within the MovieClip are clicked to navigate through the MovieClip. The MovieClip contains several frames which are all unique and contain a variety of textboxes, MovieClips, buttons, classes and other custom classes. All of these components are created directly in Flash Professional by dragging them from the library onto the stage inside of the MovieClip.
    I then name these components using Flash Professional and use these instance names to work with the components. Usually this works without a problem. However, now that I am using a nested MovieClip for my project many problems are occuring. I have it so that when buttons are clicked, the MovieClip goes to a certain frame via the gotoAndStop(x); command. This works fine but I am having problems accessing the buttons that I have named earlier. It gives a null object reference error and when I trace the button it traces as "null".
    Originally I thought that this problem was because the MovieClip had not yet initialized but I had used the ADDED and RENDER event listeners, Timeline scripting, and other methods but the button was still null, leading me to believe that the problem was more than that.
    So I used a click event listener that traced the instance names of the components that I was clicking (trace(e.target.name)). I have a total of 8 buttons on the specific frame of my MovieClip so I clicked on them all. 6/8 of the buttons traced the correct instance name that I had given them whereas the other two buttons traced "instance 169" and "instance 177" instead of the instance name.
    With all this strangeness, I commented out the code for these 2 specific buttons to see if it would work without them. Sure enough it did.
    I believe that my buttons have lost their stage instance names and I do not know how to fix this problem. I have tried deleting the buttons and creating them again but to no avail. It does work, however, if I use the Button component that Flash has but I do not want to do that because I'd like to use my own custom buttons (I know the Button component is customizeable, but I'd like to use my own anyways).
    If anyone could help, please how can I fix this problem? If my .fla or specific code needs to be provided, I can do so.

    Without looking at your code I can't say 100% what is going on. However, I suspect what is happening is that you're doing the following:
    Your button is on stage in frame 1
    You add an event listener to that button
    At some point, you go to a frame where the button does not exist.
    When you come back to frame 1, your listener doesn't work anymore
    Or some variation of above, where an instance was on the stage, is removed, and even though it appears to have been added back you can't reference it anymore.  I've discussed fixes for this issue in depth in this article, but it all boils down to the fact that when the object is removed from the stage the variable that contained the instance the first time will go to null, and then when you go back to the frame with the instance on it, the variable will be populated with an instance which is probably not the same as the first one.
    If the problem is what Ned Murphy speculated, you can easily fix it by setting mouseChildren to false on the buttons.

  • Change Db name and Instance name in *i

    Following is the procedure how i changed the DB and instance name
    1Alter database abckup controlfile to trace;
    2.Edit the trace file to create a new file
    create a instance with diff SID(New sid)
    startup nomount
    edit the initora.file
    changed the instance and db_name in Init.ora
    edit the controlfile with resetlogs option and set dataabse name
    alterdatabase open tresetlogs
    shutdown backup
    Is it correct?
    looks correct to me
    aything i missed out?

    edit the init.ora and then startup nomount and then execute create controlfile command and then open db.

  • Flash actions and instance names

    Hi, i'm after some advise on how to navigate around the timeline using buttons. I know this sounds simple but i'm running into some daft problems.
    I've added a single instance for a button called 'button' which appears on multiple keyframes. This button only appears once per keyframe but some of the actions are getting mixed up. I know that i can create multiple instances to get around this but in principle i cant see why having one action attached to one instance per keyframe would cause an issue regardless of that fact i have the same instance appear on multiple keyframes. Should flash be behaving like this?
    Andy

    Hi Ned, what i have is a layer called actions that hosts a number of actionscripts with a keyframe for each script. To save time i usually create the first frame using unique instance names and then i simply copy and paste them into subsequent keyframes. So each KEYFRAME has unique instances. I thought that by doing this i would save time by not having to re-name or reposition each instance that appears on my timeline -  this would take a long time not to mention the complications it would cause should i decide to shuffle a few frames about later on. For the majority of the time everything works just fine but occasionally the timeline will jump to somewhere totally unexpected. the problem is compounded by the fact that many of these buttons control video playback, so you can imagine the mess this is causing.
    If what i'm doing is bad practice then i'll happily do it the right way by naming each instance but i'm still struggling to see why actions are getting mixed up when they run on their own keyframe.

  • Class And instance name

    how can i access a movieclip via a instance name in 1 class file (Not The Main Document)
    And Make The class reconize  the movieclip when i use a code like this :   this.y = player.y
    player is the instance name.
    thanks

    Already I had seen some thread over the forum and did not have a proper solution for this, but after a long hours I found a solution with the minimal effort:
    1. Create a flash file with a single movieclip named instance testMC
    2. On the timeline write the following code to declare Object of the class
        var obj:TestingAccess=new TestingAccess(stage);
       Here you should pass the stage as an argument to the constructor of the class
    3. Create a class file and write the following code:
       package  {
        import flash.display.MovieClip;
        import flash.events.Event;
        import flash.display.Sprite;
        import flash.display.Stage;
        public class TestingAccess extends MovieClip {
            var stagRef:Stage;
            var rootMC:MovieClip;
            public function TestingAccess(stag:Stage) {
                // constructor code
                stagRef=stag;
                rootMC=MovieClip(stagRef.getChildAt(0));
                rootMC.testMC.rotation=45;
        }//Class
    }//Package
    I Just a made a rotation for that Movieclip. It works

  • Confusing with the Global Database Name and Instance Name

    Dear fellow DBA's and Experts,
    Good Day.
    We presently have an existing database registered (on V2 Exadata) with global database name as BIDEV.domainname.com. It has 4 instances viz., BIDEV1 and BIDEV2 which have the same service name as the instance name.
    Last week, on our new X4-2 Exadata, we tried to create a fresh database. While doing so, we entered the details as below in the installer:
    Global Database Name: BIDEV
    SID Prefix: BIDEV
    Service Name: BIDEV.
    Then upon the successful installation of the database, when we query
    1. (SELECT * FROM GLOBAL_NAME), it shows BIDEV as the global database name.
    2.
    SQL> sho parameter service
    NAME                                 TYPE        VALUE
    service_names                        string      BIDEV1
    3. Sho parameter name gives the below details:
    SQL> sho parameter name;
    NAME                                 TYPE        VALUE
    cell_offloadgroup_name               string
    db_file_name_convert                 string
    db_name                              string      BIDEV
    db_unique_name                       string      BIDEV
    global_names                         boolean     FALSE
    instance_name                        string      BIDEV_1
    lock_name_space                      string
    log_file_name_convert                string
    processor_group_name                 string
    service_names                        string      BIDEV1
    Curious to know why it created an instance name as BIDEV_1 instead as BIDEV1.
    Had tried another attempt on our test environment with SID prefix as BIDEV1, then the instance was created with the name as BIDEV1_1.
    Also, would like to know what happen if we give the Global Database Name as BIDEV.domainname.com for installing the same BIDEV database on a different server while the 1st server is still functional.
    Appreciate if someone could throw some light on the above confusion. Any reference material or source to the clarify the doubt.
    Warm Regards,
    Vikram.

    Hi Vikram,
    Your clustered database is not full RAC, it's RAC ONE node database. In RAC ONE node database, instance names are created in that format only (i.e.e dbname_1), I don't know if there is any way we can change it to dbname1. OR if you really want to change the instance name to dbname1 format, then you can convert RAC one node database to Full RAC, then remove instance and add another instance, I hope it would be added in dbname1 format. I have not tested it, test it on your test system first.
    You can find the database type in the output you shared,
    Type: RACOneNode
    Regards,
    Saurabh

  • RMAN Backup, different servers and instance names

    -RHEL release 9 (Shrike)
    -Oracle 10g release 10.1.0.5.0
    -Archivelog mode
    Guys, i have two servers and i'd like to restore the backup from the first to the second one, but the second server has a different instance name.
    any idea to how is the best way to do that?
    Thx
    Andre

    Hi,
    You can go for duplicate database feature using RMAN.
    Read the link:-
    www.oracle-base.com/articles/9i/DuplicateDatabaseUsingRMAN9i.php
    Regards,
    Navneet

  • Responsibility Name and Instance Name

    Hi All,
    Is there a way to know to which responsibility we are logged in to once we are logged in?
    Also, is there a way to know the instance name we are logged in to? Working on too many instances and responsibilities and when ever i get confused, i am forced to relogin.
    Is there a way where its/it could be displayed somewhere?
    Thanks.

    I face this problem all the time and its quite frustrating to be clueless & lost. I wish Oracle could also add the functionality of switching responsibilities without actually logging out and logging in.
    Anyway, I have created a custom folder from the below sql statement to display all the session information. I have then shared this folder with all the users/responsibilities.
    select
    sys_context('userenv', 'db_name') db_name,
    sys_context('userenv', 'current_schema') current_schema,
    sys_context('userenv', 'host') host,
    sys_context('userenv', 'os_user') os_user,
    sys_context('userenv', 'terminal') terminal,
    sys_context('userenv', 'sessionid') sessionid,
    sys_context('userenv', 'session_userid') session_userid,
    sys_context('userenv', 'session_user') session_user,
    sys_context('userenv', 'authentication_data') authentication_data,
    sys_context('userenv', 'authentication_type') authentication_type,
    sys_context('userenv', 'bg_job_id') bg_job_id,
    sys_context('userenv', 'client_info') client_info,
    sys_context('userenv', 'current_schemaid') current_schemaid,
    sys_context('userenv', 'current_user') current_user,
    sys_context('userenv', 'current_userid') current_userid,
    sys_context('userenv', 'db_domain') db_domain,
    sys_context('userenv', 'entryid') entryid,
    sys_context('userenv', 'external_name') external_name,
    sys_context('userenv', 'fg_job_id') fg_job_id,
    sys_context('userenv', 'instance') instance,
    sys_context('userenv', 'ip_address') ip_address,
    sys_context('userenv', 'isdba') isdba,
    sys_context('userenv', 'lang') lang,
    sys_context('userenv', 'language') language,
    sys_context('userenv', 'network_protocol') network_protocol,
    sys_context('userenv', 'nls_calendar') nls_calendar,
    sys_context('userenv', 'nls_currency') nls_currency,
    sys_context('userenv', 'nls_date_format') nls_date_format,
    sys_context('userenv', 'nls_date_language') nls_date_language,
    sys_context('userenv', 'nls_sort') nls_sort,
    sys_context('userenv', 'nls_territory') nls_territory,
    sys_context('userenv', 'proxy_user') proxy_user,
    sys_context('userenv', 'proxy_userid') proxy_userid
    from dual;
    Now it reminds me I should also add responsibility name to the above sql.
    Hope this helps.

  • Database name and Instance Name

    Hi ,
    Is it neccessary that an instance name should be same as database name ??

    Nor is it necessary for the service name to match the
    instance or database name.
    In support, and expansion ...
    In 10gR2, an instance will have multiple services in any case. An instance can have as many as 64 services, several being assigned to admin and AQ and the rest available for general resource management purposes.
    So ... in the future, we should expect one service name to match the instance name, and several other services to also be associated with the same instance.

  • TS3992 my ipad mini is stuck with the message on the screen 'this ipad hasn't been backed up in 5 weeks.  Backups happen when this ipad is plugged in, locked, and connected to Wi-Fi' with OK button.  If you click button nothing happens and I can't move an

    Ipad mini is stuck with the message 'this ipad hasn't been backed up in 5 weeks....' if you click the OK button nothing happens, cannot get rid of the message and cannot even power off b/c the message is on the screen.
    The ipad had not been backed up b/c it kept saying not enough storage available

    A reset may help. Tap and hold the Home button and the On/Off buttons for approximately 15-20 seconds, until the Apple logo reappears. When the logo appears, release both buttons.
    No content is affected by this procedure.

  • Click button to play and click to reverse

    I have a test button i would like to have play a movie where a graphic expands. Once stopped, I would like to be able to click that same button and have the graphic go backwards. I would prefer to have timeline reverse, rather than lengthen the timeline of the mc because then i have to line up the start and end, and if one changes, i have to remember to change the other.
    I have:
    btn_test.onRelease = function(){
        if (_root.adinstance._currentframe != 1) {
            while(_root.adinstance._currentframe != 1) {
                _root.adinstance.prevFrame();
        else {   
            _root.adinstance.play();
    I get the expand, but when when it hits the while loop, it just disappears the adinstance mc.
    Any ideas?

    You rarely want to use any kind of coded loop to animate something, especially a while loop (they can be especially ornery).  Try something more along the lines of....
    btn_test.onRelease = function(){
        if (_root.adinstance._currentframe != 1) {
            _root.adinstance.onEnterFrame = function(){
                 if(_root.adinstance._currentframe != 1){
                       _root.adinstance.prevFrame();
                 } else {
                       delete _root.adinstance.onEnterFrame;
        else {   
            _root.adinstance.play();

  • Undersanding RBAC vs. Class Level and Instance Level Permissions

    I am finding situations where the Administrative User can perform actions (permissions) on objects that fall outside the assigned scope for those objects. For example, I create Public Task Sequences for our Departmental Admins and assign those Task Sequences
    to the Public scope. I also create a Public Role that only gives the user the ability to view (Read Only) those publically scoped Task Sequences. I also assign those same Administrative Users to another Role which gives them all of the permissions for the
    Task Sequences Package Class but those role permissions are scoped to their specific departmental scope therefore should not apply to any of the objects (Instances) under the publically scoped objects. Unfortunately, I am finding that users can perform actions
    on those publically scoped objects, like moving them, even though they don't have the Move Object permission for the Public Role. There are other cases like this so I am trying to find the documentation that explains which permissions affect all objects (instances)
    under a specific Class and ignores scope?

    Yes, I know this is an old post, but I’m trying to clean them up. Did you solve this problem, if so what was the solution?
    Within the CM12 R2 Toolkit, look at RBAviewer, this will help you understand what each user can or can’t do.
    Garth Jones | My blogs: Enhansoft and
    Old Blog site | Twitter:
    @GarthMJ

  • Iteration and instance names

    Is it possible to run a for loop while assigning properties
    to instances with names ending with numbers?. Something like:
    for (...) {
    'item' + i._x = i*10;
    but in a way that actually works?

    Yeah. Your movieclips are being overwritten by the next
    movieclip creation. There can only be 1 mc assign to a depth value,
    if another one is assigned it will overwrite the previous mc. This
    is what’s happening in your case. Use the
    ‘this.getNextHighestDepth()’ to assign a depth value
    for the movieclips.

  • Click button dynamicall on load

    I would like for a button to be clicked when my movie loads.
    Is there a script that tells that button to click? The other thing
    I would like to mimic is the onHover command. Is there any script
    that would mimic the mouse hovering over a button?

    suppose the button on stage has instance name as _btn.
    The script on frame is
    _btn.onPress = function() {
    trace("button Clicked")
    _btn.onPress();

  • Can the instance name of prod. database and standby database may be same

    Hi all,
    Actually I knew that while configuring Physical Standby
    1> Database name should be same
    2> Instance name should be different
    But,today I saw a DR system where the database name and instance names are the same. So I came to know that it can be done.
    I just wanted to know that what are the trade-offs of putting DB name and instance name same?

    There isn't a tradeoff. By default, the instance_name is the same as the db_name unless if specified differently in teh pfile. What matters is the service name connecting to the instance.

Maybe you are looking for

  • SSO to Web App using Application Integrator - not working (SP15)

    Hi, I have created a web app system and generic app integrator iview for my web application (and set up user mapping etc.), following the Application Integrator how-to guide but it does not log me into my web application. I have got the Yahoo example

  • HELP!! Computer wont boot and i have finals

    When i turn on the computer (I have Leopard) i get a gray screen and a question mark. I really need it for finals - can anyone help...

  • My shutter noise doesn't work any more!

    When I take pictures in Photobooth the shutter noise no longer goes off, this also disappeared for when I take screenshots. I don't know how this happened but it's something that I just noticed recently. What can I do about this?

  • Test Portal  upgrade from 10.1.2.0.2 to 10.1.4.2 and then Portal 11g

    Is there any easy method to recreate production like envionment and test upgrade process. I have read Staging of test envionment http://download.oracle.com/docs/cd/B14099_19/core.1012/b13995/prodtest.htm#BHAHIHBH from production and it involves OID,P

  • Creating mp3 version

    When I'm in iTunes and I try to create mp3 version my only option is to create aac version. How do I change it so I can create mp3 version?