Loading multiple SWFs across many pages in a Flash interface
I have a Flash AS3 interface that lets users go tto different
pages with the usualy back & next buttons. Each page they come
to loads in a page-specific XML file with content, and then
possibly graphic files and/or SWF files.
My question is this: When a user happens to quickly click the
next page button, they will gte each page to start loading its
assets. I believe that this would cause pages that they didn't
soend more that a fraction of a second on to continue loading in
the background. So if they quickly click through 20 pages, all 20
pages' assets are loading. Sounds like I have a bad design on my
hands!
Without designing/developing for it, is this the simple
result of loading in a file to Flash? Should I look into stopping
iles from dpownloading if a user leaves a page before it's fully
downloaded? Is that even possible?
Any thoughts or advice would be greatly appreciated!
I have a Flash AS3 interface that lets users go tto different
pages with the usualy back & next buttons. Each page they come
to loads in a page-specific XML file with content, and then
possibly graphic files and/or SWF files.
My question is this: When a user happens to quickly click the
next page button, they will gte each page to start loading its
assets. I believe that this would cause pages that they didn't
soend more that a fraction of a second on to continue loading in
the background. So if they quickly click through 20 pages, all 20
pages' assets are loading. Sounds like I have a bad design on my
hands!
Without designing/developing for it, is this the simple
result of loading in a file to Flash? Should I look into stopping
iles from dpownloading if a user leaves a page before it's fully
downloaded? Is that even possible?
Any thoughts or advice would be greatly appreciated!
Similar Messages
-
Loading multiple swfs using air 3.6 for ios
Adobe, can you please provide us with the code to load multiple swf files for ios. Please provide examples. The code below loads multiple swfs, but the swfs stall, so this does not seem to be a solution.
Code description: A flash file made up of 4 frames with forward and back buttons that navigate from frame to frame. The code loads three different swf files in frames 2, 3 and 4.
Frame 1:
var myLoader:Loader;
var loaderContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
if(myLoader == null){myLoader = new Loader(); addChild(myLoader); }
else {myLoader.unload();}
Frame 2:
myLoader.unload();
myLoader.load(new URLRequest("file1.swf"),loaderContext);
Frame 3:
myLoader.unload();
myLoader.load(new URLRequest("file2.swf"),loaderContext);
Frame 4:
myLoader.unload();
myLoader.load(new URLRequest("file3.swf"),loaderContext);I've just tried loading, unloading and then loading again same SWF with 2 library objects linked for AS3 export. It worked both on simulator and on device in debug mode. When I look inside swf it does contain AS3 code.
So is my swf a pure asset SWF? Or Intellij Idea 12 that I'm using does stripping automatically?
And then I've read your comment at http://forums.adobe.com/message/5217325#5217325 and run 'swfdump' utility on my .swf file. Looks like there's no ABC2 code, that's why app was able to load, unload and load again the same swf.
public dynamic class net.games.bg extends flash.display.MovieClip
native public function bg():*;
native public var one:flash.display.MovieClip;
native public var three:flash.display.MovieClip;
native public var two:flash.display.MovieClip;
public dynamic class net.games.z1 extends flash.display.MovieClip
native public function z1():*;
I can access objects as instances through root or as objects through getDefinition.
private var aLoader : Loader;
private function init():void
load1();
private function load1():void
aLoader = new Loader();
var url:URLRequest = new URLRequest("levels/expirementlevel1.swf");
var loaderContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
aLoader.load(url, loaderContext); // load the SWF file
aLoader.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE, handleSWFLoadComplete1, false, 0, true);
private function handleSWFLoadComplete1(e:flash.events.Event):void {
var levelObjectsMC:flash.display.MovieClip = e.target.loader.content;
for (var i:uint = 0; i < levelObjectsMC.numChildren; i++){
trace ('\t|\t ' +i+'.\t name:' + levelObjectsMC.getChildAt(i).name + '\t type:' + typeof (levelObjectsMC.getChildAt(i))+ '\t' + levelObjectsMC.getChildAt(i).x);
var LibraryClass:Class = e.target.applicationDomain.getDefinition("net.games.z1") as Class;
var myLibraryObject:flash.display.MovieClip = new LibraryClass as flash.display.MovieClip;
trace(' load 1 ' + myLibraryObject);
aLoader.unload();
load2();
//addChild(levelObjectsMC);
private function load2():void
aLoader = new Loader();
var url:URLRequest = new URLRequest("levels/expirementlevel1.swf");
var loaderContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
aLoader.load(url, loaderContext); // load the SWF file
aLoader.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE, handleSWFLoadComplete2, false, 0, true);
private function handleSWFLoadComplete2(e:flash.events.Event):void {
var levelObjectsMC:flash.display.MovieClip = e.target.loader.content;
for (var i:uint = 0; i < levelObjectsMC.numChildren; i++){
trace ('\t|\t ' +i+'.\t name:' + levelObjectsMC.getChildAt(i).name + '\t type:' + typeof (levelObjectsMC.getChildAt(i))+ '\t' + levelObjectsMC.getChildAt(i).x);
var LibraryClass:Class = e.target.applicationDomain.getDefinition("net.games.z1") as Class;
var myLibraryObject:flash.display.MovieClip = new LibraryClass as flash.display.MovieClip;
trace('load 2 x ' + myLibraryObject.x);
aLoader.unload(); -
Hello folks...
I have some serious problem with loading multiple swfs in a
swfLoader whithin an application...
The problem is that... every time I load another swf in a
swfloader,
the memory that the Internet Explorer uses justs keeps going
up and up
and one time (maybe after 15 - 20 minutes) it just crashes...
To be more specific, my application loads a new swf in a
regular basis (every 30 seconds)
to make it like a slideshow...
and it also has fonts embedded in it
yet to minimize the total memory used by this application,
I've did somthing like this...
var sys:SystemManager = contentLoader.content as
SystemManager;
if (sys && sys.numChildren>0) {
sys.removeChildAt(0);
contentLoader.content.loaderInfo.loader.unload();
contentLoader.source= DisplayManager.convertToAppSWFName (
subAppID );
and every application has an removedEventHandler which
listens to removed Event,
and removes all listeners registered to it when it is removed
from this display list..
So I'm very curious why the memory usages just keeps
rising...
If you have any hints, they'd be greatly appreciated...
Thanks in advance!!!!Loading external swf containing code (even a single stop() !) is not allowed on iOS...
-
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) -
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 -
How to load multiple swfs to my main flash file??
I am using the following code
In actions for Frame 1:
var myrequest:URLRequest=new URLRequest("A.swf");
var myloader:Loader=new Loader();
myloader.load(myrequest);
img1.addEventListener(MouseEvent.CLICK, clickButton);
function clickButton(event:MouseEvent):void{
stage.addChild(myloader);
img1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_5);
function fl_ClickToGoToAndStopAtFrame_5(event:MouseEvent):void
gotoAndStop(13);
In action for Frame 13: (img2 is another button)
img2.addEventListener(MouseEvent.CLICK, unloadFunction);
function unloadFunction(event:Event):void{
stage.removeChild(myloader);
This code works perfectly fine. My only problem is, How do I get multiple swf loaded. When I tried to copy and paste the same code for the other swf, but the following errors appear. I'm pretty sure theres a way to have multiple swfs (btw the multiple swfs will be linked from different frames).
Scene 1, Layer 'PAGES!', Frame 2, Line 7 1021: Duplicate function definition.
Scene 1, Layer 'PAGES!', Frame 2, Line 2 1151: A conflict exists with definition myloader in namespace internal.
Scene 1, Layer 'PAGES!', Frame 2, Line 1 1151: A conflict exists with definition myrequest in namespace internal.
Can someone please help me with this. ThanksYou define the same variable or function names more than once in a file. But you can reuse them in other frames. Try something more like the following in frame 2....
myrequest=new URLRequest("A.swf");
myloader.load(myrequest);
leave all of the rest out for starters... the same function from frame 1 can be re-used without rewriting them. I don't know what the deal is with img1, but if you need to change what it does, then add that back in. -
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 -
Can i use multiple-Swfs in one page to implement the real multi-thread?
When there are multiple .swfs in one web page, if there will be multiple instaces of flashPlayer and run in multiple thread ?-- Per Swf Per instance and Per thread, is it?
hi,
It will not work at all In web browser enviornment. If you considering to
make a scheme in which u use two swfs one helper swf for background
processing and another for Displaying Front End.Problem remains there if you
manage to send data from your one swf to the other in same page using
localConnection . When the processing starts in the helper swf whole page
will going to be stucked for the period until the helper swf has done
processing the data.So its no use at all. Altough this library can help you
make time slice based threads http://code.google.com/p/async-threading/ -
HELP! How to load multiple swfs using the following code?
In actions for Frame 1:
var myrequest:URLRequest=new URLRequest("A.swf");
var myloader:Loader=new Loader();
myloader.load(myrequest);
img1.addEventListener(MouseEvent.CLICK, clickButton);
function clickButton(event:MouseEvent):void{
stage.addChild(myloader);
img1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_5);
function fl_ClickToGoToAndStopAtFrame_5(event:MouseEvent):void
gotoAndStop(13);
In action for Frame 13: (img2 is another button)
img2.addEventListener(MouseEvent.CLICK, unloadFunction);
function unloadFunction(event:Event):void{
stage.removeChild(myloader);do you want to load another swf (eg, B.swf) when you're in frame 13 and img2 is clicked? if yes, and you don't want A.swf to continue to play, use:
//In action for Frame 13: (img2 is another button)
img2.addEventListener(MouseEvent.CLICK, loadF2);
function loadF2(event:Event):void{
myloader.load(new URLRequest("B.swf")); -
Need to shift multiple objects across many frames
I don't know if this is even possible, but what I'd like to
do is shift multiple objects, in multiple layers, across multiple
frames. The problem is that I built a complex animation as a movie
symbol within the root movie. It got so complex, however, that I'd
like to just go ahead and make it the main timeline for the root
movie. But when I copy and paste the frames from the symbol back
out into the root timeline, the location is wrong. Everything is in
the correct location relative to each other element, but wrong
relative to the stage. Is there any way to grab everything up in
all of those layers and frames and just shift it all over to where
it's supposed to be? Or can I somehow shift the stage under it?
Thanks in advance.Edit Multiple Frames.
it's in the help docs but also here:
http://www.biteycastle.com/lessons/emf.htm
--> Adobe Certified Expert (ACE)
--> www.mudbubble.com :: www.keyframer.com
-->
http://flashmx2004.com/forums/index.php?
-->
http://www.macromedia.com/devnet/flash/articles/animation_guide.html
-->
http://groups.google.com/advanced_group_search?q=group:*flash*&hl=en&lr=&ie=UTF-8&oe=UTF-8
thewizzard24 wrote:
> I don't know if this is even possible, but what I'd like
to do is shift
> multiple objects, in multiple layers, across multiple
frames. The problem is
> that I built a complex animation as a movie symbol
within the root movie. It
> got so complex, however, that I'd like to just go ahead
and make it the main
> timeline for the root movie. But when I copy and paste
the frames from the
> symbol back out into the root timeline, the location is
wrong. Everything is in
> the correct location relative to each other element, but
wrong relative to the
> stage. Is there any way to grab everything up in all of
those layers and frames
> and just shift it all over to where it's supposed to be?
Or can I somehow shift
> the stage under it?
>
> Thanks in advance.
> -
I need to have many movieClips and load them from an external
swf. I can make that work using a movieClipLoader, but I need to
gotoAndStop on a different part of the loaded movieClip timeline
for each loaded instance. What's the best approach?
Multiple loaders?
Thanks,
PaulUse a ViewStack (or perhaps a Canvas - it depends on what you
are trying to achieve).
For the ViewStack solution you'll need a container for each
SWF (such as Canvas or HBox). Into each one, use SWFLoader to bring
in the SWF.
For the Canvas solution, just use SWFLoader and set their x
and y positions so that they are on top of each other the way you
want them. -
Performance of loading multiple iFrames on a page
I have a "master" Apex page with 20 iFrames, each of which loads a different Apex page (don't ask!)
It takes quite a while to complete the loading of the whole page and all its iFrames, and I'm trying to see if there are any bottlenecks slowing things down.
If I monitor v$sessions where the client_identifier includes my session_id while the page is loading, I never see more than 2 pages building simultaneously. This could simply be because each one builds very fast, but on the other hand could it be that there is a limit being imposed somewhere that prevents 3 or more of my pages loading simultaneously?Thanks, John. You put me on the right path - the browser: when I changed from IE to Firefox the number of simultaneous Oracle sessions immediately jumped to 8. Googling then found me the "Tweak Network Settings" tool which allowed me to tweak Firefox such that all 20 sub-pages got built simultaneously.
Having done that, it was now clear that the bottleneck is not the page build anyway: all 20 Oracle sessions would complete and it still took another 10-20 seconds for the full page to appear on screen. Most of that time is the Javascript being run on each of the 21 pages - which presumably has to run serially: disable Javascript and the pages load much much faster.
I would say that the bottleneck you're seeing is really a result of the implementation, is there perhaps another way it could be done instead of using that many iframes?For sure! But where's the fun in that ;o) -
Load multiple swfs sequentially
Hi
I'd like to split a long movie (about 10mb) into a series of 5 or so swfs. The idea is that only the first movie would need to pre-load and then subsequent swfs would play seamlessly in sequence (so each swf loaded in turn as preceding swfs play). Can kind person provide some insight on the best way to achieve this? Is it very complicated to do? Is this the way that the cs5 trailer on the Adobe.com homepage has been put together?
Many thanks in advanceHi,
thanks for your reply.
I know duration of each SWF file. Is it possible to say that
after this time the second SWF should go and so on. If so please
tell me how to do it by code.
Thanks again. -
Flash app loading multiple swfs
Hi ...
I am having to fix a load problem with our Flash app. The
current code loads in 3 to 4 swf's (100 to 300 kb in size) into the
main swf and the same time. Should the swfs be loaded sequentially
or is ok for them to be loaded all at once?
ThxLoading external swf containing code (even a single stop() !) is not allowed on iOS...
Maybe you are looking for
-
Prevent Load Balancing in a Remote Desktop Services Deployment
We need to prevent two Remote Desktop Session Hosts from load balancing between each other. Currently they are load balanced and users dont have a means of ensuring they end up on a particular server. Is there anyway that we can accomplish this? Chee
-
Looking for Labview instrument programmers in/near Michigan
We are looking to hire a programmer familiar with Labview for high speed instrument control and data analysis applications
-
I try to download Firefox 5 but Firefox 6.0.2 keeps downloading
everytime i try to download firefox 5
-
Trying to register my trial LIGHTROOM5
Trying to register my trial Lightroom5 as a stand alone package and not a monthly package with photoshop. When I go into register, it asks for the serial number which I do not have and I am unable to contact Adobe for help. Any suggestions would be
-
Can I change my adobe ID email?
can I change my adobe ID email?