Dynamicaly create onRelease event

Hello,
I got a problem with dynamicaly assigning the onRelease event on my buttons.
I got about 45 buttons and I don't want to create 300 lines of code just to create each of the onRelease events on them so I thought about using a loop (for) to pass through them and assigning the onRelease event. This is what I got and thought would work:
for (var s = 1; s <= _global.NB_SECTIONS; s++) // NB_SECTIONS = 42
    this["btnSalle" + s].onRelease = function(){
        trace(s); // Returns 43
        _global.CURRENT_SECTION = s;
        _root.gotoAndStop("salle");
Unfortunately, it does go to "salle" (which is a frame), but the CURRENT_SECTION variable is always set to 43! I can't understand why it would give me 43 on any of the section buttons I click (which ranges from 1 to 42). Any idea how I could make this work? I don't like having too much codes in my Flash (I've been using a hell load of loops to make it cleaner).
Thanks!

The value of s is not assigned to the buttons, variable is coded into the functions and the function use the value of s at its current value when clicked, not when you assign it in the function.
If those are button symbols, then you can use their _name(s) to determine the value you are looking for since the _name(s) carry the value you want...
for (var s = 1; s <= _global.NB_SECTIONS; s++) // NB_SECTIONS = 42
    this["btnSalle" + s].onRelease = function(){
        trace(String(this._name).substr(8));
        _global.CURRENT_SECTION =  Number(String(this._name).substr(8));
        _root.gotoAndStop("salle");
If they are movieclips used as buttons, then you could assign the s value to a variable ofeach movieclip and use that variable in the functions.

Similar Messages

  • Not able to create an event in month view of iCal?

    I used to be able to create an event from the month vien of iCal, and it doesn't work anymore. Anyone knows how to fix this?
    Thanks

    So sorry to not have a solution but I wanted to chime in and say "me, too!". Not only create an event, but I can't edit it in month view, either. I thought it was my entire iCal program, since I just upgraded to Lion today, but after reading your post I realize I can edit events in week mode, just not month mode.

  • Error while creating a Event in Table maintanence gen

    Hi,
    I've created a table maintanence gen every thing worked fine...i wanted to create a event 05 at new entries in my table main gen so i did it and wrote a subroutine inside it without any logic since i thougt of doing it later and just saved it and came out out the event creation......Now when i want to go to same even the its pops up a Information error which says 'Function group  zxyz cannot be processed.' I cant open any thing from the main menu of the screen...like from environment or from utilities...for every thing it pops up the same message....is it bcoz of the event which i've just created......if i still want to delete it...its not allowing me to go into the event again..how to do it guys...suggest me
    Thanking you.........

    Hi Younus,
    Check whether the function group u created is ACTIVE or not.
    Go to se80. Give the FG name.. check it. Check all the includes in the Function Group whether they are ACTIVE or not.
    Try checking the Package in the TABLE MAINTANCE GENERATOR screen. Assign the Function Group to the correct package.
    I think this solves the issue.
    check the FG name in display mode in the TMG.
    Regards,
    Priyanka.

  • How do I create an Event Handler for an Execute SQL Task in SSIS if its result set is empty

    So the precedence on my entire package executing is based on my first SELECT of my Table and an updatable column. If that SELECT results in an empty result set, how do I create an Event Handler to handle an empty result set?
    A Newbie to SSIS.
    I appreciate your review and am hopeful for a reply.
    PSULionRP

    Depends upon what you want to do in the eventhandler. this is what you can do
    Store the result set from the Select to a user variable.
    Pass this user variable to a Script task.
    In the Script task do whatever you want to do including failing the package this can be done by failing the script task, which in turns fails the package. something like
    Dts.TaskResult = Dts.Results.Failure
    Abhinav http://bishtabhinav.wordpress.com/

  • How to create the event in the report for jobs scheduling.

    Hi Experts,
    i have a requirement like as follows:
    The following triggers for Batch Jobs in the SCM system will be created.i.     
    Background Processing Event = u201CAPO Background Processing Eventu201D. After sending the Event, write a Log Report line u201CEvent u201CAPO Background Processing Eventu201D sentu201D.
    Could you please suggest me how we create the Event or which transaction ?
    Please give me a steps for creating events so that based on these events we use
    CALL METHOD cl_batch_event=>raise
        EXPORTING
          i_eventid                      = p_bpeve
          i_server                       = p_server
          i_ignore_incorrect_server      = p_ignore
        EXCEPTIONS
          excpt_raise_failed             = 1
          excpt_server_accepts_no_events = 2
          excpt_raise_forbidden          = 3
          excpt_unknown_event            = 4
          excpt_no_authority             = 5
          OTHERS                         = 6.
    Right now i received message "APO Background Processing Event" is doesn't exists.
    Thanks in Advance.
    Puneet.

    Hi Puneet,
    Goto transaction SM62 and in there to BckProcEvents tab. There you can create the events.
    You just need to specify the name and Description of an event.
    Hope this serves your purpose.
    Thanks

  • Creating Business event in training and event management

    Hi Gurus!!!,
       can you please instruct me the steps involved in creating business events in Training and Event Management.(HR Module)
    Thanks and regards,
    Prosper

    Hi Prosper,
    You need to configure lot of settings, prior to Business Event, because one BE is based on various elements like Location, Attendee type, Instructor, Fees, Resources, Time Schedule, Services, BE type, BE Group.
    After configuring all these for BE type, you need to create a BE for the BE type. Then, you can go for day to day activities like Booking, Pre Booking, Cancellation.
    I hope, this link will help you
    http://help.sap.com/saphelp_47x200/helpdata/en/26/865738c185f50ce10000009b38f8cf/frameset.htm
    Good Luck
    Om
    Reward it, if u feel helpful.

  • I can no longer create an event on iCal by double clicking on a time or date, nor can I double click on an existing event! HELP!

    I can no longer create an event on iCal by double clicking on a time or date, nor can I double click on an existing event! HELP!
    The only way I have to create an event is by using the "+" button, which is very limiting!
    I am running the latest version of Mac OS X and all the updates.
    Anyone know how I could get a proper use of my iCal ?
    Thanks

    Hi,
    If you list the steps you have taken to fix this it will help.
    Have you tried using the File > New Event menu item?
    Have you logged the user account out/ restarted the computer?
    Have you tried un-syncing any accounts synced to Calendar?
    Is there some change made to the computer that may have triggered this?
    Best wishes
    John M

  • How do I view who created an event in my I Calendar?

    In June of 2013 I was given an Apple Mac Book as a Father's Day present from my wife.  She set the computer up herself and synched our I Cloud calendars together.  I had an Apple ID prior to this.  As far as I know we don't share an I Cloud Account.
    Due to unforseen circumstances in our marriage I had to purse a Restraining Order.  Since that restrianing order, my Verizon Online Account was compromised on two occasions and the Verizon Back Up Assistant Application was Downloaded to an unknown Computer.  Additionally my Optimum Online Email Account was compromised on two occasions and the password was changed.
    On January 29th, 2014 I received a notification that my estragned wife's Apple ID created an event in my I Calendar.  I am not sure how she was able to accomplish this because I purposely changed my Apple ID in December of 2013 to prevent this from happening.  So I assumed our calendars were no longer synched anymore. 
    I then reported this to the local police department for her violating the restraining order and they arrested me for falsifying a police report.  When they looked at my Macbook they were unable to tell who created the event.  While there I synched my calendar to my Iphone and we were able to view the event in that calendar.  However, it showed the event as being edited by me and not created by my wife's Apple ID. I dont recall editing this event.  I looked at several times and may have moved it to another calendar but I dont specifically remember.  This was their probable cause to arrest me and they assumed I purpsoely tried to have my wife arrested. 
    Is there any other way to retrieve who created the event on my Calendar from my computer or I Cloud Account? 
    Is there any way to retrieve the mesage I received in the notification center?  Is this stored anywhere on my computer?
    When I changed my Apple ID wouldnt she have to get my permission to synch our calendars together?  Wouldnt one of us have to approve this via an email?
    Can you send documentation on your company letterhead that I changed my Apple ID and the date it was changed?
    My attorney is preparing a subpoena to submit to Apple.  What is the proper wording he should use in regards to getting the proper information to see who created the event in my I calendar?  Would it be for records pertaining to my I Cloud Account or Apple ID?  Is this information even recorded in the I Cloud account such Internet Protocoal Addresses?
    <E-mails Edited by Host>

    Open the event, or create a new event. Under 'invitees' enter the email addresses and 'send'.

  • How Can I Create an Event Link to a Page Tab?

    I have a portlet in one tab that generates an event. I want to be able to send this event to the same page but to another tab where another portlet resides. Here's the code snippet that creates the link. This code is part of a custom JSP tag.
    // Attempt to get access to the portlet render request to determine if we are within a portal context.
    PortletRenderRequest prr = (PortletRenderRequest) pageContext.getRequest().getAttribute(
        HttpCommonConstants.PORTLET_RENDER_REQUEST);
    if (null != prr)
        try
            // Set up the parameters used for the link.
            NameValue[] eventParameters =
                new NameValue("linkUrl", linkUrlParamValue)
            // Construct the link parameter we will be using.
            linkUrl = EventUtils.constructEventLink(prr, "linkClicked", eventParameters, true, true);
        catch (PortletException e)
            // Error processing removed...
    }This code will generate the event correctly and all processing occurs as expected. However, I cannot find a way to force the second tab to display.
    I am able to force the the second tab to be displayed if I use "Direct Access URLs". These links are in the form
    [protocol]://[host]:[port]/pls/portal/url/page/[page_group_root_page_name]/[tab_name]
    But is there a way to create an event link using a specific URL?

    Hi,
    One workaround that i can think of is:
    1. Set the <passAllUrlParams>true</passAllUrlParams> attribute in your provider.xml of the portlet on the target page/tab.(dont forget to refresh the provider)
    2. If you already have the url to the tab, then you just simply construct the form in your previous portlet to post to that url with all the necessary form fields.
    3. Process the request parameters and render the second portlet.
    hope that helps.
    thanks,
    Harsha

  • Is there a way to create new events on the new iPhoto app?

    Is there a way to create new events on the new iPhoto app?  I seem to only be able to create albums.  I would really like the app to allow me to do all the same things that I was able to do on my Mac.  I would create events and then sync to all devices.  Can someone please instruct me on how to create new events from the photos imported from the photo stream.
    Thanks for all the help!

    The iPhoto for iOS seems to be aimed at working on photos then sharing them to social media sites or to iCloud for sharing there. iPhoto for iOS does not perform many of the organizing tasks that iPhoto on your Mac does. Many people expected that there would be more capabilities in iPhoto for iOS that would allow it to work more closely with iPhoto on your computer but this is not the case. They are separate apps.

  • How do I fix Mail's [apparently lost] "create iCal event" feature?

    When the data detector feature in Mail detects a date (and/or time) the contextual menu offers to create (or edit and create) an event in iCal. This used to work.
    Recently (not sure how long, perhaps last week or two, maybe longer) I have found that (in Mail) I can bring up the same contextual menu, showing the event to be created, and the other events already on that day (oddly, however, each existing event appears in duplicate: peculiar new behaviour). I can edit the presented new event, then click Create event, the contextual menu window whooshes away, and when I go to iCal the event is not there.
    If I now try again, Mail shows my recent attempted creation as if it had occurred (ie same appearance as the events that are in fact already in iCal), but again nothing happens.

    Try this: https://discussions.apple.com/message/16569500

  • HT4528 how do I create an event in my calander that repeats the second thursday of every month

    how do i create an event in my calander that repeats the second thursday of every month

    This should get you started down the pathJust replace User data with your cluster and do the data integrity check in the value change event use a simple one button dialog to notify the user which values are out of compliance and disable and grey the OK button untill all conditions are met.
    Jeff
    Attachments:
    Prompt(Date).vi ‏50 KB

  • How do I create an event template in iCal?

    I have multiple events that take time to setup.  I'd like to be able to create an event once and then save it for re-use.  I realize I can always go to an old event and copy it but that is not nearly as useful as a template

    After reading other posts, I am coming to the opinion that Events must be created in iPhoto on a Mac.  I don't have one of those, so I suppose I'll just have to make do with Folders and Journals.

  • I cant create new events in iCal on my Mac or display them

    Since a few days ago after upgrading to Lion when I want to create a new event it
    dosent show up in my calender. All the old events is shown and when I create an
    event for example on my iPhone and sync with iCal on my Mac I can see the
    new event.
    I click in the calender to make a new event, nothing shows up, but when syncing
    with my iPhone I can see the new event without any text because I didnt see the
    small eventbar to type in or make the right time for the event. Can anybody help
    me with this issue?
    Regards,
    Collins from Sweden!

    Called Apple fast track support and problem is resolved. User error, for some reason I had selected the wrong calendar - after selecting the proper calendar on the left sidebar I could create events. Apparently at some time I created a 'todo' mailbox. It had nothing in it and I ended up deleting it so it doesn't get selected again in error.
    Took 15 minutes to connect with an ICAL specialist. Once connected received excellent support.

  • Create new event in iCal that triggers an applescript

    Dear applescripters
    I am trying to write a script that creates an event in applescript that launches an applescript.
    This is the code:
    tell application "iCal"
    tell calendar "Verstuur"
    set theCurrentDate to current date
    set time of theCurrentDate to (time of theCurrentDate) + 60
    set verstuur to make new event at end with properties {start date:theCurrentDate, end date:theCurrentDate + 1 * minutes}
    tell verstuur
    make new open file alarm at end with properties {trigger interval:0, filepath:POSIX path of "file://localhost/Users/jschaafsma/Desktop/Verstuurfilmpje"}
    end tell
    end tell
    end tell
    when iCal tries to trigger the script iCal generates an error that the file Verstuurfilmpje is not found.
    Any ideas what i am doing wrong?
    Thanks
    Jschaafsma

    Well, for one, your file path isn't valid.
    … filepath:POSIX path of "file://localhost/Users/jschaafsma/Desktop/Verstuurfilmpje"}
    First off, POSIX path of takes a Mac-style (i.e. colon-delimited) path or alias and converts it to an POSIX path, so either you need to drop the 'POSIX path of' code, or pass in a Mac-style path.
    Secondly, even if you were to use 'POSIX path of', your path specification is invalid anyway - you haven't passed in a POSIX path you've passed in a file URL, which is different. A POSIX path of that file would look like:
    filepath: "/Users/jschaafsma/Desktop/Verstuurfilmpje"
    So rewrite this line and you should be set.

Maybe you are looking for

  • File-PI-SOAP Interface error

    Dear All, We are trying a interface in which we wanted to do Post Goods Issue in SAP from a file. We have exposed our Z-RFC which will do PGI as webservice and has imported its WSDL in PI. Then, we have created a File-PI-SOAP interface. Now, when we

  • SSMS 2014 one day stopped being interactive- can't interact with any UI

    I'm able to launch sql server management server, but once it's up the UI is completely non-responsive.  It's as though there was a hidden modal dialog somewhere off-screen, or the UI thread was stopped at a debug breakpoint- none of the controls with

  • Using Roxio Toast Titanium with 550 PowerBook

    Hello eveyone. I recently installed Tiger and am now on V. 10.4.7 My PB has no cd or dvd burner so about 3 years ago, I bought a burner and installed Roxio Toast Titanium 5.1.2. All went OK - until Tiger. After the Tiger install, I can't get my Toast

  • How do I change my internet searches on my i5S back to US extensions from UK?

    Hello, I can't seem to get my iphone 5S to switch back to US internet searches, everything has a .UK extension...my region format is US, Language English...what am I missing?

  • Virus guards for S60 v3.1

    Guys, what are the viruses that have infected your device so far? What are the virus guards that you use on your S60 3rd Edition phones? Are they free? Do they work fine? Mobile Royale - Latest News, Reviews and Software for Mobiles Aero Everyday - A