Groups | Blog | Home
all groups > flash actionscript > august 2005 >

flash actionscript : Empty media display, can this be done?


Thorulf
8/3/2005 10:58:20 PM
Hi,
I have an swf with several frames. On each frame I have a media display
component loading an external flv file. To view the different videos I use
button navigation to jump between the frames in my swf. The problem is that
when an external flv is being played via the media display and I chose to jump
to another frame to watch another video before the first one has finished, the
sound of the first one keeps playing in the background. And if I go back to the
first one it refuses to start again.

So I would like to find a way to completely empty the media display component
when I leave the frame where it resides. Can this be done?

sampurtill
8/3/2005 11:16:47 PM
Rothrock
8/4/2005 12:00:00 AM
It is so odd that questions very similar to this get asked so often. If you
want the FLV to stop try myMedia.stop(); I'm not harshing you, I just find it
interesting, that is all.

Now part of the new problem you will probably find is that if the user jumps
to several different screens you may have several different FLVs progressively
downloading. This can cause bandwidth, stuttering, and other problems.

Unless you have other reasons to jump between frames and multiple instances of
media components, you can just re-set the source for the component with the
setMedia() method. Even with this way of doing it, it would be a good idea to
stop() the playback before setting the source. Check it out in the help files:
Help?>Using Components?>Component Dictionary?>Media Components.
Thorulf
8/9/2005 10:00:16 AM
Hi sampurtill and thanks for your answer,
Sure, I definitely agree with you that this solution seems quite fair.
Unfortunately I?m not that skilled in Actionsscript that I could figure out the
exact syntax of such a function. So I?m afraid that a push in the right
direction isn?t quite enough for me here, I need the answer written on my nose
:-)

Thorulf
8/9/2005 10:17:31 AM
Hi Rothrock and thank you for answering my post.
I don?t know why this seems to be such a common question. Maybe it?s because
this is tricky stuff for us not so skilled Flash developers, and maybe the
documentation on this matter often doesn?t cover exactly what you want to
perform, I don?t know, I can only speak for myself. And yes, I have found
several similar posts on other Flash forums, but none of them I have found have
covered exactly what I?m trying to perform, and for the ones that have been
close enough, the suggested solutions haven?t worked when trying them. Probably
because I?m a lamer that should stick to design mode in Flash and nothing else
:-)

However the solution you suggest; myMedia.stop(); work, and the playhead stop,
preventing the flv to continue playing when I jump to another frame to watch
another flv. Great, almost there! Now the only problem is that when I go back
to the frame with the first flv it refuses to start again. You won?t happen to
have a suggestion for that too perhaps? In other words, a way to completely
throw out the current flv from the media display when leaving the frame.

And yes I have a reason for using the jumping between frames method when
accessing the different flv files, because I have other graphics on the stage
that corresponds to the different videos.

Thanx in advance :-)

Rothrock
8/9/2005 11:55:16 AM
Thorulf glad that worked for you. I'm really quite interested in the idea of
education. So what I'm finding fascinating is that I would expect a (not
necessarily you, but just anybody) frustrated, tired designer/programmer would
say, either out loud or in their head, "I just want to make the darn thing
stop. Why isn't there a way to make it stop!?!" From there it is a short jump
to myMedia.stop(). So what is it about the way that we learn and teach Flash
that makes it so that a fair number of people don't say that and don't make the
leap? I'm just trying to figure out how to help people better and make it so
they can better solve their own problems (and learn) in the process. I think
part of it is sort of an idea that people have that hearing and vision are
different things....hmmm...but I digress.

I suspected you might have different graphics and that would be the "other
reasons." I haven't tried to structure something like this. I'll give it a try
in the next day. Perhaps a different approach would be to make each of your
"sets" or "skins" as a separate movieclip. Then have just the one player over
the top (or under) them. Then just make them _visible as needed. This way you
only have one media component.

Or actually, why not have the media component on one layer by itself that
stretches across the whole timeline. Then the other layers which have your set
can be keyframed etc. as needed. That way you can jump to a different label,
but it will still be the same media component.

Just an couple of ideas, but I will see if I can come up with something else.
Thorulf
8/19/2005 10:50:12 PM
Hi again Rothrock,
Thanks a lot for your kind help and suggestions. I can tell you that it is
most appreciated to have people like you at forums like this. People that
actually take the time to suggest solutions and so forth, so that we lamers
slowly but surely can learn, and perhaps some day in the distant future even
help others.

I decided to approach my second problem with your way of thinking in mind, and
even though it didn?t turn out to be as obvious as myMedia.clear() or
myMedia.empty() it was close enough: myMedia.setMedia() turned out to be the
way to go.

:-)

Rothrock
8/20/2005 1:37:19 PM
Great. Don't forget that in MX04, the documentation is really quite good. Yeah
it has a few gotchas, but in general it rocks! So any time you start using a
new component or class read all the entries and imagine how you might use it.

For components go Help ?> Using Components ?> Components Dictionary and then
open the folder for which ever component you are about to use. You will see
everything that is officially supported for that component. Many, many of the
questions asked here could easily be answered by that, or at least make the
answers easier to understand.
Thorulf
4/8/2006 12:00:00 AM
Hi Rothrock!
Since you?ve helped me before, I?ll be bold enough to address this question of
mine directly to you. Hope you don?t mind :-)

And since you?ve disabled the ?Send private message? option I?ll post this
question as a reply to an old and irrelevant post (as you can see), with the
hopes that it will reach you.

Here it is:
How can I have a custom animation playing in front of my Media Display while
the external flv is buffering, and then disappear when the video starts
playing? It doesn't have to be a progress bar, just an animation.

I can?t use the FLVplayback component since I want it to work for visitors
with Flash player 7 as well. So it has to be the Media Display component.

Any help is appreciated.

Regards Thorulf

Rothrock
4/8/2006 2:18:09 PM
First I might recommend using NetStream class instead of the component. On the
gotoAndLearn.com website there is a great 8-part or so tutorial that shows how
to built your own FLV player. He includes instructions for a little blinking
"bufffering" screen while it is loading. It would be very easy to make it into
a little animation.

If you can't/don't want to redo the whole thing like that. The same kind of
idea would probably work, but just with a few changes.

Strange enough somebody else is currently asking more or less the same thing.
I haven't quite come up with my whole answer for there, but I will post
something there in a bit.


http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?catid=194&thre
adid=1140227

PS: I don't do "private messages" because I believe that these forums are for
everybody to learn. Of course most people don't every bother to search, but
over that part I have no control.
Thorulf
4/8/2006 8:59:27 PM
I think that tour along with your reply to the other guy's question might be just what I need to perform my task.

Big thanx Rothrock, you really rock :)
AddThis Social Bookmark Button