noob on SegmentedControl question

Hi there I started coding, and while I use the segmentedControl button, I do not know how to run a function when you press a segmentedcontrol option.

As you can see, I want it when the 'new' is pressed, it instantiates a function that does what I want, but how do I do this? I'm just a beginner and I still have to learn how to code any help greatly appreciated.

Advertisement

Here is an example of code I just wrote which should be able to help you understand the segmented control:

SegmentedControlTest.as:

package{   import flash.display.Shape;   import flash.display.Sprite;  import flash.display.StageAlign;  import flash.display.StageScaleMode;  import flash.events.Event;

  import qnx.ui.buttons.SegmentedControl;   import qnx.ui.data.DataProvider;

  [SWF(width="1024", height="600", backgroundColor="#E8E8E8", frameRate="30")]  public class SegmentedControlTest extends Sprite  {     private var mySegment:SegmentedControl;       private var buttonArray:Array;

      public function SegmentedControlTest()        {         super();

          // support autoOrients            stage.align = StageAlign.TOP_LEFT;            stage.scaleMode = StageScaleMode.NO_SCALE;

          buttonArray = [{label: "Black"}, {label: "Red"}, {label: "Yellow"}];

          mySegment = new SegmentedControl();           mySegment.dataProvider = new DataProvider(buttonArray);           mySegment.setPosition(150,125);           mySegment.setSize(300,30);            mySegment.selectedIndex = 0;

          mySegment.addEventListener(Event.CHANGE, onChange);

          addChild(mySegment);

      }

      private function onChange(e:Event):void       {         trace("A change has been made.");

          switch (e.currentTarget.selectedIndex)           {             case 0:

                  fillBackground(0x000000);

                  break;

              case 1:

                  fillBackground(0xFF0000);

                  break;

              case 2:

                  fillBackground(0xFFFF00);

                  break;

          }     }

      private function fillBackground(value:uint):void      {         this.graphics.clear();            this.graphics.beginFill(value);           this.graphics.drawRect(0,0,1024,600);         this.graphics.endFill();          } }}

Make sure you use the e.currentTarget to get your segmented control and you can access any of its properties. Also note that ounces, you use the SelectedIndex in code when you create, it distributes the Event.CHANGE event. So just be ready for it. Good luck!

Tags: BlackBerry Developers

Similar Questions

  • BlackBerry Smartphones BlackBerry noob a few questions.

    Hello. I am quite new to the Blackberry platform. I was a Windows Mobile user for a long time and now I made the switch. Once an expert with WM devices, but now a complete noob with Blackberry. So please don't be too hard on my noobness . in any case to my questions...

    (1.) I wanted to sign in BB online so I can manage my e-mail accounts in the computer oppose on my camera and it wouldn't let me create a sign in ID or connect. Whenever I have enter my PIN/imei number it tells an account has already been done, but I don't have an account. The only thing I did with my blackberry so far is implemented my gmail on my blackberry account and my gmail info does not appear to be sufficient for connection to blackberry online.

    2.) I have set up my gmail to keep the messages on my machine during 15 days. After the 15 days are up these messages are removed from my email all together? or did he just disappears from my camera, but stay in my email account?

    (3.) from WM platform, I got used to having my calendar on my home screen. I guess I have to download a new theme for my blackberry, but I don't want to bog down the new theme to the effectiveness of my BlackBerry smart phone. That will be the case if I download a new theme or am I just being haunted by fears of slowdown I've experienced with the platform WM glitch? suggestions as to what theme?

    Hello and welcome to the Forums of Support BlackBerry.com.

    k20z3kid wrote:

    (1.) I wanted to sign in BB online so I can manage my e-mail accounts in the computer oppose on my camera and it wouldn't let me create a sign in ID or connect. Whenever I have enter my PIN/imei number it tells an account has already been done, but I don't have an account. The only thing I did with my blackberry so far is implemented my gmail on my blackberry account and my gmail info does not appear to be sufficient for connection to blackberry online.

    You must connect on your BB device and create a user/pw name it for the opening of the office.

    Read here: http://www.blackberry.com/btsc/search.do?cmd=displayKC&docType=kc&externalId=KB14378&sliceId=SAL_Pub...

    2.) I have set up my gmail to keep the messages on my machine during 15 days. After the 15 days are up these messages are removed from my email all together? or did he just disappears from my camera, but stay in my email account?

    Just removed from your device.

    (3.) from WM platform, I got used to having my calendar on my home screen. I guess I have to download a new theme for my blackberry, but I don't want to bog down the new theme to the effectiveness of my BlackBerry smart phone. That will be the case if I download a new theme or am I just being haunted by fears of slowdown I've experienced with the platform WM glitch? suggestions as to what theme?

    It should not. There are a few bloated themes out there (mainly those with animated backgrounds).

    For example, here's one that I use now that I like much, with the upcoming calendar events and the last messages displayed on the home screen:

    http://www.BlackBerryForums.com/Media-Center/152197-today-theme-bold.html

    «"4. the ota today no App film non - packaging zen icons, the background changes requested with background House."»

  • SegmentedControl question

    I have a SegmentedControl Setup with two options.

    According to the chosen option, I want to load a different XML list.

    Is this possible? If so, how?

    I looked at the sample of Battambang and the JSON file confuses me (fairly new development)

    Thanks for your time

    Here goes:

  • NOOB on P2V question

    Thanks in advance for any input-

    NOOB here after having downloaded and saved a VMware vSphere on a single server hypervisor (quad core Xeon 22 Gb ram 4 NIC and disk of 1 TB Raid 5). First attempt, use the converter stand alone on my PC. Worked perfectly. Then Server #1 Windows 2003 SP2 on IDE drive. A ran "Convert the Machine" even under XP. BSOD on startup. No safe mode. Attempted to change Boot.ini od but file was accurate. Reran conversion more than 2 times the same result. Then, the server #2. Once again Win 2003 SP2. Ran "convert to Machine. Web information found and ran "Configure machine" after sysprep installation correct files including install VMware tools. Exact same results except that now I get a VM splash screen before auto BSOD then reboot. Able to access safe mode. BSOD before anything else. What the hell I'm missing?

    In the converter (step 3) wizard select 'trick' and the "disk controller" the value of "Preserve the Source" "LSI Logic.

    André

  • Noob to AS3, Question

    Of course I don't expect anyone to write all this for me, I just need a point in the right direction. If someone could just help me start and explain how I could do this, I would be very happy.

    I have little programming experience (but I understand the fundamental principles), and I'm working on a project in Flash CS5. I put it in place where there are 16 text boxes and a 'play' button. When you press play, the Flash file should check the text box and check if one of about 10 different text strings is present. If so, it must issue a sound signal according to what channel is present. Then, he must wait a second, go to the next text box and do the same thing, and so on for each text box. Each text box would be check the same different channels, and each channel would correspond to a single sound.

    I'm sure it's really simple, but I'm really new on this. Thank you!

    the sounds should be in your library and have an assigned class.  If you load sounds there is a delay caused by the loading file which will cause problems with your timing.

  • Noobie layers? Question

    Hi all, I am new to photoshop and I have an interesting problem. I'm trying to do a background image for a Web site, so far I can see well enough set up but I want to only certain parts of the image to stay on top of the "Press Center" section of the site. Example is here:

    http://www.Vigil-Guild.com/

    What should I do in the picture to make sure they can stay on top (Im assuming that I need 2 images... being the normal background and the second being the parts that I want to stay top of page to connect to the first.)

    Save your piece of foreground image in a format that supports transparency, such as .png.  Carefully place the images in your HTML layout, so that they line up, the image that you want to be on top expressed after the pieces of information.

    The .gif format supports transparency as well, but it's much more limited it can carry only 256 colors.  It has the advantage of being able to ongoing animation, however.

    To create a partially transparent image in Photoshop, do the image layer (you can do this with a simple background image by double clicking on the background in the layers palette), then simply erase the parts you want to be transparent.  In Photoshop, you'll see a through the transparent parts checkered pattern.

    -Christmas

  • Noob on UNDER question forms packet

    I found a component of low caliber I want to use but cannot make it work. It's a bunch of actionscript that I imported with a CFC file and the IDE recognizes the title when I try and work with her. the error I get is "could not resolve < local: LightGauge > to an implementation of the component.

    I got the site code http://www.betterthanflex.com/?p=9

    Thanks for the tips!

    I just deleted the files in the src folder and typed the code in the previous message

  • BlackBerry Smartphones retrieivng emails from the server after end of Verizon contract.

    I have my contract with Verizon has just ended, has got a new phone (not a BB), enabled and then realized after that I had no way to access any new e-mail that came to my acct vzw.blackberry off, it.

    How can I do that.

    My apologies in advance if I is a totally noob or the question that has been answered previously. just frustrated!

    Is an e-mail address '[email protected] '?

    These emails are visible ONLY using your BlackBerry, no other device or computer.

    Sorry... When you have removed your terminal BlackBerry and your account, you have lost your access to this mail.

  • AE problem make given the constraints of format

    Good so I'm doing my first all the video in Ae(its an introduction). I'm really happy and I'm just as mourad makes it * and brag to everyone I know about what Ae hardcore user I am, when adobe makes my video of 8 sec to about 1.2 GB and I'm just like waiting is not right and I started googling and apparently many people face this problem and it can easily be solved by compressing your video more far by setting your DV NTSC, PAL DV or DV (24 p advanced) video codec. I go ahead and change the video codec and the BAM 'Parameter Mismatch'. It shows that all of these codecs operate at 720 x 480 Max while I was working on my original project was created in 1920 x 1080. If I still continue with this and make my audio not not synchronize and is a few seconds behind that there where it should be at the origin. This is because is executed in 1920 x 1080 at 30 fps while 720 x 480 runs at 25. If someone familiar with this problem was help me I would be indebted to you.

    All the good guys its my first time on this forum and I might sound like a noob asking this question, but Googling it does not clear results.


    Thanks in advance

    Member user Ae

    You do not want to be using standard codecs, you want be using Adobe Media Encoder to render files to the h.264 format using a standard HD preset. Check out the third video here: Basic Workflow

  • QLogic 8 Gb/s FC and sharing VMs

    I'm a noob. ask a question.

    If I have 10 VMs on a server ESX; and install the adapter HBA from Qlogic 8 Gb/sec

    What will be the effective advantage?

    How much bandwidth with each VM get? actions will be based on time; That is, each virtual machine can get 8 Gb/s by a slice of time or is - this 0.8 GB/s for each virtual computer?

    Thanks a ton

    Hello

    I have 4 VMs. I assign 7000 shares of disc for the first 1000 for the rest 3.

    Here, my first VM able to use 70% of the 8 GB/sec of the HBA will be i.e. 5.6 GB/s.

    This could be the case.

    y at - it no limit on how much each virtual machine can IO?

    The limit of the available bandwidth.

    It's one that you will get the farthest http://www.vmware.com/support/pubs/vi_pages/vi_pubs_35.html in particular http://www.vmware.com/pdf/vi3_35/esx_3/r35/vi3_35_25_resource_mgmt.pdf and http://www.vmware.com/pdf/vi3_35/esx_3/r35/vi3_35_25_admin_guide.pdf

    Best regards

    Edward L. Haletky

    VMware communities user moderator

    ====

    Author of the book "VMWare ESX Server in the enterprise: planning and securing virtualization servers, Copyright 2008 Pearson Education.»

    Blue gears and SearchVMware Pro Articles: http://www.astroarch.com/wiki/index.php/Blog_Roll

    Security Virtualization top of page links: http://www.astroarch.com/wiki/index.php/Top_Virtualization_Security_Links

  • Noob question: Playbooks all have the same performance?

    I know... noob question. I am to complete my first game PlayBook and before I submit the app store I wanted to make sure that hardware performance will be the same on all the playbook or will it be something because of the performance issues on a per-device basis? I hope that this will be similar to a console where you can expect stable performance. THX.

    All devices (currently) work the same in the same conditions.

    That does not mean, however, that you can treat it as a console.  A console runs only a game and nothing else (in general).

    The PlayBook can run multiple applications, and among other things, a user can 'Behavior of the Application' setting configuration Mode Showcase, default, or standby, what determines if your application runs or stops when it is idle.  If they are in window mode, they may have other things at the same time.

    To a first approximation, however, "even in the world" is probably correct, for now.  Don't forget there will be different tablets in the future, with specification different but compatible with your app... not quite like a console there where many games is basically orphaned (or requires a port) when a new generation comes out.

  • Noob question: autonomous AIR .bar files?

    Sorry for the noob question, yet to learn these things from the air. When we create a .bar file, it is the only file position, does it include the runtime air, flash, etc, etc, or is it always require an accumulation of air / flash runtimes on the device? THX.

    The .bar file does not include the time of execution because the runtime is already preinstalled on the Playbook.

    Air is really integrated into the PlayBook so you don see the difference between a native app or an Air application.

  • Noob question, youtube

    Hi im a noob to photoshop etc, and has recently started a YouTube channel for downloading music.

    Ive seen several channels that resemble the type of this http:/// www.youtube.com/watch?v=Apc4XT8xUvghttps://www.youtube.com/watch?v=Apc4XT8xUvg

    Does anyone how to make a video like this with snowflakes etc. and what program to use?

    Sorry if this is the wrong forum to ask this question in.

    I'm guessing that Adobe After Effects (perhaps with a plug-in):

    Video effects, Visual effects software | Download the free trial version Adobe after effects CC

    Can pick up a quick getaway in the After Effects forum and see what they say here as well.

  • NooB question: Cup titles and a schedule of transfer

    Let's say I have tons of tracks.  In the Middle, I find I want to firm up a few seconds of footage.  I can cut, or delete the clip, but I still have to select all the following clips and make sure they move upward.  There must be a smarter way of removing a few seconds of footage and moving upward?

    Sorry for the noob question, I searched on google and didn't know what to look for.  I am open for more information that can help me to tighten my research thus.  See you soon.

    The answer will probably depend on more factors:

    Are there in your Timeline, Clips above the area of the Clip you want to Trim?

    What you want to happen to those?

    Are you only concerned to "strengthen" the Clips on the same video track where you cut, or Clips on other tracks video too?

    It is likely that the tool Edit Ripple, or Rt-click and Ripple delete, will do what you want, but who can count on the other Clips on other tracks, and video that you need.

    Good luck and please let us know a little more.

    Hunt

  • D.I. box noob question

    Hi all

    Sorry for the noob question, but I need something clear up if possible. I was about to buy a box for injection and then had a query on them, and if I actually could benefit in this scenario...


    Fig 1. is how I currently record.

    Fig 2. is how I would do it with di direct box

    diag.jpg

    My question is... in this configuration, the d.i. box would make a difference to the signal? or he would only make a difference if I was going to live guitar to box, the sound card?

    Thank you for all your help.

    In my opinion you have basically three alternatives for the recording of the guitar:

    1. get an amp excellent sound, recording with a microphone, or more, in a room of good survey.

    Challenges: you'll probably need a studio proper, or at least no neighbours, because it could become LOUD. It takes time and experience of mike a good amp and even microphones expensive (several). Result depends on the acoustics of the room more than you think.

    Another way here, is to get/build an isolation area around your amp, which will be a kind of micro studio for it, allowing you to play hard and with a good tone, but in a more controlled environment. Many advantages for this make. Unfortunately, the expense can also be 'pro' - but I don't know there are DIY solutions.

    2. record of the amp 'dry' via either its line (send FX will also) or use a ' soaking power allowing you to put the amp (some sounds so much better AMPS), but with a low volume in the room. You can connect the device of soaking directly, or give the speaker the "tame" signal and mike the amp without disturbing the neighbors that it now. Good power soaks don't come cheap (?). Dry recording, for example by not using mike, often sounds like this: dry. It depends on your style of music, but an electric guitar should probably be considered an acoustic instrument. Instead of a diaphragm in wood, it has a speaker. The sound, often, we want to achieve is an amp of good sounding in a good room, which is an acoustic sound. You simply cannot get to an exit row or direct to a soaking of output power (not president). He needs treatment.

    3 use a program like GuitarRig, Amplitube etc. No installation required, regardless of the size of the room and acoustic sound (except that the acoustics of the room always will affect listening!) or mike. The software simulates the amps, effects and even mic configurations; added the "airplane" that you will not get a direct connection. Once again, according to your style. If I were Bill Frisell or Jim Hall, i.e. anyone with an as most of their music very "naked" guitar sound, I probably does (but these guys have access to the great engineers too...), but in a pop idom / mixed rock with other instruments and certainly to do demos, that's actually what I would recommend. Especially for us space challenged who have neighbors and an infinite time either. No, you will not look like 'all the world'; It's garbage in French - garbage out as always (many are disappointed by the present, but some are happy, it is always the case)

    All you need is a sound card with an instrument of entry. If you have a * good * sound card already who is not entered instrument, you can consider a DI box. Otherwise I'd say it's redundant.

Maybe you are looking for