Managing several components with the same set of button

Hi everybody,
I would like to have in my application a set of videos gathered in one row. Under the videos there are control buttons located. This part is quite simple.
I would also like the buttons to control the selected video. And this is where the problems begin. Initially, the buttons will manage the first video in a row. However, after selecting another video, the should manage the selected one. I have some dificculties with implementing a function that would override the CLICK attribute of the buttons after selecting a desired video. I am not sure if this is the best approach but don't have other ideas. What is a possible way to do it?
This is a part of the code:
<?xml version="1.0"?>
<!-- Simple example to demonstrate the ViewStack layout container. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
        <![CDATA[
            private function activateControls(event:MouseEvent):void
                if (event.currentTarget.id == "video2")
                    play_button.click = "video2.play()";     // This does not work
        ]]>
    </mx:Script>
    <mx:Canvas width="629" height="236" id="panel_t">
        <mx:VideoDisplay click="activateControls(event);" x="10" y="40" width="198" height="133" source="video/video.flv" id="video1"/>
        <mx:VideoDisplay click="activateControls(event);" x="216" y="40" width="198" height="133" source="video/video.flv" id="video2"/>
        <mx:VideoDisplay click="activateControls(event);" x="422" y="40" width="198" height="133" source="video/video.flv" id="video3"/>
    </mx:Canvas>
    <mx:Canvas width="629" height="40" id="panel_b">
        <mx:Button label="PLAY" height="40" id="play_button" click="video1.play()"/>
        <mx:Button label="PAUSE" height="40" id="pause_button" click="video1.pause()" x="65" y="0" />
        <mx:Button label="STOP" height="40" id="stop_button" click="video1.stop()" x="138" y="0" />
    </mx:Canvas>
</mx:Application>
Thanks,
flexynewbie

You're going about it the wrong way.
A button component doesn't have a "click" property, it dispatches a "click" event.
So what you need to do is assign an event handler to the button click event, just like you did for the VideoDisplay instances.
What you can do is store a reference to the selected VideoDisplay (which is why I mention in your previous thread you don't need the id at all) and use that when a button is clicked.
private var selectedVideo:VideoDisplay = video1;
private function activateControls(event:MouseEvent):void {
     selectedVideo = event.currentTarget as VideoDisplay;
private function playClickHandler(event:MouseEvent):void {
     selectedVideo.play();
private function pauseClickHandler(event:MouseEvent):void {
     selectedVideo.pause();
etc..
<mx:Button id="play_button" height="40" label="PLAY" click="playClickHandler(event);>
<mx:Button id="pause_button" height="40" label="PAUSE" click="pauseClickHandler(event);" />
<mx:Button id="stop_button" height="40" label="STOP" click="stopClickHandler(event);" />
Alternativly, you could use the selectedVideo in mxml, but that's usually not a good idea.
<mx:Button id="play_button" height="40" label="PLAY" click="selectedVideo.play();>
For instance, in this case, you probably want to stop all other videos before playing the selected one, or some other stuff may need to be done. That can easily be done in the button click event handler.
As a sidenote, you should look into using a different container than Canvas, for easier auto-layout.
A VBox might be better suited for displaying the VideoDisplay instances. No need for all the x, y positioning. Same goes for the Buttons, use an HBox container there.
Control the gaps and padding with verticalGap, horizontalGap, paddingLeft, paddingRight, paddingTop, paddingBottom of the containers, all of which can be set through CSS.

Similar Messages

  • Firefox will not open after installation. i have tried to install several times with the same results. installation sends a list to firefox each time. need help. willard lee

    will not open after installation. i have tried to install several times with the same results. installation sends a list to firefox each time. need help. willard lee

    Can you attach a screenshot or link to the instructions you are following?
    You are on the 3.6 release and Firefox 7.0.1 is out. You can download and install the latest release from http://www.mozilla.org/en-US/firefox/new/ if you would like to update now. The 3.6 version will be maintained for a while longer, but you should update when you can.

  • SMQ2 Error :Several modes with the same number  at activity 2N

    Hi,
    We have some Ques stuck in APO inbound "Several modes with the same number  at activity 2N". Can anybody help me to fix this.?
    Sameer.

    Hi Sameer, indeed your issue seems to be linked to PDS creation. Your PDS CIF jobs must be failing if I am not wrong.
    You would need to identify which PDS in APO (or which version in R/3) has issues.
    Go to CQ transaction mentioned earlier, select teh row containing the issue, and then click on the display icon on the right side top. This will show you the entries in the internal tables taht were being passed on in the CIF.
    From here, you need to identify the production version from R/3 that is having issue. I don't have a stuck queue at hand, so can't tell you which table would contain information. Somewhere you would find out the name of the product/location that is having issue, and then you need to check what is the issue with the version. Seems the same mode is being used multiple times in some activity, or in R/3 side, the same resource is being used multiple times in a single activity.
    Thansk - Pawan

  • Every time I create an account with iCloud then try to open it I get wrong ID or password. Even when I enter my birth date I am told it is incorrect. I have done this several times with the same results.

    Every time I create an account with iCloud then try to open it I get an error message: wrong ID or password. Also when I enter my birth date I am told it is incorrect. I have done this several times with the same results.

    Oldcameraman
    Please do not duplicate a thread. The threads are answered as soon as possible. We are not Adobe. Just user to user.
    I have answered your most recent of the duplicates
    Premier Elements 13 Organizer Works. Editor doesn't. Log in doesn't work
    It is uncertain just how far we can go to help you since you do not appear to have Premiere Elements any
    longer.Seems you demanded a refund from Adobe Chat, got it, and now are left with a non purchased program which I
    am not sure can be used.
    Duplicates tend to confuse the person asking the question as well as those attempting to reply. As I suggested in the
    above mentioned thread, try to sort out your situation with Adobe via its Adobe Chat.
    ATR

  • There is a little camera icon on a movie clip when I try to import it to iMovie from my iPad. I have reimported several times with the same result. When I disconnect the iPad I can no longer view the clip. Help!

    There is a little camera icon on a movie clip when I try to import it to iMovie from my iPad. I have reimported several times with the same result. When I disconnect the iPad I can no longer view the clip. Help!

    Hi eawaters,
    If you are having issues importing video from your iPad to your Mac for use in iMovie, you may find the following article helpful:
    iOS: Import personal photos and videos from iOS devices to your computer
    http://support.apple.com/kb/ht4083
    Regards,
    - Brenden

  • Several users with the same login/Customize

    This may seem a stupid question. But
    I have several users login ,by department rather than creating hundreds and grouping them.
    Then on the reports I have created I have put quite a lot of customizable options. I have not given them the save button on the customize page, however as I thought this would effect the defaults for other users logging in with the same login.
    However I am finding that even without this if they customize a report. Then another person logs in they pick up the changes they have made. Is there a way to stop this?
    Thanks,
    Craig

    Craig,
    If I understand it right, you basically are having several users log into one account, this should never be done, especially in OLTP environments or even OLAP where the data is sensitive. You'll have the issue you described (standard features break or don't work as expected), limit your auditing options (the database and the provider can't tell who did what all the time), increase complexity of user management (when user A no longer needs access, how can you deny him/her access without effecting those that still need access), limits development of new features (method is non-standard) and generally causes security head-aches (auditing, user management complexity, etc.). Users are not expensive objects (sessions are but you'll have as many either way).

  • How to manage two iclouds with the same Apple ID

    My wife and I share the same Apple ID and the same ICloud, but now we have shared all our contacts. Is there a possibility to create to IClouds to manage different contacts and agendas but with the possibility to continue using the same Apple ID to purchase in Itunes?

    Just create a new iCloud account for one of you and sign in with it in System Preferences (or Settings)>iCloud. You can retain the common ID in iTunes - there's no problem about iTunes and iCloud having different logins.

  • My Firefox opens to a completely blank screen with no menu bars or anything. I've uninstalled & reinstalled several times with the same problem. Help!

    I opened it this morning with no problems, went to my g-mail account, pulled up an e-mail, clicked to reply, typed my respons, but when I hit send, everything went completely blank.
    I have no tabs, no menu bars... nothing but the firefox logo on the top left corner and the minimize, full screen/small screen, and close/x buttons on the top left corner... that's it.
    I uninstalled and reinstalled several times, but nothing works.
    What now?

    Whoops... didn't see the update...
    You say "could you see if you have the same addons installed." How do I do that, when I can't get it to open with anything but a blank screen?
    I added Ghosery and Ad Block Plus... and also something similar to Ghosery, but I can't rememeber the name. I added that first... before Ghosery.
    Anyway... if I completely uninstalled and then reinstalled, wouldn't I have to reinstall the add ons later?
    And I did run a scan of my system with security software... it didn't find anything.
    However, when I uninstalled, it uses a Firefox Uninstall Wizard... and in the wizard, there is an option to "Remove my Firefox personal data and customizations," but when you check that, it says, "This will permanently remove your bookmarks, saved passwords, cookies and customizations. You may wish to keep this information if you plan on installing another version of Firefox in the future."
    I don't save passwords, don't care about the cookies, but the bookmarks took forever to collect, and I don't want to loose them.
    Anyway to save or copy the more important bookmarks somewhere else?
    Would clicking this option also remove the addons... and maybe that might take care of the possible malware problems that you're talking about?

  • Can I manage multiple iPads with the same Apple ID?

    I have a client that will have 4 iPads at a trade show to use as displays for a small animation about their product. We will need to install a kiosk app from the app store on all iPads. I'm confused about how Apple IDs fit into all of this. Will I be able to use the same Apple ID for all 4 iPads and install the kiosk apps on all 4 devices? I realize I might have to pay for the app 4 times, which I'm fine with.
    I found the iPad Configurator app, but since this is for a client, I dont want my work computer being used as the "main" computer to control them. Do I have any other options? I guess I'm looking for the best way to get the same apps on 4 different iPads using one Apple ID if that is possible. Thanks for any info!

    Yes - you can use the sasme AppleID on multiple iOS devices, and install the same apps. You can downoad the apps directly to the device (via WiFi) and not neccessarily need to synch them.

  • After installing the last version of iTunes, it failed to lunch and gave me 2 Error messages with Error 7 title , rebeat installation several times with the same Error message, what shall I do?

    Once I finish upgrading iTunes on my Windows PC, I had an Error as t shown on the image below which doesn't allow the iTunes App to lunch.
    Please advise what shall I do ?

    Uninstall your existing copy of iTunes. Delete any copies of the iTunesSetup.exe (or iTunes64Setup.exe) installer files from your downloads areas for your web browsers and download a fresh copy of the iTunes installer from the Apple website:
    http://www.apple.com/itunes/download/
    (The current build of the 11.1.4.62 installer was changed a few days ago, which fixed the bulk of the reports of MSVCR80.dll/R6034/APSDaemon.exe/Error-7/AMDS-could-not-start trouble ... but the build number on the installer was not changed. So we're trying to make sure you do the reinstall using a "new good" 11.1.4.62 installer instead of an "old bad".)
    Does the install with the new copy of the installer go through properly? If so, does that clear up the error message?
    If you still have the same error messages cropping up, then try the procedures from the following user tip:
    Troubleshooting issues with iTunes for Windows updates

  • How do I move several songs with the SAME NAME?? to a windows folder??

    Now for my next question ( i'll also post this as a new question)
    I have 15 versions of the surf song "Apache" but when I try to move the songs via drag and drop in itunes to a windows folder, after the first version, it asks " you already have a file names "apache" would you like to overwrite it?"
    which I don't.
    Even when I rename the file to "apache two" it still says I already have "apache" in that folder. They are all different versions by different groups.
    How can I move them all to the same windows folder??.
    thanks
    Alan

    Most iTunes users don't look directly at the songs in the windows folders, but if you intend to, you better give the files unique names: "Shadows - Apache," "Ventures - Apache," and so on. When you first change the name, you will have to reasssociate the file in iTunes, but then you will get no conflict when you drag them into a folder.

  • I created a new playlist and added tunes to another.  When I synched my ipod showed the new playlist heading but 0 songs, although it correctly received the new songs on the updated playlist.  Tried to synch several times with the same result.

    I created a new playlist and added some songs to another existing one.  When I synched with my PC, it loaded the new playlist heading but 0 songs, but did add the new songs to the existing playlist.  Repeated the process several times without success.

    This earlier post may help.
    https://discussions.apple.com/message/10859194#10859194
    For me,  (long winded way) I drag the playlist from the bottom tree to the iPod branch.
    Then select iPod.
    Click the music tab on the right window.
    click sync tick music
    go down to the playlist section and tick the playlist.
    Apply.
    Good Luck.

  • Simple Max date pull from several rows with the same employee numbers.

    Ok so I'm hoping this is flying over my head because it's almost 3am, but I haven't been able to figure this query out for the last 2hrs, but I like to figure stuff out on my own. I'm wondering why the following statement works fine:
    select emp_num, to_char(max(end_date)) as newestdate
    from bank_history
    where emp_num in ('22964', '21667', '20758', '12739', '12731', '20929', '22795', '20594', '23077', '12588', '21294', '20618', '21204', '22952', '19990', '20632', '03093', '19991', '22951', '07779', '20014', '11981', '06149', '20364', '21103')
    and bank_type = 'P' group by emp_num
    BUT! When I start to add more columns that I need to see it starts adding the multiple employee numbers again.
    select emp_num, bank_type, earn_hrs, used_paid_hrs, used_paid_hrs, to_char(max(end_date)) as newestdate
    from bank_history
    where emp_num in ('22964', '21667', '20758', '12739', '12731', '20929', '22795', '20594', '23077', '12588', '21294', '20618', '21204', '22952', '19990', '20632', '03093', '19991', '22951', '07779', '20014', '11981', '06149', '20364', '21103')
    and bank_type = 'P' group by emp_num, bank_type, earn_hrs, used_paid_hrs, used_unpaid_hrs
    The orginal table looks something like this:
    EMP_NUM BANK_TYPE EARN_HRS USED_PAID_HRS END_DATE
    60393 P 0.58 0 3-Aug-2004
    60394 P 7.48 1 28-Oct-2003
    60394 P 40 40 28-Oct-2004
    60394 P 40 12.4 28-Oct-2005
    60395 P 40 40 21-Oct-2004
    60395 P 0 0 21-Oct-2003
    60395 P 40 40 21-Oct-2005
    60397 P 40 39.85 21-Oct-2004
    60397 P 0.97 0.97 21-Oct-2003
    Much thanks for any direction you can give to help guide me on my way to a solution. If you can help it please don't give me the answer, but try to give me the reason it's not working. I'll never learn if you give it to me right up front lol. Thanks again.
    Luke
    Message was edited by: trying to fix the table formating sorry it's so unreadable
    Luke22

    I just give you a prompt:
    SQL> with t as (select 1 emp_num, 'A' bank, date '2007-08-01' dt from dual union all
      2             select 1 emp_num, 'B' bank, date '2007-08-02' dt from dual union all
      3             select 1 emp_num, 'C' bank, date '2007-08-03' dt from dual union all
      4             select 2 emp_num, 'A' bank, date '2007-08-05' dt from dual union all
      5             select 2 emp_num, 'B' bank, date '2007-08-04' dt from dual union all
      6             select 3 emp_num, 'A' bank, date '2007-08-07' dt from dual union all
      7             select 3 emp_num, 'C' bank, date '2007-08-08' dt from dual)
      8  --
      9             select emp_num, max(dt) from t
    10             group by emp_num
    11  /
       EMP_NUM MAX(DT)
             1 03.08.2007
             2 05.08.2007
             3 08.08.2007
    SQL>
    SQL> with t as (select 1 emp_num, 'A' bank, date '2007-08-01' dt from dual union all
      2             select 1 emp_num, 'B' bank, date '2007-08-02' dt from dual union all
      3             select 1 emp_num, 'C' bank, date '2007-08-03' dt from dual union all
      4             select 2 emp_num, 'A' bank, date '2007-08-05' dt from dual union all
      5             select 2 emp_num, 'B' bank, date '2007-08-04' dt from dual union all
      6             select 3 emp_num, 'A' bank, date '2007-08-07' dt from dual union all
      7             select 3 emp_num, 'C' bank, date '2007-08-08' dt from dual)
      8  --
      9             select emp_num, bank, max(dt) from t
    10             group by emp_num, bank
    11  /
       EMP_NUM BANK MAX(DT)
             1 A    01.08.2007
             1 B    02.08.2007
             1 C    03.08.2007
             3 A    07.08.2007
             2 A    05.08.2007
             2 B    04.08.2007
             3 C    08.08.2007
    7 rows selected
    SQL>
    SQL> with t as (select 1 emp_num, 'A' bank, date '2007-08-01' dt from dual union all
      2             select 1 emp_num, 'B' bank, date '2007-08-02' dt from dual union all
      3             select 1 emp_num, 'C' bank, date '2007-08-03' dt from dual union all
      4             select 2 emp_num, 'A' bank, date '2007-08-05' dt from dual union all
      5             select 2 emp_num, 'B' bank, date '2007-08-04' dt from dual union all
      6             select 3 emp_num, 'A' bank, date '2007-08-07' dt from dual union all
      7             select 3 emp_num, 'C' bank, date '2007-08-08' dt from dual)
      8  --
      9             select emp_num, max(bank) keep (dense_rank last order by dt) bank, max(dt) from t
    10             group by emp_num
    11  /
       EMP_NUM BANK MAX(DT)
             1 C    03.08.2007
             2 A    05.08.2007
             3 C    08.08.2007

  • After downloading i-clouds I keep receiving a no service message and could not activate iphone. it says the iphone could not be activated because the activation server is temporarily unavailable. i have read several threads with the same but no solution

    after downloading i-clouds I keep receiving a no service message and phone could not be activated because the activation server is temporarily unavailable.
    I have read several questions on this but dont see a solution.

    Activation requires a SIM, assuming the SIM is functional it should simply activate.
    The vast majority of activation issues are the result of devices that have been hacked or jailbroken.  If that is the case, no support can be provided here.

  • Can i set up my iPad and iPod to use iMessage between the two devices with the same Apple ID?

    Can i set up my iPad and iPod to use iMessage between the two devices with the same Apple ID? SO i could iMessage if out from my iPod to my iPad at home to be viewed by a family member?

    Look into using Apple Configurator.  It's the easiest way to "reimage" and Manage iPads that I know of right now. 
    http://itunes.apple.com/us/app/apple-configurator/id434433123?mt=12
    Also, look into using the Educational Volume Purchase Program, if you have not already done so. 
    http://www.apple.com/education/volume-purchase-program/

Maybe you are looking for

  • The runtime error while executing RSRT1

    Hi all, We have upgraded the BW 3.5 to Bi 7.0,  when we trying to execute RSRT1 it throwing run time error  "load program not found". Program "Gp xxxxxxxxxxxxxxxxxxxxxJDP5" ... Is there any patch for this... Please suggest... Thanks, Subhash.G

  • Adobe FlashPlayer paired with Internet Explorer 8 shows Plug-In version Not Installed?

    Active X version is 11.7.700.202 I am being told that for a new program (Remedy) we are going to be using that the Plug-In version needs installed or the web-based application will not work.  Is there any way to install the Plug-In version in additio

  • Convert 4-color pdf to greyscale

    I have a four-color pdf that I need to convert to greyscale. The pdf now is CMYK set for Press Quality. What are the best settings for high quality greyscale output in Advanced - Print Production - Convert Colors. I am using Acrobat Professional 8.0.

  • 3rd Party Audio Apps randomly freez3

    3rd party audio applications (Podcast! Audible, iHeart), randomly freeze on both my 1020 and 925. This doesn't happen on my 920 or 521 devices. Is there a fix in the works? I'm not the only person who is having this issue

  • PDF's print two sided.  How can I get them to print on single pages?

    PDF's print two sided.  There is no option shown.  How can I get thelm to print on single pages?