One button controlling multiple buttons as3

I'm trying to follow a tutorial I found online for a randomly selected image without using an XML or AS file.
The problem is that I want to generate more than just one section, like generate an image from one group, and an image from another group, and etc etc. That's something I can do but there'd need to be a button for each group. It's not exactly horrible, but I was hoping to just have a "one button controls everything". So is there a basic code that will say "When this master button is clicked, all these other buttons are clicked"?
Here's the tutorial for reference.
Flash Tutorial: Generate a Random Frame with AS3 -HD- - YouTube

One approach is to have the event handler of the button call all of the other button's event handler functions, passing its received event argument to them.  If you were to name the other functions in some numeric  pattern then you could loop thru them rather than writing each one out separately.
Another approach would be to have one single function that works for all the buttons where you test which button was clicked and decide which commands to execute.

Similar Messages

  • One task control multiple DAQ modules

    Is it possible to have one task control 2 or 3 DAQ modules? I do not seem to have luck in doing so.
    Also, for a digital output NI device that sources voltage, if I hook up 10v to it and the module has 10 channels, how on earth are the 10 channels each able to source 10V, when I only supply one 10v power supply.
    Does it just send extremely small amounts of current per channel versus sending a decent amount of current per channel if I just had one output on?

    Hey all,
    This is a crosspost, I posted somewhere else after posting this post, just because I did not know whether I posted in the right place, here is the link to the other in case anyone else comes across this problem: http://forums.ni.com/t5/Multifunction-DAQ/one-task-control-multiple-DAQ-modules/td-p/3170766 Sorry about that.
    Anyways, I have 
    NI 9401, 
    NI 9403,
    NI 9474,
    NI 9375,
    I am using a 
    NI cDAQ-9184 chassis
    I believe these are all compactDAQ.
    I would like to combine the 9401 and 9403 into 1 task, and the 9474 and 9375 into 1 task.
    Also, I am having issues with one of the modules, the 9375. When I wire False data to the Write DAQ on LabVIEW it seems that the 9375 is still sourcing some voltage. I cannot remember the difference in voltage of then I wire true data versus false, But I believe they were somewhat close. Has anyone came across a problem like such?
     

  • When button pressed: Multiple buttons

    Regarding the 'When Button pressed' condition available in various places (computations, branches, processes, etc), it offers me the option to select exactly one button.
    How can I make it so that I want the thing to fire when either Button 1 or 2 or 3 is pressed?
    Thanks

    Martin - Whenever a page is submitted with a button, the request value is set to a property from the button, either the button name for standard buttons or the request value attribute for item buttons. In either a PL/SQL expression condition or in some of the declarative condition types that look at the request value, you can compare it to a list of values that you're interested in.
    Note that the request value doesn't necessarily tell you which button was pressed. It tells you that some event set the request value. If your page can be submitted with a tab or with javascript that you put somewhere on the page, or if you've given multiple buttons the same request value, it's up to you to prevent ambiguity about the button-to-request mapping.
    Scott

  • One tray for multiple button group items

    Hi,
    I have 3 button group items in my templaate ,in the propoerties of these button grps the tray is on .NOw I can see 3 trays when I execute my template instead I want to have one tray for these 3 button group items . How is this possible?
    THanks
    Sany

    OK, I'm having trouble again. I need multiple items to drag
    to one target. I'm putting all my actionscript in the same frame,
    and here's how it looks:
    stop();
    name_mc.onPress = function():Void {
    this.startDrag(true);
    name_mc.onRelease = function():Void {
    this.stopDrag();
    if (eval(this._droptarget) == safe_mc) {
    this.swapDepths(this._parent.getNextHighestDepth());
    this.removeMovieClip();
    address_mc.onPress = function():Void {
    this.startDrag(true);
    address_mc.onRelease = function():Void {
    this.stopDrag();
    if (eval(this._droptarget) == safe_mc) {
    this.swapDepths(this._parent.getNextHighestDepth());
    this.removeMovieClip();
    And I'm getting the following error message:
    **Error** Scene=Recap, layer=actions, frame=1:Line 21:
    Statement block must be terminated by '}'
    address_mc.onRelease = function():Void {
    **Error** Scene=Recap, layer=actions, frame=1:Line 27: Syntax
    error.
    Total ActionScript Errors: 2 Reported Errors: 2
    Do you know what I'm doing wrong?

  • One function for multiple buttons?

    I have a county map on my timeline with a list of each county as buttons ( there is 88 counties). I want to highlight the county on the map when I click the county's name from a list.
    when I test this out, only the last one gets highlighted. I know I am missing something really simple. it does work if I write code for each button but I can't to seem to get it to work with only writing the function once for all buttons
    var countyHigh:MovieClip = adamsHighlight;
    var countyCheck:MovieClip = kickout.adamsCM;
    kickout.adamsCheck_btn.addEventListener(MouseEvent.CLICK, highlightCounty);
    kickout.allenCheck_btn.addEventListener(MouseEvent.CLICK, highlightCounty);
      countyHigh = allenHighlight;
      countyCheck = kickout.allenCM;
    kickout.ashlandCheck_btn.addEventListener(MouseEvent.CLICK, highlightCounty);
      countyHigh = ashlandHighlight;
      countyCheck = kickout.ashlandCM;
    function highlightCounty(event:Event):void{
      if   (countyHigh.alpha == 0)
           countyHigh.alpha = .5;
      else  countyHigh.alpha = 0;
       if(countyCheck.alpha == 0)
       countyCheck.alpha = .5;
      else
      countyCheck.alpha = 0;
    when I click all there buttons, the all highlight ashland county instead of their own county. I am using Flash Professional CS5 and only been playing with Flash for about a year.

    var previouslyHighlightedCounty:Movieclip;
    function highlightCounty(e:MouseEvent):void{
    if(previouslyHighlightedCounty){
    //reset previouslyHighlightedCounty. ie, un-highlight
    // highlight e.currentTarget
    e.currentTarget=previouslyHighlightedCounty

  • Can multiple button actions be implemented by creating just one RFC?

    Hi All,
         I wanted ask a general question "is it possible to create just one RFC for multiple button actions such as delete, insert, search, modify, copy".
       I tried using one RFC for all the above mentioned actions but I wasn't able to consistently get expected results. So, I just want to confirm from SDN forum members that is it a good practice or is it advisible to create individual RFC for each button actions?
    Earlier responses would be much appreciated.
    Thanks
    Uday

    Hi,
    I did not see any problem for that creation on multiple button actions such as delete, insert, search, modify, copy".  These actions depending up on your RFC.
    For Example. Your RFC having Insert and Delete Functionality you can develop these two Actions. i.e is depending upon your requirement and Depending upon you r RFC functionality. That
    RFC donu2019t gave insert, Delete, modify these functionalities no need to create these Actions.
    So there is no restriction for call the RFC Via Actions(buttons)
    Hope this is help full for u
    Regards
    Vijay

  • One pair of radio buttons to control multiple text objects - Designer 8.0

    Greetings - a big thank you in advance for any assistance. I have often found answers to my problems on this forum, but have been unable to find an answer to the following.
    The short of it - is it possible to make a pair of radio buttons control the visibility of multiple text objects with the same name(I have had success in manipulating only a single text object with one pair of buttons)?
    The long of it - I am trying to make a form bilingual based on the value of a radio button group to control the visibility of the text object in the selected language. When the user selects the language they wish to see, all the text objects in the form switch to that language. I am working with a dynamic PDF.
    I have succeeded to a very limited extent in manipulating one text object by overlaying text objects in both languages, setting one object to "invisible" as default, and controlling that text objects visibility with the following JavaScript in the click event of the radio button group:
    ----- form1.#subform[0].ENG_JPN::click: - (JavaScript, client) -------------------------------------
    if (ENG_JPN.rawValue == 1)///1 equals the value of on
    {English.presence = "visible";}
    else
    {English.presence = "invisible";}
    if (ENG_JPN.rawValue == 2)///2 equals the value of on
    {Japanese.presence = "visible";}
    else
    {Japanese.presence = "invisible";}
    endif
    The problem is I need to manipulate the visibility of all text objects with the same name on the form with a single radio button group. I have tried writing the code as one does for the sum of a repeating field, ie. English[*].presence etc. however I get a C++ error in preview.
    Any ideas are greatly appreciated. I am truly stumped - thank you for your time.

    To access objects with the same name you need to deal with occurance numbers. If your object is called TextField then the 1st occurance will be TextField[0], the second occurance will be TextField[1] etc.....
    The issue is that the [] in javascript are interpretted as an array element so you have to use the syntax: xfa.reolveNode("string") to get to your object names. In your case you would use:
    xfa.resolveNode("TextField[1]").presence = "visible"
    This string syntax allows you to use a var to hold the index number and is very useful with for loops where you want to set large numbers of objects. So if the index was held in the var i then your syntax would be:
    xfa.resolveNode("TextField[" + i + "]").presence = "visible"
    If the objects are in a repeating subform then the occurance numbers are on the subform and not the object. You can always get the expression to use by app.alert(objectname.somExpression). This will return the expression that you need to create.
    Make sense?

  • One Function, multiple buttons

    I am new to AS3 and AS in general.  I know enough that you have to add event listener and create a function to handle when a button is clicked. If I have 4 buttons that I want links to 4 different pages, do I have to have 4 functions?  One for each button?  Or is there a way to use one function and somehow catch a value that determines which button was clicked and then open the corresponding URL?
    I know this has to be simple, I just don't know the answer.  Thanks for the help!

    You can use 1 function to handle all 4 button's clicks. See the example code I provided. To make the code work just drag the AS3 button component onto your movie and delete it from the stage; this will add the Button to the FLA library and make it accessible for use in code. I also attached a FLA of this example to this post.
    Let me know if you have any trouble.
    Good luck.
    Sean
    import fl.controls.Button;
    import flash.events.MouseEvent;
    var _btOne:Button = new Button();
    var _btTwo:Button = new Button();
    var _btThree:Button = new Button();
    var _btFour:Button = new Button();
    _btOne.y = 0;
    _btTwo.y = 50;
    _btThree.y = 100;
    _btFour.y = 150;
    _btOne.label = "One";
    _btTwo.label = "Two";
    _btThree.label = "Three";
    _btFour.label = "Four";
    _btOne.addEventListener(MouseEvent.CLICK, btnClickHandler);
    _btTwo.addEventListener(MouseEvent.CLICK, btnClickHandler);
    _btThree.addEventListener(MouseEvent.CLICK, btnClickHandler);
    _btFour.addEventListener(MouseEvent.CLICK, btnClickHandler);
    addChild(_btOne);
    addChild(_btTwo);
    addChild(_btThree);
    addChild(_btFour);
    function btnClickHandler(event:MouseEvent):void
         switch(event.target)
              case _btOne:
                   // insert code here for _btOne action
              break;
              case _btTwo:
                   // insert code here for _btTwo action
              break;
              case _btThree:
                   // insert code here for _btThree action
              break;
              case _btFour:
                   // insert code here for _btFour action
              break;

  • How to use one pop up window for multiple buttons and input fields?

    Hi Experts,
    I have created a pop up window that will be opened from multiple buttons in the same view. There are input fields that the data will be populated from a pop up window.  How can I set up which button that a pop up window is opened from? I also would like to populate the data from a pop up window to the input field next to a clicked button. There are 6 buttons and 6 input fields that share the same pop up window. I would very appreciate your responses.
    Thank you,
    Don

    Hi,
    Try creating 2 context attributes, one in your component controller and the other in the pop-up view. Bind the attribute of pop-up view to the component controller attribute.
    In the main view, on click of every button set a unique code in the controller's context which helps you in identifying the button clicked. Since u have created a binding to the pop-up view attribute the value flows from the controller.
    In the init method of your pop-up view, check the value of the attribute and based on that display which ever UI elements are required.
    Eg:
    On Button 1 click set value "B1", Button 2  value "B2" etc. In the init() of pop-up view u can check the values and perform the required operation:
    if(("B1").wdContext().currentContextElement().getButtonIdentifier()){
    else...{
    Hope this helps you.
    Regards,
    Poojith MV

  • How do I disable one item in a radio buttons control at run time

    I need to disable one item in a radio buttons control. At design time
    this is possible, but how do I do this at run time? Is this possible? I
    cannot find a property per item

    Use the property "Controls[ ]" - this gives you an array with references of each single button in the radio buttons control. These you can access with property nodes too.
    Hope this helps.
    Using LV8.0
    Don't be afraid to rate a good answer...

  • Using button control in BEx Analyzer to filter on multiple items

    I'm trying to create a button control in BEx Analyzer to duplicate the following command:
    DATA_PROVIDER=*&FILTER_IOBJNM_1=<StructureID>&FILTER_IOBJNM_2=<StructureID>&FILTER_IOBJNM_3=<StructureID>&FILTER_VALUE_1=<Item1>&FILTER_VALUE_2=<Item2>&FILTER_VALUE_3=<Item3>&MULTI=X
    where <StructureID> is the technical name (the 25-character alphanumberic string) of the structure I want to filter on, and the three items within the structure have technical names <Item1>, <Item2>, and <Item3>. This command works fine on the web, but when I set up a button in BEx Analyzer with the following attributes, it only filters on one item:
    Name             Index  Value
    CMD              1         SET_FILTER
    DATA_PROVIDER    1         DP_1
    FILTER_IOBJNM    1       <StructureID>
    FILTER_VALUE     1       <Item1>
    CMD              2         SET_FILTER
    DATA_PROVIDER    2         DP_1
    FILTER_IOBJNM    2       <StructureID>
    FILTER_VALUE     2       <Item2>
    CMD              3         SET_FILTER
    DATA_PROVIDER    3         DP_1
    FILTER_IOBJNM    3       <StructureID>
    FILTER_VALUE     3       <Item3>
    Any ideas?
    Thanks,
    Jason

    Jason,
    thank you for the information. This morning I found out myself by checking the 3.5 Web API Reference which basically offers everything I need.
    To facilitate data entry you could try using a reference command area somewhere in your excel sheet where you can easily enter the command data and also can make use of copy/paste. I tried this and it works fine - much better than to enter the values in the dialogue.
    Best regards
    Thomas

  • Making multiple buttons out of one picture?

    Ok this is probably a daft question but I'm a complete novice so bear with me. I need to know if it's possible to upload a picture to my Flash stage (a row of buttons I made in photoshop) and then somehow select each of these buttons and turn them into working button symbols? Or do I have to (very annoyingly) upload each button as a seperate picture in a seperate layer before turning it into a button symbol?
    Thanks : )

    kglad knows much, much more than I do and actually helped me out the other day. But, I think I could elaborate a little. Below is exactly what he said, step by step.
    Draw a square> right click> > convert to symbol> name it generic button> ok> double click button> go to the hit frame> right click> insert frame> go to the up frame> right click> insert key frame> click in the up frame again> delete> go back to scene 1
    The button now is transparent (kind of). This generic button is just that a generic button. You can duplicate it or drag it multiple times from the library panel. Place as many as you need on stage. Ex. you have 5 generic buttons on stage. Flash cannot tell the difference between each button. You need to give each button an instance name, so flash knows what button you're talking about when you start writing the code for it.
    Next
    click on a button> properties panel> give instance name (first_btn)> repeat for each button second_btn,, third_btn etc...
    Then write the code to control each button.
    Hope this was helpfull. Just paying it forward.

  • Multiple buttons in one table column

    Hi,
    I was wondering if it is possible to create more than one button in a column?
    If so, how can I do that? (staticlly and dynamically)
    Thanks a lot.
    Cheers,
    Michael.

    Hi Armin,
    I want a table with a column containing many buttons.
    These buttons will be dynamically generated.
    Something like this
    Table
    Col1     | Col2
    ABC     |Button1, Button2, Button3.. Button n
    XYZ     |Button4, Button5... Button n
    All buttons are unique and contains images.
    There could be many buttons in this column/row. This depends on the data.
    Hope this makes it clearer.
    Thanks
    Michael

  • Why are multiple slides under one table of contents button?

    I'm using Captivate 8, and notice that when I preview my course, the table of contents buttons directly correspond with each slide but then after that, the remaining slides are lumped under one table of contents button.  How can I fix this?  In other words, when looking at the table of contents, it looks like my course only has 6 slides when in reality there's 30...many of which are lumped under the last button.

    You have to scroll, they are not under one button at all.
    Good practice is to group slides, then you'll see the hierarchy in the TOC and you are able to collapse all groups. That way the TOC will have a clean look, and the user can open a group to see the individual slides.

  • Multiple Button MouseEvent Listeners not working in continuation in as3?

    Hi,
    I've multple buttons following this drag structure to scale in different direction various corners of the rectangle:
    scale_bottomRight.addEventListener(MouseEvent.MOUSE_DOWN,scaleBottomRight_Start);
    function scaleBottomRight_Start(mEvent:MouseEvent):void
    /*code*/
              mEvent.target.startDrag(true,new Rectangle(scale_bottomRight.x,scale_bottomRight.y,100,100));
              addEventListener(Event.ENTER_FRAME, update_BottomRight);
    function update_BottomRight(event:Event):void
    /*code*/
      scale_bottomRight.addEventListener(MouseEvent.MOUSE_UP, scalebottomRight_Stop);
      function scalebottomRight_Stop(event:MouseEvent):void
                event.target.stopDrag();
      event.target.buttonMode = false;
    scale_bottomRight.buttonMode = true;
    However, after the dragging few buttons, other drag buttons don't work and first button flickers ....... i think not removing eventListeners is the problem.... can anyone guide me what i may be doing wrong and if remove eventListener is the problem, do i need to call them on EXIT_FRAME function (as i don't have one) or within somewhere else?

    Try this:
    scale_bottomRight.buttonMode = true;
    scale_bottomRight.addEventListener(MouseEvent.MOUSE_DOWN, scaleBottomRight_Start);
    function scaleBottomRight_Start(e:MouseEvent):void
              e.target.startDrag(true, new Rectangle(scale_bottomRight.x, scale_bottomRight.y, 100, 100));
              stage.addEventListener(MouseEvent.MOUSE_UP, scalebottomRight_Stop);
              addEventListener(Event.ENTER_FRAME, update_BottomRight);
    function update_BottomRight(e:Event):void
    /*code*/
    function scalebottomRight_Stop(e:MouseEvent):void
              stopDrag();
              stage.removeEventListener(MouseEvent.MOUSE_UP, scalebottomRight_Stop);
              removeEventListener(Event.ENTER_FRAME, update_BottomRight);
              e.target.buttonMode = false;

Maybe you are looking for