Announcement

Collapse
No announcement yet.

RR and Flash - Evaluating Play Status

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • RR and Flash - Evaluating Play Status

    I am working on a flash skin for RR and would like to know how to evaluate the play/mute/etc. status on the initial load.

    I am breaking out the skin into a main swf and then modules that will run inside the main swf. The main.swf will be the framework and hold all the audio controls so I believe it would only need to evaluate the status once, when the swf initially loads.

    I would like to evaluate whether or not the music is playing/muted etc. on startup so I can have the buttons adjust accordingly. aka. have the pause button showing if, on start up, the music is playing. Same with the mute button. If you muted before you left RR, I want RR to display the muted button when it starts back up.

    I have the play/pause button sitting on top of each other right now and have it set to hide/show right now and it works great, i just need it to evaluate if the music is playing so its set correctly each time. This is what I tried so far:

    if (_root.STATUS == "play") {
    playBtn._visible = false;
    } else {
    playBtn._visible = true;
    }

    Doesnt seem to have any effect. Button still shows in RR whether music starts or not.

    Also, does anyone have a basic audio player/audio browser fla file they would be willing to share so I can see how you are setting that up and how it works?

    Thanks in advance

    Justin

  • #2
    alright, so i kept searching, it sounds like i need to have indicators in my .skin file. I will take a look at this now.

    Comment


    • #3
      Hi m8, your right in that you will need the STATUS label in your .skin . You will also need to use CAPS.. ie PLAY not play

      CdR
      Follow me on Twitter

      http://www.FreeICE.co.uk

      Comment


      • #4
        Ya, i did notice that it wasnt capitalized and I did fix that.

        alright, so i took a look at the FSR's menu.skin and copied and pasted it all over awhile:

        /, L, x, y, w, h, color R;RGB, G, B, font size;FONT, font name, Code;LABELCODES, Tooltip;LABELALIGNMENT
        L,0,0,0,0,,,,,,"CUSTOMLABEL","Main"
        L,0,0,0,0,,,,,,"TRACKNAME",
        L,0,0,0,0,,,,,,"VOLUME",
        L,0,0,0,0,,,,,,"TODAY",
        L,0,0,0,0,,,,,,"TIME",
        L,0,0,0,0,,,,,,"STATUS",
        L,0,0,0,0,,,,,,"CURRENTTRACKTIME",
        L,0,0,0,0,,,,,,"TRACKTIME",
        L,0,0,0,0,,,,,,"TRACKNUMBER",
        L,0,0,0,0,,,,,,"GPSHDG",
        L,0,0,0,0,,,,,,"GPSSPD",
        L,0,0,0,0,,,,,,"GPSSAT",
        L,0,0,0,0,,,,,,"CPU",
        L,0,0,0,0,,,,,,"CUSTOMFREEFONE",
        L,0,0,0,0,,,,,,"ALBUMART",
        L,0,0,0,0,,,,,,"CUSTOMPL",
        L,0,0,0,0,,,,,,"PLAYLISTCOUNT",
        L,0,0,0,0,,,,,,"TAGARTIST",
        L,0,0,0,0,,,,,,"LISTPOS",
        L,0,0,0,0,,,,,,"KHZ",
        L,0,0,0,0,,,,,,"KBPS",
        L,0,0,0,0,,,,,,"PLAYLIST",

        /, I, x, y, w, h, Code;INDICATORCODES
        I,0,0,0,0,"MASTERMUTE"
        I,0,0,0,0,"SHUFFLE"
        I,0,0,0,0,"REPEAT"
        END

        and im using:

        if (_root.STATUS == "PLAY") {
        playBtn._visible = false;
        } else if (_root.STATUS != "PLAY") {
        playBtn._visible = true;
        }
        playBtn.onPress = function() {
        _root.playBtn.gotoAndStop("on");
        };

        i tested to make sure everything is right here. settings the visibility of the play button seems to work fine when its set to do it when the flash file loads (so my playBtn is on the root and everything is working correctly), it just doesn't seem be reading if the STATUS is PLAY or not. Am I missing something here?

        Why is it "_root.STATUS"? Can anyone explain how flash and RR interact with each other? I understand how the fscommand sends information and I get how the labels in flash work when the VAR are set to the correct name. What is it actually doing when its checking the PLAY status?

        Comment


        • #5
          it is _root.STATUS because:
          If a label is found on your .skin file, it is automatically sent to every single swf loaded in that .skin..and it will send it to the ROOT of ths swf..that's why

          so the SWF will be checking the variable "STATUS" for a certain value, when this value == PLAY, you can make your movie "gotoAndStop xxxxx" or whatever, when it has another value other than play (!=PLAY) do something else..
          fscommands is for the other way around, (the SWF sends commands to RR)..

          if you have that code run only ONCE then your button will not update whenever the value of STATUS changes...that is why you should have this in a sprite to run once a second continuesly in a loop.

          Comment


          • #6
            thank you for the explanation Nomader, I think that I understand, but I think I am not being clear as to what i am trying to do.

            I think i am just missing a detail or two:

            *I have a main.swf, it has the play and pause movie clips on it.

            *The play clip is sitting above the pause clip.

            *Each clip has an off and on state.

            *When the "play" button is pressed, it highlights and then onRelease it hides itself and sends the "PLAY" command.

            *Now the "pause" button is visible.

            *When you press the "pause" button it highlights and onRelease, it hides and shows the "play" button and sends the "PLAY" command.

            *It works great right now, I just need the main.swf tocheck the status of the "PLAY" state and decide whether to show or hide the play button.

            *So if the music is playing when you shut RR (the "pause" button would be showing"), I want the pause button to be displayed when I open RR up.

            To do this, based on what you guys are saying, I would think this is what I would need this if statement at the top:


            if (_root.STATUS == "PLAY") {
            playBtn._visible = false;
            } else if (_root.STATUS != "PLAY") {
            playBtn._visible = true;
            }

            Comment


            • #7
              I wonder if im checking the play status too soon or something...

              Comment


              • #8
                ok, i think the problem is the actionscript is running before RR is even sending the PLAY status. I hooked the if statement up to a button and it works exactly as it should. Now i gotta figure out how to delay it from running

                Comment


                • #9
                  function wait() {
                  if (_root.STATUS == "PLAY") {
                  playBtn._visible = false;
                  } else if (_root.STATUS != "PLAY") {
                  playBtn._visible = true;
                  clearInterval(myTimer);
                  }
                  }
                  myTimer = setInterval(wait, 0);

                  Works fine now. I still think something was wrong to begin with. Why with the time set to 0, does this work? Did my if statement need to be inside some sort of function to work correctly?

                  Comment


                  • #10
                    who cares, it works now, leave it the way it is :P
                    http://www.mp3car.com/members/tracke...ivic-2007.html for Car Pics!

                    http://www.mp3car.com/vbulletin/lcd-...ease-read.html for Touchscreen timeout fix!

                    Comment


                    • #11
                      ah, but you don't learn that way man!

                      Comment


                      • #12
                        ok i will tell you how i would design it from start..
                        1. I would create 2 frames..1 frame would have the play graphics and one would have the pause graphics..
                        2. I would put a button on that which will send the command PLAY (for pausing it is the same command) that button would just send the command - will not control the appearance of the movie...play or pause frame)

                        3. What will control whether play or pause will be shown, will be the "STATUS code check" you have written..which will run once a second. and will send the movie to the appropriate frame..
                        hope i helped

                        Comment


                        • #13
                          When using the play / pause I just added two pic's of the button, one with a play icon on it and one with a pause icon on it. I then named these playbut and pausebut and made them targets... I then added a sprite that looped on frame 5 back to frame 1.. using this sprite as a timer which checks for things like MASTERMUTE / STATUS etc.. the code would be something like..

                          OnFrame(1){
                          If (_root.STATUS == "PLAY"){
                          _root.playbut._visible = TRUE;
                          _root.pausebut._visible = FALSE;
                          } else {
                          _root.playbut._visible = FALSE;
                          _root.pausebut._visible = TRUE;
                          }

                          Just do the same for the MASTERMUTE as well, no other code is needed
                          Follow me on Twitter

                          http://www.FreeICE.co.uk

                          Comment


                          • #14
                            Nomader, alright I understand what you are saying. I think with my situation, I am ONLY using the play/pause button to control the music, so since i had to press the button to change it and i was forcing it to show or hide, it worked fine. But if i used a remote and sent the pause/play command, the button wouldnt updated from pause/play unless it was constantly checking the status, so your method does make more sense. CdRsKuLL, you are pretty much saying to check it constantly too. I will work on this today.

                            Thanks guys,
                            Justin

                            Comment


                            • #15
                              thanks for your help guys. I got everything working. I am running a loop that checks the status of everything once a second, if it sees any changes it adjusts the buttons accordingly.

                              Thanks!

                              Comment

                              Working...
                              X