Event Handlers for Dynamic Buttons

Hi, I hope someone can help. I just can't figure out how to
solve this problem:
I am creating an number of buttons dynamically that
correspond each to a filename read from a directory. The problem is
I don't know ahead of time how many buttons (files) I will have so
I create them dynamically in action script. -- this much I can do.
What I can't figure out is how do I assign each of these
dynamically created buttons individually specific event handlers?
ie. I need to know which file icon you clicked on and then take
action based on that info.
for example: "folder" is a button icon I have linked from my
library - i name each instance "folder"+i -- what I need to do is
do something for folder1, folder2 etc.
for (i=1;i<numdirs;i++) {
graphics.attachMovie("folder","folder"+i,depth);
graphics["folder"+i]._y= coordy2;
// want to put an event handler here for each
graphics["folder"+i] button
I wanted to do something like:
graphics["folder"+i].onRelease = function() {
test_txt.text = i;
but each button I click on gives me i= numdirs (ie the max
number -- for example 6 if there are 6 files, I can't identify
which button you actually clicked on -- button1 through 6 all
deliver the number 6 to test_txt.text)
I hope that makes sense - if someone can take a swag at this
and point me in the right direction I will be very appreciative.
Best Regards,
Tom

There is other way to do that.. whenever you call a
attachMovie or loadMovie
function there is a return value that corresponds to the
actual movieclip
created on the flash movie. ie
for (i=1;i<numdirs;i++) {
var temp_mc:MovieClip =
graphics.attachMovie("folder","folder"+i,depth);
that new reference temp_mc is the newly created movieclip and
you can do
whatever you want with it, ie:
for (i=1;i<numdirs;i++) {
var temp_mc:MovieClip =
graphics.attachMovie("folder","folder"+i,depth);
temp_mc._y = 30
temp_mc.id = I
//even assign new funtions to events
temp_mc.onRelease = releaseFunction
function releaseFunction(){
trace("do something on the release event")
<DIV>&quot;charmcityMD&quot;
&lt;[email protected]&gt; wrote in
message
news:ed2l97$n8$[email protected]..</DIV>> THANK YOU
soo
much -- I have been pondering this and scanning the web for
hours. Your
solution is perfect. I very very much appreciate your help.
>
> Best Regards,
> Tom

Similar Messages

  • Multiple event handlers for one button

    I'm trying to create a button with 2 event handlers, such
    that when you roll-over the button, a submenu pops up, and when you
    click the button, you go to a certain frame. I feel like this
    shouldn't be hard at all, but it's not working. Below is the
    actionscript I have tried. Both event handlers work as I want them
    to if alone, but the on(release) functionality does not work when I
    try to put them together.(I have Flash 8). Thanks for your help!
    on (release) {
    _root.gotoAndStop("one1");
    tellTarget (_root.navigation) {
    gotoAndStop (1);
    on (rollOver) {
    this.gotoAndPlay("links");
    tellTarget (_root.navigation.introduction) {
    gotoAndStop (1);
    tellTarget (_root.navigation.overview) {
    gotoAndStop (16);
    tellTarget (_root.navigation.coronary) {
    gotoAndStop (1);

    this code is ok, it seems that when u rollover on the button,
    the event is fired and it keeps on running the time u r on it. i
    think just add
    delete this.onRollOver inside rollOver event.

  • Event handlers for backbutton

    Hi,
    I want perform some validations when I press back button.how to find event handlers for back button,because F2
    is not giving full info for back button.
    Regards,
    Brahmaji

    Hi,
    the back button is always part of toolbar buttons.
    So you can open the view controller class and open the GET_TOOLBAR_BUTTONS method from that class.
    In this method you see how the BACK button is defined. One of the attribute of button structure is ON_CLICK.
    The value of this attribute should be the event name that is triggered when the button is clicked.
    Now open the DO_HANDLE_EVENT method from the view controller class, you will have methods with prefix EH_ON
    after the prefix you see the event name. If you find one that mached to the event name of the BACK button, then this is the event handler that is triggered by the BACK button.
    Regards,
    Steve

  • How to remove event handlers for a content type currently in use?

    Hi,
    We had a SP 2007 solution that managed event handlers as described in
    Brian Wilson's blog regarding event handlers. We then did a in-place upgrade to SP 2010. It so happend that we wanted to remove some of our old event handlers and this is where our problem started. We managed to delete event handlers
    (SPEventReceiverDefinitions) for
    Site and List by using the ui from Brian Wilsons feature "Manage Event Handlers" (ref the link above), but not anyone at all for
    Content Types... It simply wouldn't be deleted
    (remove was grayed out in the ui). 
    We then tried to do it by code. Below is a code snippet illustrating how we tried to delete the event handlers for content types:
    using (SPWeb web = properties.Feature.Parent as SPWeb)
    string targetClassName = "targetClassName.";
    web.AllowUnsafeUpdates = true;
    // Removing Content Type event handlers
    foreach (SPContentType ct in web.ContentTypes)
    for (int i = ct.EventReceivers.Count - 1; i >= 0; i--)
    if (ct.EventReceivers[i].Class.StartsWith(targetClassName))
    ct.EventReceivers[i].Delete();
    ct.Update(true);
    web.Update();
    The Content Types are not sealed and are
    not readonly. When debugging, we can see that the
    Delete() method are called on one of the Content Types we wanted to delete event handlers for. We noted that the
    ct.EventReceivers.Count remains the same, before and after Delete() is called. We did not get any exceptions when running this code.
    When running the code a second time and debugging again, we see that the very same Content Type still has the very same event handler attached... As in, it wasn't deleted....
    We also tried to delete the event handlers through PowerShell as described
    here in the post by Per Jakobsen. However, the script did not really seem to find any EventReceivers... We tried to write the
    $site.AllWebs | % {$_.Lists} | % {$_.ContentTypes} | % {$_.EventReceivers} list to file, but it was empty.. We did however get a long list when writing $site.AllWebs | % {$_.Lists} | % {$_.ContentTypes} to file. We could then in
    that file see the event handler references we want to remove registered to our Content Types, as we did during code debugging earlier on. So PowerShell might still be the way to go here...
    So, does anyone know if there is a way to force this delete through, either by code, PowerShell or some other means? Any help regarding this matter would be very much appreciated :)

    Hi,
    For your information, there's two versions (at least) exists for each content types. One is Site Content Type - exists in Root web and another is list content type. Once you add a content type to a list, a copy of the site content type is taken and stored
    in the list. If you update the site content type, it may or may not affect the list conten type. So make sure you are updating the both - site content and list content type. Once you update site content type with passing paramater true to 'ct.Update(true)',
    the list content types are supposed to updated too.
    Thanks,
    Sohel Rana
    http://ranaictiu-technicalblog.blogspot.com

  • How to find event handler for save button in salesorders

    Hi,
    I want perform event based on save button in salesorders.Can you tell me how to find the event handler for
    save button.
    Regards,
    Brahmaji

    Brahma,
    you can find the component, view details by doing an F2.
    open the component, the view will be mostly an overview page i.e., the name ends OP etc.,
    But your method name will be mostly EH_ONSAVE, you need to find exact view.
    F2 does not come up properly for overview pages, you have to look into UI config tool preview and make sure sometimes.
    Regards,
    Masood Imrani S.

  • Unable to get automatic event handling for OK button.

    Hello,
    I have created a form using creatobject. This form contains an edit control and Search, Cancel buttons. I have set the Search buttons UID to "1" so it can handle the Enter key hit event. Instead its caption changes to Update when i start typing in the edit control and it does not respond to the Enter key hit. Cancel happens when Esc is hit.
    My code looks like this -
    Dim oCreationParams As SAPbouiCOM.FormCreationParams
            oCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)
            oCreationParams.UniqueID = "MySearchForm"
            oCreationParams.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Sizable
                    Dim oForm As SAPbouiCOM.Form = SBO_Application.Forms.AddEx(oCreationParams)
    oForm.Visible = True
    '// set the form properties
            oForm.Title = "Search Form"
            oForm.Left = 300
            oForm.ClientWidth = 500
            oForm.Top = 100
            oForm.ClientHeight = 240
            '// Adding Items to the form
            '// and setting their properties
            '// Adding an Ok button
            '// We get automatic event handling for
            '// the Ok and Cancel Buttons by setting
            '// their UIDs to 1 and 2 respectively
            oItem = oForm.Items.Add("1", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
            oItem.Left = 5
            oItem.Width = 65
            oItem.Top = oForm.ClientHeight - 30
            oItem.Height = 19
            oButton = oItem.Specific
            oButton.Caption = "Search"
            '// Adding a Cancel button
            oItem = oForm.Items.Add("2", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
            oItem.Left = 75
            oItem.Width = 65
            oItem.Top = oForm.ClientHeight - 30
            oItem.Height = 19
            oButton = oItem.Specific
            oButton.Caption = "Cancel"
    oItem = oForm.Items.Add("NUM", SAPbouiCOM.BoFormItemTypes.it_EDIT)
            oItem.Left = 105
            oItem.Width = 140
            oItem.Top = 20
            oItem.Height = 16
            Dim oEditText As SAPbouiCOM.EditText = oItem.Specific
    What changes do i have to make to get the enter key to work?
    Thanks for your help.
    Regards,
    Sheetal

    Hello Felipe,
    Thanks for pointing me to the correct direction.
    So on refering to the documentation i tried out a few things. But I am still missing something here.
    I made the following changes to my code -
    oForm.AutoManaged = True
    oForm.SupportedModes = 1 ' afm_Ok
    oItem = oForm.Items.Add("1", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
            oItem.Left = 5
            oItem.Width = 65
            oItem.Top = oForm.ClientHeight - 30
            oItem.Height = 19
    oItem.SetAutoManagedAttribute(SAPbouiCOM.BoAutoManagedAttr.ama_Visible, 1, SAPbouiCOM.BoModeVisualBehavior.mvb_Default)
            oButton = oItem.Specific
            oButton.Caption = "OK"
    AND
    oForm.Mode = SAPbouiCOM.BoFormMode.fm_OK_MODE
    oItem = oForm.Items.Add("1", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
            oItem.Left = 5
            oItem.Width = 65
            oItem.Top = oForm.ClientHeight - 30
            oItem.Height = 19
    oItem.AffectsFormMode = False
    I get the same behaviour OK button changes to update and enter key does not work.
    Could you please tell me find what is it that i am doing wrong?
    Regards,
    Sheetal

  • How to handle event structures for two buttons and two counters.

         *I have two buttons A and B, and have to compare the difference in hits between them.  So do I place an event structure within a while loop for each button (2 buttons, 2 event structures, 2 while loops), or does it need to be one event structure with cases for both buttons whithin one while loop? 
         *How do I pass the values of buttons A and B's hit counters out of the while loop in order to calculate the differences between them after each increment, not just the final count after the stop button is hit? 
         *How would I make one stop button work to handle both buttons A and B?   I tried to place the actual stop button in one button A's structure and its global in B's structure, but It wont seem to let me use a local variable for a latchable control
    Checker

    You should probably have not started a new thread and waited until your question in the original thread was answered. You can modify altenbach's example for a second button. You have a single event structure with a new event for the second button. You have a second shift register to track the number of times the second button is pressed. Inside the while loop but outside the event structure, you just have a subtract function in or to report the difference. do not modify the posted example for the stop button. It works perfectly as is.

  • Event Handling for HTMLB Buttons

    Dear Pros,
    How we handle HTMLB Button Events for the following Code in the Layout section:
    I want the user to Click this button for Downloading the Internal table displayed onto an Excel file on Presentation Server.
    <htmlb:content design="classic" >
      <htmlb:page title="page1 " >
        <htmlb:form>
          <htmlb:button id = "Dwd_Excl"
             text          = "Download to Excel"
             tooltip       = "Please click for Excel Download"
             onClientClick = "EXCEL"
             design        = "small"
             width         = "200" />
          <htmlb:tableView id          = "tv1"
                       headerText      = "Sales Statement"
                       design          = "alternating"
                       headerVisible   = "true"
                       visibleRowCount = "20"
                       selectionMode   = "lineEdit"
                       table           = "<%= t_zsstable %>"
                       iterator        = "<%= iterator %>" />
        </htmlb:form>
      </htmlb:page>
    </htmlb:content>
    Waiting for your suggestions/replies.
    Sincere Thanks to All.
    Vivek Singh.

    Hi Craig,
    Just worked on the code sample you provided. Heres' how my code looks in OnInputProcessing segment:
          Some internal table population code here
    then the following code segment:
    file = 'C:\ZSS.XLS'.
    event = cl_htmlb_manager=>get_event_ex( request ).
    IF event IS NOT INITIAL AND event->event_id = 'Dwd_Excl'.
      results = 'Button was pushed'.
    ENDIF.
    IF results = 'Button was pushed'.
      CALL FUNCTION 'WS_EXCEL'
        EXPORTING
          filename      = file
        TABLES
          data          = t_zsstabl
        EXCEPTIONS
          unknown_error = 1
          OTHERS        = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDIF.
    The problem is that when I push the Download to Excel HTMLB Button, the following Error is being displayed on the page :
    500 SAP Internal Server Error
    Error message: Exception condition "NO_BATCH" raised. ( type of termination: RABAX_STATE )
    The Layout part code is :
    <htmlb:content design="classic" >
      <htmlb:page title="page1 " >
        <htmlb:form>
          <htmlb:button id            = "Dwd_Excl"
                        text          = "Download to Excel"
                        tooltip       = "Please click for Excel Download"
                        onClick       = "ExcelButton"
                        design        = "small"
                        width         = "200" />
          <htmlb:tableView id              = "tv1"
                           headerText      = "Sales Statement"
                           design          = "alternating"
                           headerVisible   = "true"
                           visibleRowCount = "20"
                           selectionMode   = "lineEdit"
                           table           = "<%= t_zsstabl %>"
                           iterator        = "<%= iterator %>" />
        </htmlb:form>
      </htmlb:page>
    </htmlb:content>
    I hope you can suggest something on this.
    Waiting for your response.
    Best Regards,
    Vivek.

  • Defining event handlers for renaming, moving, copying and deleting of files.

    Hi every one.
    I had created a tool for InDesign CS6 written using Javascript to manipulate portions of text in nested way by marking them with small non-printing small anchored text frames contains sequenced numbers and storing these portions as snippets in a spicific folder beside the InDesign documents.
    This tool is open source and free of charge, the only this that I want from you (after downloading) as a user to feedback and as a developer to improve it and join me.
    sourceforge.net/projects/livesnippets
    My question is not about this but I want to trace when the user rename, move, copy or delete a file of these snippets or any container folder and interact according to that by reserving the links between snippet files and their instances which interspersed in InDesign documents.
    Thanks.

    Here is an example of using Bridge events… What this scrript will do if you add it to Bridge scripts… is set *all* indesign snippets in the folders you browse to… to be locked/readonly… This means that users will get an extra dialog if they want to delete the file… Finder or Bridge… You can't just rename the file Finder or Bridge… and Bridge's Batch Rename will only function if the user makes copies to new location… You could set this property using the File Object with indesign…
    #target bridge
    onDocLoaded = function( event ) {
        if ( event.object instanceof Document && event.type == 'loaded' ) {
            lockIDSnippets();
            return { handled: true };
    function lockIDSnippets() {
        var i, count, doc, thum;
        doc = app.document;
        count = doc.visibleThumbnailsLength;
        for ( var i = 0; i < count; i++ ) {
            thum = doc.visibleThumbnails[i];
            if ( /\.idms/.test( thum.spec.name ) ) {
                thum.spec.readonly = true;
    // Register event handler
    app.eventHandlers.push( { handler: onDocLoaded } );

  • Where to register event handlers for a content type

    Hello,
    I'm developing a feature that creates site columns, content types, event receivers (class libraries) and binds all together - everything using code and not xml.  The web application should have 1 site collection and several hundreads sites. 
    For example:
    field1 = web.createtextfield(...); spcontenttype ct = web.createNewContenttype(...); ct.FieldLinks.Add(field1);
    I have a question about binding the event receivers: Should this be done in site collection level or it should be done for every subsite?
    the code is:                  
    string evClass = typeof(SampleEvReceiver).FullName;string evAssembly = typeof(SampleEvReceiver).Assembly.FullName; RegisterEventHandler(currentCT, "Content Type Event Receiver", 1010, evAssembly, evClass, SPEventReceiverType.ItemUpdated); //my function.
    Also, I've put the event receivers in a different project - i.e. different dll. The idea is to change the event receivers's code, copy the dll file to the gac, iisreset and have the new code running. Is this correct?
    Thank you
    Christos

    Hi Christos,
    1. This should be done in site collection level.
    2. This is correct and Restart Timer Service if as need.
    /Hai
    Visit my blog: My Blog | Visit my forum:
    SharePoint Community for Vietnamese |
    Bamboo Solution Corporation

  • Sharing Events/Handlers for Tree and List

    I have a Tree component and a List component that both share
    very similar functionality. In particular, I have setup
    functionality to edit the labels in each component only when I
    trigger a custom event from a ContextMenu, preventing the default
    action of editing the item when it is selected.
    Since Tree extends List, I was wondering if there was some
    easy way to make a Class/Component that could contain all the logic
    for this functionality that could be shared across Tree and List
    (or any List-based) components.
    I'm basically trying to avoid duplicating code.
    Any thoughts/suggestions?
    Thanks!

    "ericbelair" <[email protected]> wrote in
    message
    news:ga8h3q$9pn$[email protected]..
    >I have a Tree component and a List component that both
    share very similar
    > functionality. In particular, I have setup functionality
    to edit the
    > labels in
    > each component only when I trigger a custom event from a
    ContextMenu,
    > preventing the default action of editing the item when
    it is selected.
    >
    > Since Tree extends List, I was wondering if there was
    some easy way to
    > make a
    > Class/Component that could contain all the logic for
    this functionality
    > that
    > could be shared across Tree and List (or any List-based)
    components.
    >
    > I'm basically trying to avoid duplicating code.
    >
    > Any thoughts/suggestions?
    I think what you're looking for is called "monkey patching",
    which involves
    putting a file of the same name and directory structure in
    your project as
    the original was in the Framework. I don't know much more
    about it than
    that, though.

  • Are there event handlers for graphic objects drawn with the CWIMAQViewer toolbar?

    Hi,
    I use the CWIMAQViewer in my VB.Net  application to display images from a CCD camera.  I want to use the toolbar that comes with the viewer to draw graphics (e.g. a circler) over the image.  Is it possible to get the position and radius  of the circle as I drag it and change its size?  If not, what library should I use (I do have the NI Vision module) to achieve my goal?  Thank you so much for your help.

    Try creating the circle as a ROI.  Then take a look at ROI properties.  As an example, ROITop Property: CWIMAQ.ROITop
    Jeff B.
    Applications Engineer
    National Instruments

  • Event Handlers for the Textfield

    How can I capture the 'value changed' event of a text field, without using IB.

    you can do addTarget:action:forControlEvents on UITextField, e.g.:
    [myTextField addTarget:(id)self action:@selector(textFieldChanged) forControlEvents:UIControlEventEditingChanged]
    then implement the textFieldChanged function, e.g.:
    - (void)textFieldChanged{
    NSLog(@"value changed");
    Message was edited by: bratax

  • How to add a new button in IC tool bar and handle the event for the button?

    Hi,
        I am working on CRM 2007 Interaction center. To add a new button to IC toolbar, customizing is available to define a new button and then assign in to the profile.
    In SPRO->CRM->IC webclient->Customer Specifc System Modifications->Define Toolbar Buttons, I defined one new button with ID ZSTART.
    Now in SPRO->CRM->IC webclient->Basic Functions->Communication Channels->Define Toolbar Profiles , I selected Default profileid and in Generic Layout Buttons Tab, I added the new button ZSTART in Position 3.
         So after completing the customizing when the user logs in using role IC_AGENT,  the button (with ID:ZSTART) gets displayed in the IC toolbar too.
          Now on click of this button, I need to create an object.
    To do so, I have to catch the event which is raised by this new button.
           Please let me how to implement the event handler for this new button. What will be the event name for this button click event and how I can subscribe for it ?
         Please let me know if anyone of you have already worked on similar requirements.
    Regards,
    Manas.
    Edited by: manas sahoo on Jul 22, 2008 7:49 PM

    Hello Manas,
    There are a couple of threads in the community that might help you out (if you haven't already found them):
    Re: IC Web Client Toolbar
    /message/3621917#3621917 [original link is broken]
    Regards,
    Renee Wilhelm
    Edited by: Renee Wilhelm on Nov 6, 2008 7:46 PM

  • Contextual Event for a Button in Dialogue (inline popup)

    I have dialogue(in-line popup window) which opens on click of button "viewPopUp" in parent window.
    I have a table and "select" button inside dialogue. I have contextual event created for this button inside child wondow.
    It never works for me. Its not calling the event handler method. But, If I add a contextual event for the button "viewPopUp" on the parent page works fine.
    Anybody faced similar issue?
    Any idea or tips to get it work?
    Edited by: sideeque on Sep 17, 2011 11:08 PM
    Edited by: sideeque on Sep 17, 2011 11:09 PM

    I use JDeveloper 11.1.1.5. I might be doing something wrong here. Do you have the sample code to share and test in JDeveloper 11.1.1.5? Is it running for you in JDeveloper 11.1.1.5 version?

Maybe you are looking for

  • Step by step instructions

    Hello experts, Wondering if anyone can provide me with a step by step instructions on how to go about creating something in VC and display it on the portal?  I am looking to take some queries from SAP BI 7.0 and display them on the portal.  I heard t

  • Responsive gallery and DW template

    I've been trying to find a way to add a "responsive image gallery" into my CS6 DW template. Actually, I need to create around 100 image galleries - each gallery will have around 70 images. I thought I had the answer with "JuiceBox" running the "scrip

  • AirDrop transfer between Mac mini (late 2012) and MacBook Pro (late 2008) works only one way.

    AirDrop transfer between Mac mini (late 2012) and MacBook Pro (late 2008) works only one way.  I see both machines on both airdrop windows. Firewalls on both machines are set exactly the same way, and with Network Browser set to allow.  Can send a fi

  • Service suspand without billing

    hey my name is hina , i already suspanded my account for 92 days with without billing system . i confirmed my suspantion without billing system with online customer service that i can not get monthaly bill for 92 days .. but now i get an email from v

  • What driver to install to fix Brightness issues on my Edge 15 with Windows 8.1

    Hi, On my Edge 15 with Windows 8.1, Brightness is unavailable from Windows. I can adjust brightness with the Fn keys, but it keeps resetting it's default value. Very annoying. There are a lot of drivers, which one should I install to fix this problem