Change of the style of the button created dynamically another button click

Hi all

I worked on a small project at home, learning Flex and Actionscript I'll (he is great, BTW) and have hit a block.

I'm building a screen with nested containers (HBox, VBox, tiles, etc.) eventually hold a number of dynamically created buttons. It all comes from a file of XML data using loops For. Each button is assigned a unique ID.

My problem is that I have a set of buttons in an Accordion component. Each button accordion relates to a dynamically created button already on the screen. Thus, 'Step 1' on the accordion can refer to "part 5". This info is organized as a string in the .data step button. If a user clicks on the 'Step 1' button, I want to change the style of "part 5", so I need to be able to reference these buttons according to XML in step 1 data.»

I tried to use the normal setStyle, but appears not to work because I can not convert a 'Part 5' representation to the real dynamically created "5" the component button.»

So my question you fine people is: " How to change a button dynamically created on the other only a string that represents the ID of the button?'." "

If all goes well, there is a simple way to do this (without having to navigate a tree of components). Any help would be appreciated to a new learner in Flex. If you need more info on the problem, please let me know.

Thank you...

Thush

Edit: I think that the answer is perhaps in this thread here. That said to use a table associative to contain the ID of the components during the creation time and to use the table to make reference to them later. I will try that and see if it works. Fingers crossed!

Edit 2: I cracked! First of all, I used a dictionary to store the array of objects. This used the Dictionary package (imported) and the creation of the Dictionary object.

Then I added my dictionary objects when they are created.

Finally, I have the buttons using the object dictionary based on a known ID string of the reference.

Hi all

I worked on a small project at home, learning Flex and Actionscript I'll (he is great, BTW) and have hit a block.

I'm building a screen with nested containers (HBox, VBox, tiles, etc.) eventually hold a number of dynamically created buttons. It all comes from a file of XML data using loops For. Each button is assigned a unique ID.

My problem is that I have a set of buttons in an Accordion component. Each button accordion relates to a dynamically created button already on the screen. Thus, 'Step 1' on the accordion can refer to "part 5". This info is organized as a string in the .data step button. If a user clicks on the 'Step 1' button, I want to change the style of "part 5", so I need to be able to reference these buttons according to XML in step 1 data.»

I tried to use the normal setStyle, but appears not to work because I can not convert a 'Part 5' representation to the real dynamically created "5" the component button.»

So my question you fine people is: " How to change a button dynamically created on the other only a string that represents the ID of the button?'." "

If all goes well, there is a simple way to do this (without having to navigate a tree of components). Any help would be appreciated to a new learner in Flex. If you need more info on the problem, please let me know.

Thank you...

Thush

Edit: I think that the answer is perhaps in this thread here. That said to use a table associative to contain the ID of the components during the creation time and to use the table to make reference to them later. I will try that and see if it works. Fingers crossed!

Edit 2: I cracked! First of all, I used a dictionary to store the array of objects. This used the Dictionary package (imported) and the creation of the Dictionary object.

Then I added my dictionary objects when they are created.

Finally, I have the buttons using the object dictionary based on a known ID string of the reference.

Tags: Flex

Similar Questions

  • IProcurement, can I change the requisitions created by another user?

    Hello

    IProcurement, can I change the requisitions created by another user? If so, how to set? Thank you.

    Concerning

    Leo

    Hi Leo,

    iProcurement is designed for the entire organization, and threre is a few restrictions as only the picker can modify the request. In rellease 12, there is a concurrent request to change the preparer if necessary:

    How to change mass employees end/unavailable (applicant, trainer) in the approval of the application and the process of application for change of version 12.1 (Doc ID 1432778.1)

    Thank you

    Clarino

  • I have 9, 1 pages in PDF files that are accessible and the need to combine them into 1 PDF file.  I tried adding, adding and the combine process of PDF files. The file created does not take my changes. The file created is partially accessible, but I have

    I have 9, 1 pages in PDF files that are accessible and the need to combine them into 1 PDF file.  I tried adding, adding and the combine process of PDF files. The file created does not take my changes. The file created is partially accessible, but I have to re - the problems that I had fixed in the unique files. I need suggestions on what else can be done, if any. Using Acrobat pro XI.

    By habit, I tend to combine PDF files in the Page pane by right-clicking thumbnails then 'Insert of Pages'-> 'From File'. For me, this preserves the tags of these two documents, although the tags may have to be moved to the correct location (if I remember correctly the tags for inserted pages are put at the end of the tag structure, regardless of where the pages are inserted), if I put the tags in the document to insert into a container as a Section tag It makes the process easier. Travel set of tags in the right place is the only re-fixing that I remember having to do. What behavior you encounter?

    a 'C' student

  • Presets are not active, IE when I roll the cursor over them, nothing changes in the navigation panel, and when I click on one, nothing changes. Can anyone help. Thank you.

    Hello

    I installed LR CC last week and I'm working through the tutorials. My Presets are not active. When I roll over the presets with the cursor, nothing changes in the navigation panel. If I click on one, nothing happening either. Can anyone help?

    Try to uncheck the option preferences > performance > CPU graph use.  There is an obscure bug that causes presets do not display correctly.  Not sure if it will affect, but it is easy to try.

    If this does not help, try to reset the preference of LR: reset the lightroom - updated - Lightroom Forums preferences file.  LR soils is not uncommon of preferences, and when that happens, their reset may fix a surprising number of behaviors wobbly.

  • Revision quiz - how to change/customize the buttons in CP7 - now show 'back' and 'jump '.

    Hello

    I use 7 CP and giving learners the opportunity to review the quiz questions. The magazine works well enough, but the buttons at the bottom are not correct. Say, Back and Next or continue. I don't see a pattern of slides to do this, as the results of model slide, where I can edit. Not found something useful again in the preferences of the object. Would be as well to position them. Thank you.QuizError.png

    Well, I'd rather go to another when the learner has decided not to respond again. Then... I changed the main slides for questions to use Skip instead of the next. So if I change the Question back to the next master slides, it might work?

    It is a revision of an old project created originally to the CP3.

  • Disable a button until all the buttons clicked

    Hello

    I have a menu of 7 buttons on a slide that launch the .xml files from 'Success show script' and show the checkmark. I've got this works well, but I want the button 7, certificate, remain disabled until all 6 user buttons were clicked in order any.

    I wrote various advanced conditional actions, and I can't do things.

    I created 6 variables called topic1, topic2, topic3, etc., defaults to 0.

    The cert of the Action set to move to the slide but I was testing just the IF statement, it does not jump to slide either haha.

    What I'm doing wrong!

    Thanks for advance-METZ

    cap1.pngcap2.pngcap3.png

    Yes, I explained that the first decision should look like in my previous answer.

    First decision "always."

    IF 1 is equal to 1

    Assign Topic1 with 1

    Show... or open a URL of what you wanted to do with the standard action

    Second decision ' CheckComplete

    IF Topic1 is equal to 1 AND

    Topic2 is equal to 1 AND

    ...

    7 turn on the you will need to disable start with, since you say that you do not leave the slide, this can be done with the action on enter

  • Avoid the button clicks duplicated in the structure of the event

    Hello

    I have an apparently easy problem that I can't solve. I enclose a VI that illustrates my problem.

    My problem is this: when an event runs, the OK button is disabled, but if the user clicked the event is pending, and when the process is finished, another will start immediately. The only reason why I turn off the button is to avoid this queuing event. The mechanical action of the button is set to the switch until release (so that the button just get after that I have let go of it).

    How can I avoid this?

    Thank you!

    First of all, your mechanical action seems wrong.  By releasing latch and then move the button in the case of the event.  Currently, you use the switch to exit which is contagious stocks on the top and to the bottom of the query.

    Second, do not check the box that says 'Lock Front Panel until the end of the matter for this event'.  Notice that it has parentheses that say "reporter treatment of the actions of the user" which means he waits until the case ends (the date at which the button was reactivated).  You are basically defeating the entire purpose of the deactivation of the control because defer you the intervention of the user until the button has been reactivated.

  • Simulate the button click in panels of void

    Hi all

    I want to simulate click for buttons (with an action mechanical latch) located in sup VI Panel in order to trigger its action. But I could not do this in the way I can simulate a click for all other buttons in the main VI. I have attached a sample program to explain my problem, please let me know what is my mistake.

    Thanks in advance,

    Roger of S.G.Sree.

    just a small mistake.

    Jim you missed it.

    You can go there.

  • Click management problem in the controls created dynamically events

    I'm creating the ObjectListField loop i-e (CustomObjectListField class is extended by the ObjectListField to customize its behavior) but the problem is that only by clicking the list no. 5 is managed other lists click handling is not manipulated thr id mylist2...

    CustomObjectListField mylist2;

    for (int i = 0; i)<>

    {

    mylist2 = new CustomObjectListField();

    }

    and click on manage using method...

    protected boolean navigationClick (int status, int time)
    {

    if(Field==mylist2)
    {/ / implementation of a feature}

    }

    }

    pls help

    Hello Shaina

    Your code is not so clear. I don't know why you're my differrrent creaing objects and passing them to the same reference. The last (the 5th list) one will be that which makes reference. In your method of navigation click you compare the rating with mylist2 that contains the reference to the list 5, it's why you have found the events for 5th list only.

    You must create an array of objectListfield, assign values to it and then use part of this comparison table.

    CustomObjectListField mylist2 [] = new CustomObjectListField [5];

    for (int i = 0; i)<>

    {

    mylist2 [i] = new CustomObjectListField();

    }

    and click on manage using method...

    protected boolean navigationClick (int status, int time)
    {

    if(Field==mylist2[0])
    {/ / implementation of a feature}

    }

    if(Field==mylist2[1])
    {/ / implementation of a feature}

    }

    if(Field==mylist2[2])
    {/ / implementation of a feature}

    }

    .

    .

    .

    .

    .

    }

    It may be useful

    Thanks Pierre

  • Warning Dialogues - cannot capture the button clicks

    Now that I can finally connect to the Simulator with the debugger, I can come back and work on my app!

    I'm trying to be on the QNX Dialogue class... specifially the AlertDialogue, that I will use for the warning of use of data like most of you...

    I looked at the example code, but for some reason, I can't click on the events of the Dialogue...

    Here is my code:

    package com.content.modal{  import flash.display.Sprite;  import flash.events.Event;    import flash.events.MouseEvent;
    
     import qnx.dialog.AlertDialog;    import qnx.dialog.DialogSize; import qnx.display.IowWindow; import qnx.events.DialogEvent;
    
      public class AirtimeUsageModal extends Sprite {
    
           private var alert:AlertDialog;
    
          public function AirtimeUsageModal()       {         init();       }
    
           private function init():void      {         alert=new AlertDialog();          alert.title="MY TITLE";           alert.message="MY BLURB HERE.";           alert.addButton("Quit");          alert.addButton("Acknowledge");           alert.dialogSize=DialogSize.SIZE_SMALL;           alert.addEventListener(DialogEvent.DIALOG_BUTTON_CLICKED, alertButtonClicked);            alert.show(IowWindow.getAirWindow().group);
    
          }
    
           private function alertButtonClicked(e:DialogEvent):void       {         trace("Button Clicked Index: " + e.target.selectedIndex);         trace("Button properties Object"+e.target.getItemAt(e.target.selectedIndex));         trace("e.responseBtn" + e.responseBtn);
    
             if (e.responseBtn == "Quit")          {             quitApp();            }         else if (e.responseBtn == "Acknowledge")          {             this.dispatchEvent(new Event("startApp"));            }     }
    
           private function quitApp():void       {         stage.nativeWindow.close();       }
    
       }}
    

    My problem is that I can't capture the click event... my tracks in alertButtonClicked never fire... When I click on a modal button disappears... And I get this in the output:

    Response of dialogue show null null
    Receipt of RESPONSE from the server: @control 1
    BaseDialogService.receiveResponse

    Any ideas what's happening here?

    This is a known bug. Please use EVENT. SELECT a workaround until this has been resolved.

  • How to get the menuitem created in another class

    Hello

    I created a class. on the inside I added a few menus using addMenuItem (Map);

    final class UserInterfaceTouch extends MainScreen
    {
    
     UserInterfaceTouch() {
            super();
    
            LabelField title = new LabelField("Nutiteq SDK Map Sample",
                    LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
    
            setTitle(title);
            addMenuItem(_test);
    
        }
    MenuItem _otest = new MenuItem("Testing, 10, 10) {
            public void run() {
                --- code for doing some thing
            }
        };
    }
    

    How do I acess the menu in the class thus form another class, is it possible to do so.

    Thank you

    SujithRavindran

    Sorry for posting this.

    I got the answer.

  • How to change all the colors specific to another color.

    Can someone tell me how to change all the colors in Illustrator by another color at a time.

    I've worked in Freehand, and you can select all, go in a Panel and make the change

    all from one color to another in a layout.

    Exp. You can change pms 356 to pms 410 without selecting each one individually.

    I can't find this feature in Illustrator CS4

    Any help appreciated

    HJMann42

    Left is simple to do, said Kurt.

    Go to the Swatch Panel, select pms 401 that cmd select pms 356 go to the menu drop down and select Merge shades.

  • Want to keep track of the button clicks

    Hi, I'm new to Flash and I use CS4.

    What I want to do is to collect a user's comments, and whenever they click a button of some, in this case the button YES, I would like a number added to the var such as partition ++. In this way, I can use a case statement at the end to guide the user to the right product.

    However, my code does not work, so if someone could take a look, I would be grateful.

    Thank you

    var score:Number = 0;
    var score_txt:TextField = new TextField();
    score_txt.x = 150;
    score_txt.y = 125;
    score_txt.width = 100;
    addChild (score_txt);
    
    yes1_btn.addEventListener(MouseEvent.CLICK, yes1);
    function yes1(event:MouseEvent):void {
         soundControl1 = sound1.play();
        gotoAndStop(6);
    }
    
    if (yes1){
         score++
    }
    score_txt.text =  + score +  " total score"
    

    Try to move the lines after the function in the function, even if you don't need the conditional...

    function yes1(event:MouseEvent):void {}
    soundControl1 = sound1.play ();
    gotoAndStop (6);

    Note ++;

    score_txt. Text = + mark + "total score".
    }

  • Change the color of the text on the button click

    Hi, how I would change the text with color while the application is running?

    For example, when the user clicks a button, how can I change the color of the editfield with already inserted text?

    I realize that I could add the editifled with different colors, but I was wondering if there is a way to do this without adding new editfield - like refreshing the editfield with different text color.

    Help is very appreciated!

    First, create your own custom class that extends EditField.

    It can be as simple as this:

    public class MyEditField extends EditField {
      private int _color = Color.BLACK;
    
      public void setFontColor(int color) {
        _color = color;
        invalidate();
      }
    
      protected void paint(Graphics g) {
        int prevColor = g.getColor();
        g.setColor(_color);
        super.paint(g);
        g.setColor(prevColor);
      }
    }
    

    Once you have this class, you can use it like this:

    final MyEditField textEntryArea = new MyEditField(...); // any EditField constructor can be used
    
    ...
    FieldChangeListener buttonListener = new FieldChangeListener() {
      public void fieldChanged(Field field, int context) {
        if (field == setToRedButton) {
          textEntryArea.setFontColor(Color.RED);
        } else if (field == setToBlueButton) {
          textEntryArea.setFontColor(Color.BLUE);
        }
        // etc.
      }
    };
    ...
    setToRedButton.setChangeListener(buttonListener);
    setToBlueButton.setChangeListener(buttonListener);
    ...
    

    Edit: fixed a few typos.

  • Change the color of text on the button click

    I found many ways to fill out / change the box around a field (both types) but not a way to change the color of the font.

    I tried:

    Form1. Page1.wTextField1.TextColor = ['RGB', 0.5,0.5, 0];

    Form1. Page1.wTextField1.textColor = color.black;

    All hope?

    Try

    Form1. Page1.wTextField1.font.fill.color.value = "0,0,0";

    Steve

Maybe you are looking for