• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1264
  • Last Modified:

Advanced Flash ActionScript 2.0 Load video/audio control question.

I am loading two external Flash SWF files into my present Flash movie. The first one that loads is a music player. The second movie I am loading upon the click of a button and it is a external SWF that contains a
Flash video.

Right now I am simply loading the video SWF movie into the same layer as the music player so that it will stop the playback of the music so the viewer can see the video AND hear it's audio.

Unfortunately when the video ends it just sits there on the last frame.

I would like to have suggestions as how to:
       a.) Unload the SWF Flash video that has just completed playback and..
       b.) resume the playback of the audio that was last playing.

I am loading the Flash SWF music with the following:
-------------------------------------------
on(release) {
      
            loadMovieNum("/motion/flash/music/music2.swf",1);
            _root.soundstatus="on";
            _parent.equalizer.gotoAndStop(1);
            _parent.gotoAndStop(1);
}
------------------------------------------
I am loading the external SWF Flash video with:
------------------------------------------
on(release) {
      
            loadMovieNum("/motion/flash/video/kirklandPSA.swf",1);
            _root.soundstatus="on";
            _root.equalizer.gotoAndStop(1);
            _parent.gotoAndStop(1);
            
      
}
-----------------------------------------------

Suggestions and help appreciated.

Thanks in advance,

Rip
0
ripnoel
Asked:
ripnoel
  • 9
  • 7
1 Solution
 
ZefferCommented:
on last frame of the video swf..
stop();
unloadMovieNum(1);

Z
0
 
ripnoelAuthor Commented:
No this just unloads the video as soon as the frame has been hit. I think we need to listen for some sort of movie complete event.

Rip
0
 
ZefferCommented:
yes it unloads the video..but it's at the end why do you need a movie complete listener?
If you want the music player to kick back in you will need to leave it in the player..at the moment it is being replaced by the video on layer 1
if you loaded the music to layer1 and the video to layer2..you could stop the music player..
_level1.stop();
_level.._visible = false;
load and play the video as you are now
and on the last frame
stop();
unloadMovieNum(2);
_level1._visible = true;
_level1.play();

Z
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
ripnoelAuthor Commented:
I don't want to make the length of my timelines as long as the flash videos I am loading into them AND in some cases with long videos this is not possible because of the timeline length limitation in Flash.

That is why I need  a listener. I am real new to working with FLV files. Your help and suggestions are appreciated.

Can you share some code that will listen for the Flash Video to stop or end. I'm using the flash video component to playback the external FLV file.

Thanks again for this help!

Rip
0
 
ZefferCommented:
I presume you are using the standard method of loading an flv..there are a several of ways to detect the ending..here's a couple

myNetconnection = new NetConnection();
myNetconnection.connect(null);
myStream = new NetStream(myNetconnection);
myStream.setBufferTime(10);
my_video.attachVideo(myStream);
myStream.play(someflv.flv);
//..............
myStream.onStatus = function(info) {
      if (info.code == "NetStream.Play.Stop") {
            //your code here
        }
}

or

var myListener = new Object();
myListener.complete = function(eventObject){
         //your code here
};
muStream.addEventListener("complete", myListener);

Z


 
0
 
ZefferCommented:
sorry typo..
muStream.addEventListener("complete", myListener);
should be
myStream.addEventListener("complete", myListener);

Z

0
 
ripnoelAuthor Commented:
Hi Z,

As I mentioned in my last post I am loading my Flash videos using the built in flash video component (in CS3) so... what code should I use in this case to code a listener to unload the video once it has played (I am using Actionscript 2.0).

Thanks,

Rip
0
 
ZefferCommented:
there are two methods in my last post from the dotted line down
the second one is a listener

var myListener = new Object();
myListener.complete = function(eventObject){
         unloadMovieNum(1);    
};
myStream.addEventListener("complete", myListener);

again.. put it on frame 1 of kirklandPSA.swf
when the video has completed the function will fire.

Z
Z
0
 
ripnoelAuthor Commented:
Tried this on my actionscript layer over the first frame of the Flash video and it did not do anything:
---------------------------------------------
var myListener = new Object();
myListener.complete = function(eventObject){
         unloadMovieNum(1);    
};
myStream.addEventListener("complete", myListener);
-----------------------------------------------
I next tried clicking the object and adding the code there and nothing there either...

Why is this not working?

Rip
0
 
ZefferCommented:
try it in an onEnterFrame function

this.onEnterFrame = function(){
var myListener = new Object();
myListener.complete = function(eventObject){
         unloadMovieNum(1);
     }  
};
myStream.addEventListener("complete", myListener);

Z
0
 
ripnoelAuthor Commented:
nope... just sits on last frame when completed...
0
 
ZefferCommented:
where have you put the code?
and are you putting the name of your player where it says (eventObject)?
try it on the last frame where it sits stopped

Z
0
 
ripnoelAuthor Commented:
I put this actionscript on a blank keyframe in my "actions" layer:
-------------------------------------
this.onEnterFrame = function(){
var myListener = new Object();
myListener.complete = function(mainVideo){
         unloadMovieNum(1);
     }  
};
myStream.addEventListener("complete", myListener);
----------------------------------
my video component is named (mainVideo) I double checked it.

0
 
ZefferCommented:
show me your complete loading code for the video
and I assume this is on frame 1 of kirklandpsa.swf ..is it?

Z

0
 
ripnoelAuthor Commented:
I don't have any loading code.... as I told you in an earlier post I am using the Flash CS3 built it component for FLVPlayBack. I have named the instance mainVideo.
0
 
ZefferCommented:
did you choose "actionscript controlled" when you created the video component from the drop-down menu  in the library?
I suspect you didn't as you would have some code like the code I wrote above for creating the NetStream connection.
Z



0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

  • 9
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now