Adobe edge: Use global javascript variable to control active content

438 views Asked by At

I am making a video controller in Adobe Edge, I have one set of controls that I want to be able to control whatever video is active. I have a global var called activeVid that sets what video is visible and playing. There is a trigger on the timeline that changes the variable from vid1 to vid2. My playpause button executes the following function:

function pauseplay(vid){
            var vid;
            if (sym.isPlaying()) {
                sym.stop(); 
                sym.$(vid)[0].pause();
                sym.getSymbol("playpause").$("btn_rnd_pause").hide();
                sym.getSymbol("playpause").$("btn_rnd_play").show();
                stageState= "paused";
                sym.getSymbol("PANEL").play("open");
                      } 
            else {
                    sym.play();      
                    sym.$(vid)[0].play();
                    sym.getSymbol("playpause").$("btn_rnd_play").hide();
                    sym.getSymbol("playpause").$("btn_rnd_pause").show(); 
                    stageState= "playing";
                    sym.getSymbol("PANEL").playReverse("close");

                    }

        }



pauseplay(activeVid);

The problem I am having is that when this function is executed after the ActiveVid variable is changed to vid2, Edge is changing the activeVid variable back to vid1 and both videos start playing on top of each other. I am fairly new to javascript and adobe edge so I may just be missing the boat with my logic on this one. Any help would be appreciated.

1

There are 1 answers

0
Drew H. On

This issue has been solved. It wasn't actually a coding issue as I originally thought. The problem was that my trigger that changed the variable was the last action on the timeline. so for some reason when I hit the play button it was looping the timeline back to the beginning. I solved it by labeling the end of my content. Just another unusual quark of Adobe Edge, but this is the price of working with young software.