May I know if you are using AS2 or AS3?
Would suggest using AS3, which has better control with events.
You can load AS3 content using URLLoader, Loader classes.
If its AS2 just check the link below
for a free very simple loader.
Hope this helps
Hi, Skarthiks. I'm currently using AS2, although I don't have any issue using AS3, as long as it's supported on as many systems as AS2 is.
What I'm asking is if HTML and graphic content OUTSIDE of the SWF are loaded as the SWF plays/loads, or if the downloading of the SWF monopolizes on the bandwidth.
As I mentioned, why I'm asking is I'm wondering if I have a swf on a font/splash page that loads ITS content on the first few frames of its timeline, then holds on that (plays several seconds of that content sitting there, or animating, .... would content OUTSIDE of the SWF (like hidden images on the HTML page) load while it's holding or playing it's animation. I'm basically asking if an SWF animation (playing for several seconds) could act as a delay mechanism, allowing hidden images (enclosed in a <div style="display:none"> tag a bit more time to load, before the SWF triggers the loading of the second (internal) page.
I currently have a short SWF splash animation, and the hidden images all on my first page... but wonder/worry if there's not enough time for the hidden images to preload... So, I was wondering if making the SWF animation hold or play longer would give the hidden images more time to load.
Are you suggesting, though, that I should/could use the SWF to load the images into itself, and that it would result in the images being stored in the computers cache, as it would by having them in the HTML code? That would be good, as I would assume I could then actually monitor the loading of them, and have the SWF act as a proper preloader for the non-SWF content (...the images that appear in the HTML code....), which waits until the content is fully loaded before moving on.
If so, I'm not familar with how to do that with non-SWF content. I checked out the links you sent. The first one is a bit over my head at the moment, although I will try and teach myself it. The second link is just a standard preloader for the SWFs content (not addressing content outside of the SWF that appears on the HTML code).... unless I can rig it up to load the images into the swf, rather than the HTML.
So, if import the jpg images into the library of the SWF's .fla, and place them either offstage, or set them as hidden, on (say) frame 3, and do a standard preloader on frames 1-2, would that effectively load the jpg files into the computers cache so that when I then have the images appearing in an HTML page loaded later (embedded in an <img> tag or appearing in a table), would they be taken from the cache, or considered a different file, and have to download? Is a jpg in the library (and one of the frames) of an SWF the same as a jpg appearing in the HTML code, or is the jpg in the SWF not really a separate jpg, but just part of the SWF code (and therefore would have to be downloaded if you try and display the jpg itself on the HTML code)..... or, do I have to somehow load the jpg into the SWF as an external file (rather than bringing it into the library and stage of the .fla)?
Loading swf or an animated swf will not monopolize the download of the images on the html. So yes, you could use swf as a splash screen to allow the rest of the content to download.
and no, the images downloaded by the swf cannot be used in the html.
The above holds good if you would just want to use flash as a guy to buy time for the rest of the page to load.
On the contrary, you could also design the whole page using flash (i.e.) without any html. You could code in flash to download the images, and also display the images using flash itself. This is just a suggestion if you would want flash to do more for you. In this case, the code would know how much time to wait before you can go to the next screen.
Also, AS3 would run on all the machines which have flash player installed (I would assume this). If flash player was updated anytime in the last 2 years AS3 should work.
Cool. Ya, that's exactly what I'm trying to do there.... create a delay so that the hidden HTML images will have a chance to download. Only issue is, there's no way (I know of) to tell how much time they need... and even in the sense of 'time in seconds', that'll change with each visit anyway.... so, ideally, you'd have some sort of monitored system, where it waits until it's loaded, rather than assuming a certain amount of time needed.
Weird thing is, if there is a delay in going from page to page, it sometimes occurs with pages that SHOULD have had the content cached (since you visited it previously). Not sure why the delays sometimes happen. I'm starting to suspect it's not downloading delays, but embedding or script delays.
Ironically, I'm actully redoing my website from my previous version which WAS totally Flash. I just found updating it a bit of a pain... and kind of liked the 'infinitely vertically stretching HTML page', as opposed to having to fit everything on a set Flash stage (or deal with adding multiple pages when content is added). I know there are ways to make it easier, etc... with new commands and technques... but I wasn't aware of them, and wanted to go with something I was a bit more familiar with for now. But, ya, I did love how everything in Flash was self-contained, so going from one page to another was done as one nice unified block (rather than independent pieces like in HTML), and you could transition to them, and preload and pause. Definitely nice... I just found updating was a bit of a chore.
Is there no way to load an external jpg into the SWF (not the FLV), as opposed to having it in the library.... like you would do for loading an external SWF into another level of the main SWF? I would have thought that THAT would result in that file caching. Ah, but then I'd have to figure out how to monitor that download... I'm sure there's a command for it (checking the status of a download of something other than an incoming SWF).... but I'm now aware of it offhand. I'm good with AS, and have done some complex stuff with it.... but there's still LOTS of commands I haven't learned yet, or know of.
Well, rather than have some sort of monitored preload of the HTML grahics, I'll just have an intro splash that gives it some time.... Might not be enough, but it'll help, I'm sure. It loads fast as it is... but I figured I'd give it a boost, just in case there's download delays.
Hrmmm... Maybe I'll switch it over to AS3 then. I generally try and keep the version low, to be fully compatible, but ya, I figure most people update their Flash.... I hope.
Additional question: Is there a means to load an external SWF into the main SWF, but not have it play?
I was wondering if I could preload the SWF used in the next page, in the SWF of the first (splash) page.
It would be easy enough to load it (loadMovieNum) into another level, but then it would play, wouldn't it? Is there a way to just load it, and not have it appear or play? Not sure how you would do that. Can't position it remotely, as far as I know, by the main SWF.
I'm very familiar with standard preloaders and loading external SWFs into other levels... but still very green on stuff beyond that (...variations of that, using commands other than loadMovieNum and the usual bytesLoaded / framesLoaded thing). I've been reading up on other commands and methods again, but it's a bit overwhelming at this point.
Yes, writing it in AS3 would be much more easier to maintain and definitely more structured.
To download an external image from a flash screen is very easy:
Please check this help page http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/net/URLLoader.html#loa d() and yes you would know how much is loaded of which image
There are lot of tutorials on the net which helps you load an image:
the above is one of them.
Also, you could use Loader class to load swf, images etc.
And yes, you can load a swf and not show it on the screen. The swf would run only after assigning the download swf content to a movieclip and add this onto the stage using movieclip.addChild(loadedswfdata).
Here is a simple tutorial for loading a swf: http://www.iheartactionscript.com/loading-an-external-swf-in-as3/
Hope this helps
Sounds very promising! I'll look into all that. I'll teach myself about loader classes next, and then some of the other items you pointed out. I've only really been familiar with the loadMovieNum type of thing... loading it into a new level.... and that seems to display and play it right away.
Thanks, Skarthiks. You've been very helpful... and fast!
Hey, if you're still there...
I read over the links, and a lot of it was a bit over my head. I couldn't find anything in my AS books about the subject either.
If you wouldn't mind, could you provide me with the bare bones code required to load an external swf into a main swf without displaying or playing it... and so that it doesn't move on until it finishes loading (or, alternatively, triggers the load of the next html page once the external swf is loaded)? I dont' need status displays or aything like that. Just load it silently, and 'react' when it's done (either via some sort of listener, or simply holding on the current frame until the content is loaded).
Unfortunately, the last tutorial doesn't contain any explanations. It's just the code... and the one about loading external images is better (explains it at least), but is still a bit baffling to me, as it's using codes and methods I haven't used before. I like to understand things as opposed to just cut and paste.
Otherwise, I'll just have a swf that plays for a bit, stalling the load of the next html page, allowing the images to preload a bit. Not sure how I'll preload the swf of the second page while on the first, though. It all loads within a second or two, so it's not a big deal... Just trying to speed it up more.