Play multiple .SWF in sequence
I have two swf files that I would like to play in sequence in a main flash file. The two swf files are partA.swf and partB.swf. I set up two frames using this actionscript 3 snippet:
Frame 1:
Code:
var partARequest:URLRequest = new URLRequest("partA.swf");
var partALoader:Loader = new Loader();
partALoader.load(partARequest);
addChild(partALoader);
Frame 2:
Code:
var partBRequest:URLRequest = new URLRequest("partB.swf");
var partBLoader:Loader = new Loader();
partBLoader.load(partBRequest);
addChild(partBLoader);
I made sure to set new loaders that correspond to it's proper swf file. So partA.swf goes with partALoader and partB.swf goes with partBLoader.
I noticed that individually they work great. If I just set up frame 1 or frame 2 by themselves, the swf file plays. When placed together, however, either frame 1 plays without going to frame 2 OR frame 2 plays by default without playing frame 1 first.
How can I get this to work properly in sequence?
Just to break things down, this is how I would like the set up.
1. Play frame 1 which plays partA.swf,
2. Stop when finished and go to frame 2 which plays partB.swf
3. Stop movie, no need to loop.
4. Would like to have option for adding more swf files
I don't use flash much, so guidance with code is much appreciated. I would think this is a simple task, but searching for a proper solution hasn't been successful.
Also just to clarify from previous searches and posts I looked at: I am not using buttons, and this is using actionscript 3.0 not 2.0, and this is using only .swf files.
Thanks a bunch
Here's a nice trick that Andrei1 taught me a week ago or so that should sort out your problem:
On the last frame of partA.swf, you could dispatch an event, like so:
dispatchEvent(new Event("advanceParentTimeline"));
Then, in your parent movie on the frame that partA gets loaded, you can listen for the text, like so:
stage.addEventListener("advanceParentTimeline", onTextRequest, true);
Add the following function to the same frame with the listener mentioned above, and if your parent movie hears that text, send your movie to frame 2, like so:
function onTextRequest(e:Event):void {
gotoAndStop(2);
Hope that helps,
~Chipleh
Similar Messages
-
Playing multiple videos in sequence
Hello all. I'm a complete newbie to Flash development, but
have been thrown into it with not just a deadline, but a (to me)
"complex" project. I have a Flash project which currently opens and
plays a video as part of whats on "the stage". I now need to add 2
more videos which will play, in sequence, after the first one
finishes. I've gone through the tutorials, read the help files, and
now I'm just feeling a bit "DUH" because I still can't figure out
how to do this. Anybody out there care to help a poor ol' graphics
guy avoid the bitter wrath of his boss?A single instance of FLVPlayback can handle multiple videos.
I can't remember what the upper limit is. So you can switch between
them based on user input. But I believe it can only ever play one
at any one time. I've used FLVPlayback quite a lot but not for what
you're describing, so can't answer from direct experience.
Check out this page, and the trivial example at the end
(whether its streaming or progressive is irrelevant here, streaming
should work just as well, but perhaps you need to use SMIL files
for the streaming contentPath?)
http://livedocs.adobe.com/flash/9.0/main/00002980.html#wp3780233 -
Play multiple videos in sequence
Hi,
I've multiple videos stored in FMS and would like to merge them into a single video object in order to play all of them in sequence (so that a user thinks it's a single longer video). Is it possible?This is a link from 3.5 but have you tried this:
http://www.overdigital.com/2009/08/02/flash-media-server-as-video-editingstitching-tool/ -
Need help playing 2 SWFs in sequence
I have two SWFs that I want to play in sequence, using a
third SWF (that has nothing besides this code). This should be
simple -- play the first, wait for its timeline to end, then play
the second. Problem is I can't get the timeline to wait.
To load the first movie in frame 1, I have this, which works:
this.createEmptyMovieClip("mcHolder", 1);
var oListener:Object = new Object();
var mclLoader:MovieClipLoader = new MovieClipLoader();
mclLoader.loadClip("first movie.swf", mcHolder);
mclLoader.addListener(oListener);
In frame 10, I want to unload the first, then load the
second. That happens, but w/o waiting. Here's what I have, so far:
stop();
if (_level1.currentFrame == _level1.totalFrames) {
// unload first movie
mclLoader.unloadClip(mcHolder);
// now load next movie
this.createEmptyMovieClip("mcHolder2", 1);
var oListener2:Object = new Object();
var mclLoader2:MovieClipLoader = new MovieClipLoader();
mclLoader2.loadClip("second movie.swf", mcHolder2);
mclLoader2.addListener(oListener2);
I suppose there's something wrong with my If statement, but
what?So other than the fact that my code was riddled with errors,
it was fine!
After implementing your instructions, I created an interval
that runs the if-then statement 10x a second, then cleared the
interval immediately after the If statement.
One more question, though: the reason I was unloading the
first movie was to clear up some memory. Are you saying that isn't
necessary, since I'm now loading the second movie into a higher
level? -
I am new in Flash and have this little stupid question. I
have made 3 .swf files and I want to play them one by one in
sequence automatically. What's the best way to do it?Here's a nice trick that Andrei1 taught me a week ago or so that should sort out your problem:
On the last frame of partA.swf, you could dispatch an event, like so:
dispatchEvent(new Event("advanceParentTimeline"));
Then, in your parent movie on the frame that partA gets loaded, you can listen for the text, like so:
stage.addEventListener("advanceParentTimeline", onTextRequest, true);
Add the following function to the same frame with the listener mentioned above, and if your parent movie hears that text, send your movie to frame 2, like so:
function onTextRequest(e:Event):void {
gotoAndStop(2);
Hope that helps,
~Chipleh -
StageVideo play multiple videos in sequence (playlist) on iOS
Hi everyone!
I have to play severals locals videos in sequence with stageVideo (imagine an dynamic background wich runs an playlist).
Its runs very well (the MP4 videos play smoothly) but when the videos are switching appear an full sreen white frame for 3 seconds and later the second video start to play (on my iPhone4).
private function netStreamStatus(event:NetStatusEvent):void{
if (event.info.code == "NetStream.Play.Stop"){
netStream.play(VIDEO2)
If i rewind the first video (loop) the white frame never appear:
private function netStreamStatus(event:NetStatusEvent):void{
if (event.info.code == "NetStream.Play.Stop"){
netStream.seek(0)
¿How can i do an smooth video change with an stageVideo and ios devices?
Thanks a lot!Here i attach an FXP project (Flex 4.6 Mobile APP) wich play some videos with stageVideo.
You can see in a real device like iPhone 4 (not desktop) an BLACK screen when swtiching videos (about 3 seconds).
Can anyone helpme please?
Thanks a lot!
http://goo.gl/75tBz -
Problem Playing Multiple SWFs in Dreamweaver
so my problem is this......
In my flash Document I have One main SWF and two other SWF's
that load onto a different layer in the main SWF. Everything works
great in Flash and Dreamweaver when I preview in Browser but when i
upload to the web it doesn't function. Am i doing something wrong?
I made sure all files were in my root folder and that they were
uploaded to the server.you probably didn't upload the "scripts" folder that DW
creates when you
insert a flash video (which is understandable, since the only
place
where that's mentioned is here, when people come to ask "why
won't my
flash video work?!" which happens probably daily....even i
did it!).
so check that. if that's not the problem, you should probably
post a link.
PCL_Jennifer wrote:
>
> so my problem is this......
> In my flash Document I have One main SWF and two other
SWF's that load onto a
> different layer in the main SWF. Everything works great
in Flash and
> Dreamweaver when I preview in Browser but when i upload
to the web it doesn't
> function. Am i doing something wrong? I made sure all
files were in my root
> folder and that they were uploaded to the server.
>
> -
Hi, i would like to randomly play multiple swf files one
after one, like slideshow of swf files
here is what i want:
- load multiple external swf file from a main swf.
- a swf play and when is finish the next one play, i mean the
next one have to wait that the first one is finishing play before
playing.
- if its possible, preload the swf file, so the user do not
have to wait that all swf file have to load, i mean loading the
first swf file, play it and preload the next one during the first
one playing.
- do all this randomly
the code i attach serve to play one external files, i didnt
know how to play multiple one.
im not sure if the adobe interface attach code correctly, so
i pasted here:
import flash.display.*;
import flash.net.URLRequest;
var rect:Shape = new Shape();
rect.graphics.beginFill(0xFFFFFF);
rect.graphics.drawRect(0, 0, 500, 120);
rect.graphics.endFill();
addChild(rect);
var ldr:Loader = new Loader();
ldr.mask = rect;
var url:String = "
http://swffile.swf";
var urlReq:URLRequest = new URLRequest(url);
ldr.load(urlReq);
addChild(ldr);
thanksYou could add the swf's to the library, give them a class
name and then reference them from the library in flash.
If you use flex you can embed the swf's at compile time using
[Embed(source='assets/scenes/home.swf')]
public static var home:Class;
and create an instance of the class when you would like to
use it.
var instance = new home(); -
Load multiple swf play one by one when required
Dear Friends,
i want to Load multiple swf play one by one when required, i mean, i want to reduce the loading time, so i cut my swf in to 2 portion, load both same time or load 2nd while 1st one playing and how can i show the 2nd one when first one finished?
Thanks in advance,
Regards,
Syed Abdul Rahimsee i write code for you may be it will helps you
var vidno:int=1
var totalvideos:int=10
var ld:loader
function loadvideo(str:String)
addChild(ld)
loader.load(urlrequest(str))
loader.contentLoaderInfo.addEventListener(Event.Complete,loadnext)
function loadnext(event:Event):void{
removeChild(ld)
if(vidno<totalvideos){
vidno++
loadvideo('vid'+vidno+'.swf')
loadvideo(vid1.swf)
try it.. -
Loading multiple swf's in runtime and playing them one after other
Hi,
I am looking for help in loading multiple swf's as a playlist and playing them one after other on top of the other, so here even we have to play with display list for the visiblity.
Tried to load single files but not getting for multiple files, what will be the event with which the dynamically loaded swf switch to other.These file names will be mentioned in XML file.
Please let me know your thoughts and will be greatfull if anybody can help with the script or any kind of tutorials.Hi,
First of all am thanking you for showing your kind intrest towards this thread, and appreciate for spending time to work out this issue.
I will explain you in deatil the issue what am facing,I am working on a project where basically dealing with flv player and videos, am trying to play multiple flv videos of a 3d human character who is speaking out a number like 3550.
Here we are using multiple video files and joining them like videos where character says 3 then 1000 then 5 then 50.
The issue here is after every video there is a fraction of second where the character is disappearing from the stage which we can't afford because all the numbers have to be played at once to show it as one single digit.
So thought of trying swf's instead of flv so that we can omit the gap between the numbers, but even in this swf's also having same issue for a fraction of second the character is missing from the stage.
I am looking for a solution to this, either the way can work out as flv or swf.For flv am trying to edit some player where we can remove the delay between the clips.
I am attaching new swf where the character is speaking 3 numbers like 3,1000,40.You can notice there is a flicker between the swf's.
Can we use Display list with which we can omit that gap.
Looking for your thoughts and help.
Thank you -
IE running under XP can't handle multiple SWF files, Why?
I noticed that IE 8 running under Windows XP cannot handle multiple swf files in one page.
Up to about 10 files is no problem they are loaded and we can play them ( buttons that start a small audio file).
But more of these files in one page will stop IE.
Firefox ( 3.6.28) runs them fine.
And also IE 8 and/or Firefox under Windows 7 handles them perfectly.
Has anyone any idea what can cause this and how to resolve this?
Thanks,
Onno Tomson
The NetherlandsSorry...I still don't get it. What is it about Windows FUS that keeps iTunes from running running the process twice? It can run many other non-Apple windows apps in multiple user sessions (commercial apps, open source apps, audio/video apps, networked apps). I can even run two different virtual machines at the same time under two different user sessions.
Why can iTunesHelper.exe run twice but iTunes.exe cannot? Why can I run Safari at the same time? Quicktime Player runs fine under multiple user sessions.
Blaming it on Windows and/or FUS sounds like FUD. Can anyone give a valid technical reason? Semaphores? Mutexes? An admission (and explanation) that the Windows version is purposely crippled? -
Loading multiple SWFs and storing them (code not working under Firefox 23 and Chrome)
Hey guys,
Anyone has any idea why this code suddenly don't work anymore? (It works under internet explorer but not firefox and chrome
The code under is placed on my main swf to preload all my external swfs and store them for not having to wait too long to access them.
Thx guys.
I took the code from here btw: http://www.beautifycode.com/the-finer-art-of-loading-2-handling-multiple-swfs#snippet
I'm running flash player 11.8.800.94... It used to work under Firefox and Chrome
var _swfLoader:Loader;
var _swfRequest:URLRequest;
var _swfPathArr:Array = new Array("00.swf", "01.swf", "02.swf");
var _swfClipsArr:Array = new Array();
var _swfTempClip:MovieClip;
var _loadedSWFs:int;
startLoading(_swfPathArr);
function startLoading(pathArr:Array):void {
_swfLoader = new Loader();
_swfRequest = new URLRequest();
loadSWF(pathArr[1]);
function loadSWF(path:String):void {
setupListeners(_swfLoader.contentLoaderInfo);
_swfRequest.url = path;
_swfLoader.load(_swfRequest);
function setupListeners(dispatcher:IEventDispatcher):void {
dispatcher.addEventListener(Event.COMPLETE, onSwfComplete);
function onSwfComplete(event:Event):void {
event.target.removeEventListener(Event.COMPLETE, onSwfComplete);
_swfTempClip = event.target.content;
_swfTempClip.customID = _loadedSWFs;
_swfClipsArr.push(_swfTempClip);
if(_loadedSWFs <_swfPathArr.length - 1) {
_loadedSWFs++;
loadSWF(_swfPathArr[_loadedSWFs]);
} else {Hi kglad,
The problem was coming from my server.
I recently played with some settings from a "cache control tool" offered by my hosting but i thought i had it back at default. Turns out i must've missed something. Now i have the .html caching on and everything works good on all browser.
I have another question tho...
I'd like to know if there's a way to cache an html file without having to ask my hoster to cache all of my htmls...
I'm using this code now but maybe there's a way to add something that will cache this page specifically?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>title</title>
<script language="javascript">AC_FL_RunContent = 0;</script>
<script src="fluid_site.js" language="javascript"></script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<link href="style.css" rel="stylesheet" type="text/css" media="screen"/>
</head>
<!--url's used in the movie-->
<!--text used in the movie-->
<!-- saved from url=(0013)about:internet -->
<script>
if (AC_FL_RunContent == 0) {
alert("This page requires fluid_site.js.");
} else {
AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
'width', '100%',
'height', '100%',
'src', 'index',
'quality', 'medium',
'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'devicefont', 'false',
'wmode', 'window',
'id', 'index',
'name', 'index',
'menu', 'false',
'allowFullScreen', 'false',
'allowScriptAccess','sameDomain',
'movie', 'index',
'salign', ''
); //end AC code
</script>
<body>
<noscript>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="100%" height="100%" id="index" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="MENU" value="false">
<param name=wmode value=window>
<param name="movie" value="index.swf" /><param name="quality" value="medium" /><embed src="index.swf" quality="medium" width="100%" height="100%" wmode="direct" name="fluid_site" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</noscript>
</body>
</html>
Thanks -
Automatically Play of SWF File
i want to create SWF file (loader.swf) wherein have multiples
movie clip inside...
i want to automatically play other swf file by calling.. when
the loader.swf finish without using any buttons...No Body Whisper me!!!!!!
-
I load multiple swfs into an array, I add and remove the objects on the stage, this is for a rotating carousel.
All the items locations are established in xml. If I only have one item loaded into the array it works fine, if I have more then one it will not a) play the swf, or b) show the swf.
The swfs themselves contain code that fire events in the main container. Which cause other items to play or load.
Is anyone else having this issue?Hi howet,
EDIT:
I've opened a flash bug in their bug system as I found I could reproduce the issue: https://bugs.adobe.com/jira/browse/FP-7071
There are some workarounds I found on there.
ORIGINAL MESSAGE:
I was having a similar issue using a loading component which i've been using for several years with no issues. As with you the issue arose when loading multiple swfs (or even one swf and then a jpg) on 10.3 and above. It works fine on 10.2 and below still.
I found a workaround whilst I look for a proper answer and that is to delay subsequent loads using a hacky setTimeout.
For example:
protected function manageLoaded (p_event : Event) : void {
setTimeout(loadNext, 1);
// following line breaks the gotoAndStop of loaded swfs.
// loadNext();
I hope this helps you too, let me know.
Cheers,
Dan.
Message was edited by: Dan Wilkinson, 01/06/2011 11:37am BST (GMT + 1) -
Multiple .SWFs in one HTML page
Hi all,
I'm trying to post multiple .swf objects into one html page. The first .swf object plays fine, but the second one does not load. I've searched all over for the answer, but I do not know what to do (plus, I'm a Flash noob). My page is http://users.wpi.edu/~cdaley_jw/animation.html, so please feel free to check out my code.
Dreamweaver tells me that swfobject.registerObject does not exist, or something like that, but I see this code being used elsewhere. I have swfobject.js in my main folder, too. I haven't the slightest clue what I'm missing.
Thank you very much,
ChrisI'd suggest you get the second .swf working BY ITSELF on a separate, new, blank page before worrying about how to get two working on one page. Your problem may have nothing at all to do with the fact that there are two .swfs on the page.
Looking in the cach after downloading your page,
http://users.wpi.edu/~cdaley_jw/Daley_Christopher_Walk_Cycle.swf
is downloading... but it's only the player, not the .flv file that it's looking to load and play.
http://users.wpi.edu/~cdaley_jw/Daley_Christopher_Walk_Cycle.flv
does exist on the server at the address above but is not being called by the video player... the .swf. So the problem may be that the url to the .flv is wrong in the .swf or is missing completely.
You'll have to fix that first and then worry about 2 swf on one page. So step back, get that second .swf working on a page all by itself, then move on.
Best wishes,
Adninjastrator
Maybe you are looking for
-
Laptop fails to boot with battery
Probably the wrong subsection.. :3 Okay, so I have a Toshiba satellite l735-m14t running windows 7. The problem started when I used CCleaner to clear out registry entries of uninstalled applications. Everything was running fine until I restarted. I c
-
Problems w/ PC playback of IDVD dvd-rs
I produce video for a living. My problem is my client's PCs and some DVD players will not play the DVD-Rs produced on my G4 or Powerbook. The media is still pics from I-Photo and burned in I-DVD 4.1. I use Verbatim, Maxell and Phillips DVD-R media. O
-
Changing date & time could cause the expiration on rented movie...
well, it was actually happened to me. at that time I didn't believe it. I posted this problem for finding some answers. but nobody hasn't have that yet. here is the question. after starting movie on your mac or PC, transfer it to touch. at that time
-
Whatever I do with installing or de-installing printer drivers, selecting or deselecting colour synch or colour management options, the colour is simply awful compared to what I have been used to fir years, using the same printer with a pc and a 10 y
-
We're trying to authenticate to a webservice, but the provider uses a system that we are not familiar with. They sent us our credentials, but one piece was a .key file that we are supposed to use as our key to sha-1 hash our xml content. I'm familiar