ActionScript 3.0 :: Loaders Continue Loading Same Swf Over And Over?
Feb 13, 2009
I have 5 loaders on a frame, each loads an external .swf on enter_frame. Everything works great, but the problem is that after this frame, the movie gets really bogged down and slow.
After running through debug, it looks like the loaders are loading the .swfs over and over again, so I end up with multiple child .swfs in each one, which I am guessing is the reason things start running slow. I am obviously missing the script to tell the loader to only load once, then stop loading.
Here's the code:
Code:
stop();
brandsOne.addEventListener(Event.ENTER_FRAME, brandsLoader1);
brandsTwo.addEventListener(Event.ENTER_FRAME, brandsLoader2);
brandsThree.addEventListener(Event.ENTER_FRAME, brandsLoader3);
[Code]...
View 4 Replies
Similar Posts:
Oct 18, 2010
I'm trying to learn something new: "contentLoaderInfo" and need some advice. I'm loading a bunch of thumbs so far, and will be loading the large version of those images later (after I get this part working) for a gallery.
I declared all the loaders and the URLRequests. And listeners like this: loader1.addEventListener.COMPLETE, processLoaderOne; loader2.addEventListener.COMPLETE, processLoaderTwo;etc.
If I try to load them all in successive statements,
loader1.load(URLRequest1);loader2.load(URLRequest2);loader3.load(URLRequest3);loader4.load(URLRequest4); and in the functions (processLoaderOne, processLoaderTwo, etc.) if I try to place the content on the stage by saying: loader2.x=loader1.x+loader1.contentLoaderInfo.width, it doesn't work.
I get this message: "Error #1009: Cannot access a property or method of a null object reference."
But if I "daisy-chain" them together by loading one loader (and use contentLoaderInfo.addEventListener(Event.COMPLETE, processLoaderOne) ) and put a load statement to load the next subsequent loader as the last line in that function, it works OK.
Is there any way to use the first method, loading all the loaders at the same time? And using Event.COMPLETE in their addEventListener declarations?
View 8 Replies
Jan 8, 2012
I have some code where I am loading a few hundred images into an array in Flash. I am using XML to pass in the list then a Loader for each entry like this -
for (var i:int = 0; i < myXML.item.length(); i++) {
imgloaders[i] = new Loader();
imgloaders[i].load(new URLRequest(myXML.item[i].imageLocation));[code]...
I want to perform some action once all of these have finished loading. The only way I can think of is to increment a count each time one finishes and have a Timer that checks if the count has reached the number of images I am loading.
View 3 Replies
Sep 12, 2010
I load something, I do something with it, then I can load something again, then I do something with it, etc .... I create many functions for this flow of events, is there a way to stay in 1 function?What i want:
Code:
public function Main(){
var result1 = load('file1.php');
[code]....
View 1 Replies
Jul 2, 2008
In a buttons code, how would I say finish loading, then play. Here is what I have:
btn.onRelease = function(){
loadMovie(movie.swf);
//finish loading code goes here
gotoAndPlay("label");
}
View 6 Replies
Oct 16, 2007
I know this is probably a easy change but i can't seem to figure it out.I want the code below to start playing at 25% and continue loading as it plays,
Frame 1 AS:
bytestotal = getBytesTotal();
ON A MOVIE CLIP:
onClipEvent(enterFrame){
_root.bytesloaded = _root.getBytesLoaded();[code].....
View 1 Replies
Jan 14, 2008
I have a number of menu buttons (home, about, contact, etc). Each button loads a new/different movieclip onto the scene. Each movieclip when loaded plays up to frame 25 and stops. When I click on any of the menu buttons, I want the current/loaded movieclip to continue playing until it reaches the end of the clip before loading the next. I tried this actionscript with no luck!
[Code]...
View 2 Replies
Sep 2, 2010
i have been building a library that has thumbnails which you click to view the full image. i have built the application it works but i want to change the way the image on the actual thumbnail loads using code instead of manually adding the value to the url loader component.
var myX;var instanceN:String;trace(instanceN);var currentLoad:uint = 0;// current loader and image loadingvar thumbnailURL:String;//Thumbnail URLvar thumbReq:URLRequest;// Thumbnail url requestfor(var k:uint = 0;k < iL_btn.length; k++)[code].....
the loop runs fine without the last line of code which i've commented out.the make up of these thumbnails are a uiLoader component which are each inside there own movieClip.what i wanted this to do was every time the loop runs it currentLoad adds 1 to its value then that value is subbed into instanceN:String and thumbnailURL address that bit works the trace statements read correctly.but my issue is using the instanceN value as the instance name path which then loads the current thumbnailURL value which is the URL address for the thumbnail picture.when i try to load the url address using the commented out code above i got the error .TypeError: Error #1010: A term is undefined and has no properties.the trace statements correct values below
the first value is the currentLoad value.
the second value is the instance name path.
the third is is the URL address for the thumbnail.[code].....
View 3 Replies
Nov 24, 2009
Is there a way for flash to detect a user's bandwidth, and depending the size of bandwidth, stop loading, or continue with the load? Now that I'm thinking about it, this would probably be a javascript detection script and if the bandwidth is high, load .swf, if not load a .jpg?
View 3 Replies
Aug 26, 2010
My main project loads an external .swf ("room") depending on which button the user clicks. Once that external .swf ("room") is loaded, the viewer chooses a ("demo") .swf to view. For each button click, a loader is to appear showing the viewer that the desired room or demo is loading. All of this works fine for the web...please click the link below to view.
The problem exists when I try to publish as an .EXE. We'd like to send these out to prospects on CD and thus I need an .EXE to autorun when insterted in a PC. I've published the main .SWF (overhead map) as an .EXE and burned a cd containing all necessary files. Now when the user clicks a room and then a demo, the loader that shows up fine on the web does not appear...the button stays in the down state until the demo .swfs loads and then the demo appears and plays.
View 18 Replies
Feb 18, 2011
I'm making an image gallery and am loading about a dozen thumbs that load a larger image when each one is clicked. Works just great so far. But, as expected, there's a little pause before each corresponding large image is displayed.I'd like to eliminate the wait, if possible, so here's my question: As a matter of preference or programing style, whatever you want to call it, do you guys usually load ALL the images first, thumbnails as well as large images, before displaying anything on the stage? Or do you just load each large image when necessary, after its corresonding thumbnail is clicked?Sometimes I see very cool Flash sites that have the percentLoaded line or twirler displayed for what seems like a long time, but then each screen (MovieClip) after that displays fairly quickly and I'm wondering if that's what's happening - all, or at least a LOT of the images are being preloaded
View 3 Replies
Nov 9, 2010
Edit - managed to find an answer to this by using _parent instead of _root
I've got a swf loader that loads a swf obviously but in the swf that's being loaded I have a button inside of a movie clip which I use...
Code:
on (release) {
_root.gotoAndStop("page1");
}
When viewing the swf file on its own this works perfectly, however when it gets loaded into the first file it no longer works because the root has now changed to that first file.
View 0 Replies
Mar 8, 2010
I am making a web page and i have to load in to main page swf multiple swfs that represent background. First there is a gradient swf than swf with snow particle system. My question is what would be best practice to use one loader for all different swfs that are in the background or should i use different loaders for different swfs?Here is what i mean:
1.) var loader:Loader = new Loader();
I use this loader to load first gradient swf and after it it has completed loading i use same loader to load snow swf.
2.) var loader:Loader = new Loader(); + loader = new Loader();
I use this loader to load first gradient swf and after it it has completed loading i set it again to be loader = new Loader();
and than i use this loader to load snow swf.
3.) var bgLoaderGradient:Loader = new Loader(); + bgLoaderSnow:Loader = new Loader();
I use it to load gradient swf and than i make new loader,
bgLoaderSnow:Loader = new Loader();
to load snow swf.
So what would be best way to do loading of the swfs.
View 5 Replies
Jun 28, 2010
I have a project that needs 4 levels of zoom, each with its own image loading in. So, to make things easier on myself, I made an array of the Loaders, so I can instantiate them and hide/display them when I need toHowever, this doesn't work as I had expected. I.e. (using just two level for simplicity):
Code:
private var photo:Loader;
private var photoLarge:Loader;
[code].....
View 4 Replies
Aug 26, 2010
I need to load and unload thumb buttons with images loaded in them. I load an xml, create the clips, then load the images into the clips.
When I remove the clips, I need to unload the loaders first?
Can I store references of the loaders in an array and use the array to unload them?
How should I delete the clips? removeChildAt()? Or use an array?
Here's relevant code:
Code:
function createScrubThumbs():void {
for(var i:Number=0;i<thumbsXml.thumb.length();i++){
var picHolder:ScrubThumb = new ScrubThumb;
[Code].....
View 5 Replies
Jul 23, 2010
I am trying to load an image, with descriptive text and a back button on the click of a thumbnail of the image. I am using a MovieClipLoader instance to do this.
Here are my problems: I tried loading the image, with the text(which is within an external swf), using the same loader, but since I am placing them dynamically, depending on the dimensions of the image, I need to pass variables between the two. The image loader is taking longer than the text (obviously) but I need the dimensions of the image before I can place the text. How do I do that??
2. I tried using two loaders, with separate listeners, and the problem once again is that the text loads before the image, and is hence placed with default values instead of the values derived from the image. The code is within onLoadInit(). Is it possible for me to get the dimensions of the image from onLoadStart()???
3. There is a back button within the text.swf. I want the image and the text.swf to be unloaded when this button is clicked. How can I achieve that? Can I call loader.unloadClip(target), from within this? Will it recognize the variable?
View 1 Replies
Jul 25, 2010
I would like to know how to simplify this code. I would like to put the minnions into an array of loaders but everything I try does not give me the correct access. I would like to use for loops to put into the array setup.
package{import flash.display.*;import flash.events.*;import flash.net.*;import flash.net.URLRequest;import rebarr.*;public class Shrink extends MovieClip{ private var pictures:XMLClass = new XMLClass("xml/thepics.xml", "the pictures"); private var setup:Array = new Array(); private var minnion1:Loader = new Loader(); private var minnion2:Loader = new Loader(); private var minnion3:Loader = new [code].....
View 3 Replies
Aug 25, 2010
My main project loads an external .swf ("room") depending on which button the user clicks. Once that external .swf ("room") is loaded, the viewer chooses a ("demo") .swf to view. For each button click, a loader is to appear showing the viewer that the desired room or demo is loading. All of this works fine for the web...please click the link below to view. The problem exists when I try to publish as an .EXE. We'd like to send these out to prospects on CD and thus I need an .EXE to autorun when insterted in a PC. I've publised the main .SWF (overhead map) as an .EXE and burned a cd containing all necessary files. Now when the user clicks a room and then a demo, the loader that shows up fine on the web does not appear.
View 2 Replies
Nov 19, 2009
I have a movieclip, let's call it MC1. Inside the actions timeline of MC1, I create a loader and when a button in MC1 is clicked, the loader is added to the stage with an image.
On my maintimeline, you can click a button to bring a second movieclip onto the stage, let's call it MC2. MC2 has the same set up as MC1 where you click a button within MC2 and it adds its own loader with an image to the stage.
The problem is, when I click on MC2, MC1's loader is still on the stage, and I'm having trouble getting rid of it! I tried removeChild(loaderfromMC1) within the actions panel of MC2 but it can't reference variables created in MC1? and I tried removeChild(loaderfromMC1) when the button on the maintimeline is clicked, but it seems that I still cannot reference the MC1 defined variable.
View 1 Replies
Jul 6, 2010
in a loop i wish to load a sequence of images in an individual movieclip for each. e.g image0 in movieClip0, image1 in movieClip2 etc...
i've set up the loop and the movieclips are added using an array.
addChild(aMovieClips[i]);
when i use loaders.load(new URLRequest("assets/images"+section+cityCode+i+".png"));
it unloads the previous images and only shows one image in the last movieClip.
I then tried using loader[i].load but this didnt work.
I then tried creating the loaders outside of the loop and then adding them to an array but this doesnt seem to work.
specifically it breaks at aMovieClips[i].addChild(aLoaders[i]);
How do i go about adding a different image to each individual movieClip.
View 5 Replies
Sep 1, 2010
I need to have scrub thumbs for video player load and unload repeatedly.
Something isn't getting cleared. Every time the thumbs are removed, there's a slight increase in the cpu baseline - something is piling up in memory.
Below is the relevant code:
Code:
function showScrubThumbs():void {
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
xmlLoader.load(new URLRequest("testThumbs.xml"));
}
[Code].....
View 1 Replies
Jun 29, 2011
I am essentially loading images from an XML file and animating them to continuously scroll across the stage. I have finally got the code working decently well, the biggest problem is a slight stutter in my Tweens. I am using the Tweener class and I am animating loaders as follows...
Code:
xml = XML(event.target.data);
xmlList = xml.children();
imageCount = xmlList.length();
for(var j:int = 1; j < 11; j++){
imageLoader = new Loader();
imageLoader.name = ""+(j);
[Code] .....
Do you think that the Tweener class is causing the occasional stutter/shake from the images or the fact that I am animating the loaders themselves. I am aware there is bitmap smoothing but I cannot do that with loaders.
View 0 Replies
Apr 23, 2010
I'm using code from the tutorial: "Preloading in ActionScript 3" found on this site...I used the exact code, and changed only the swf it's loading in.My swf is pretty simple....just some buttons that contain loaders themselves.Somehow, when i simulate download....it seems to skip the preloader, and immediately load the swf...slowly and choppy. I don't get any errors or anything.[code]...
View 1 Replies
Mar 20, 2006
Is it possible to put pre-loaders on to movie clips?
Here's what i'm trying to do. I am makeing a web page. I have movie clips which load external pictures (jpg's) and put them into the movie clip using a mask. Now, to keep user's at the page (as the jpg's aren't instantly loaded) i want to put pre-loaders in.
This is the code that loads an image into the movie clip. It is loacated on its own layer (i.e. not attatched to the Movie Clip):
_root.instanceName.mask.loadMovie( "imgs/backgrnd/home.jpg" );
View 3 Replies
Mar 1, 2009
I'm taking my old as2 and trying to convert them to 3.what i wold like to know is whats the command for:
- saving a image.jpg while runing a film. .
is that posible?
-how do i create a array of loaders and mcs?
-how do i create an empty movie clip ?
-how do i open an internet page inside a swf.its easy to open a pic or another swf.but it cant be similar
View 3 Replies
Apr 3, 2009
I've an all flash website embedded into an HTML page with SWFObject. The embedded index.swf consists of a menu and a Sprite. At first a home.swf page is loaded into the Sprite. When a user clicks a link on the menu, a new swf is loaded and placed in the Sprite, replacing whatever was there. This works nicely.
However, my problem is that the only content that appears to be indexed by Google (or probably any other search engine) is what's inside the alternative content <div> on my html page. I understand that Google can now crawl swfs, but, does it crawl swfs loaded with a Loader?
I should probably mention that I use SWFAddress for browser functionality: back/foward buttons and <title> text etc. However, the URLs sent to the Loader instance are simply filenames like "page.swf". This is important as google ignores everything after hashes in URLs, eg www.mywebsite.com/#/home.swf is treated as www.mywebsite.com/ by google. SWFAddress uses hashes in addresses for browser-swf interaction.
Is there any way for me to keep the menu visible to the user at all times and load the content elsewhere, thus maintaining my menu transitions? As far as I know, content loaded in <iframe> tags isn't crawled either. I'd prefer not to have to switch to static pages to get my pages indexed.
View 2 Replies
Feb 25, 2010
Picking up on something wvxvw said recently in another thread:[code]you shouldn't start several loading operations concurrently, you should wait for the first loading to complete and then start another loading, otherwise you are risking to get "request timed out".Had me wondering. I recently changed things around in several of my scripts when I found that running multiple loaders would speed my overall time spent loading by a significant amount (often halving the loading time).So I was curious for some more information and opinions on the matter.[code]
View 1 Replies
Feb 7, 2011
What I am trying to do is build some kind of Loader-SWF that loads several animations (swf-files) and then plays them back one after the other.
What I am struggling with at the moment is how to find out when the first animation has finished and then switch to the second one. Since the Loader-Object I use to load the swf doesn't seem to dispatch a suitable event I thought I'd just do the following on the last frame of the animations I am loading:
Code:
stage.dispatchEvent(new Event('nextClip'));
and then have this in my "Loader":
Code:
stage.addEventListener('nextClip',loadNextClip);
This works fine when I just have my first animation clip dispatch the Custom Event, but as soon as I add the code to all the other animations it will throw an 1009 error (referring to the last frame of the newly added animation) as there somehow seems to be some confusion regarding what "stage" is referring to now.
View 2 Replies
Mar 7, 2009
I have a website I'm working on that uses multiple loaders. It has one preloader that loads the main page. The main page, then loads the various subpages of the website with a closing door animation between them. I have not created the instances of the Loaders within any function. However, when I run my movie, everything runs great, except on one page I have a combo box that functions fine except it will not drop down. I can click on it and press down to select the option I want, but I cannot get it to drop down. I had a friend of mine at work say that the preloaded components are kind of fussy like that, but there should be a solution!
I have another website that I preloaded a page that has the same input component on it that works fine, but the only difference I can think of is that I only have one level of preloaders on this site.
Code:
var enlistLoader:Loader = new Loader();
navbar_mc.enlist_btn.addEventListener(MouseEvent.CLICK, enlisthandler);
function enlisthandler(E:MouseEvent):void {
[code]....
View 1 Replies
Apr 15, 2010
I have a parent swf that loads in 6 little swfs. However, I have a button which should remove the loaders from the stage, no matter which one it is from the 6. At the moment I can only remove one of them because of the way I have coded the application. So, when I click on the button which is supposed to remove whatever loader is currently sitting on top of my parent movie, it only removes one of the loaders - the one which is named first under my resetAssets function.
I can not have:
removeChild(ldr);
removeChild(ldr2);
removeChild(ldr3);
etc.
Because only one of them is being displayed at the time and flash goes like "hey dude! where are the others you want me to remove then!?" I suppose the whole code has been built up poorly and I should loop the swfs through one loader instead of having a loader for each swf.. Then I could just remove the loader no matter what sits in there..?
Code:
//imports
import flash.filters.*;
import flash.events.*;
import flash.display.Loader;
import flash.display.Sprite;
var ldr:Loader = new Loader();
var req:URLRequest = new URLRequest("load_XML.swf");
[Code] .....
View 1 Replies