ActionScript 3.0 :: Loading All The Loaders At The Same Time?
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
Similar Posts:
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 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
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 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
Sep 21, 2010
I have a game built and I would like to reduce the loading time to the minimum possible.One of my ideas is to load the essential assets and some lower quality images the first time, leaving the higher quality images and some of the functionality out at first (for instance things like buttons that change the background color), and once the player enters the game, the rest of the functionality and its assets (images and sounds) will be loading in the background using the Loader class.So once the non-essential assets and the high quality images have loaded they will fade in and substitue the lower quality assets in the most subtle way possible.
Also... Would it be better to have various instances of a "Loader" class and try to load everything at once, or load stuff in order with a single instance of the "loader" class listening to the Event.COMPLETE event ?
View 1 Replies
Mar 2, 2005
I tried searching for an answer to this on the forums and it seems you can't duplicate a movieclip that has a dynamically loaded jpg in it, I mean you just get a duplicate empty movieclip?What I want to do is have 3 copies of a pic, each tinted a little differently, and have them converge and reveal the "composite" of this pic. Do I then have to use loadMovie 3 times?Does loading the same 50kb image at the same time mean you're actually loading 150kb?
View 5 Replies
May 21, 2008
i was creating my portfolio using xml gallery script from this site. the thing is that it loads one picture at a the with a preloader between each load. is there a way to load the first image and keep loading the rest so there will be only one loading time? here is my action script:
[Code]....
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
Aug 4, 2010
My UILoader component seems to only want to load one swf at a time. ie if it loads "gallery-sketches.swf" first then it wont load "gallery-graphics.swf".If it loads "gallery-graphics.swf" first than it wont load "gallery-sketches.swf". They work just fine individually but one cancels the other out when you put them together.Here are my errors (the "2","9" and "5" are tracing a random number generator and I'm 99.99% sure they have nothing to do with the error):
2
galleryClick
9
graphicsClick
[code]...
View 1 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
Jul 12, 2006
I have some XML AS that creates buttons and loads data into some text fields. Also loads an image when you click a link...It works great most of the time! But I have noticed sometimes it just doesnt load the text and I need to click onto another frame and click back to make it work... I am guessing there is some small thing missing from my code?
[code]...
View 3 Replies
Feb 12, 2010
I am loading an external swf animation and playing an audio which should be synchronized with the loaded swf i have used the loader class for loading swf and sound channel to load sound, when the audio gets fully loaded only we are calling function to load swf, at that time audio remains stopped when the swf too gets fully loaded, we are adding swf int stage and playing the audio. In local system it works fine but when we upload it its not synchronizingly properly for the first time The issue what i see is that swf (only one is there) gets loaded frome inbetween ie the first ceration animations are missing. and audio is playing from the begining why is it so....
View 1 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 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
Sep 4, 2009
I have a rotating menu that when clicked rotates and loads in swf movies, OnClick.
The problem I seem to be having is that because the swf movies load in on click it seems to be causing the rotation of the menu not to run smooth.
Question: Is it possible to get the swf movies to load in once the action of the click has completed its action. some kind of 2 second delay before the movies load in??
what happens: you can click or mouse scroll through the menu, when you click, the action repositions the selected Item (ActiveItem) in the center and resizes larger. this works great, is it possible after this action is complete to then load in the swf movies?
to see how the movie runs at the moment this is the link: [URL]
you will see at the moment onClick the movies load straight away which makes the rotation not smooth when rotating around.
I can't seem to get the mouse scroll to work the same function as the click at the moment also.....thats for another day
View 11 Replies