Preload SWF Levels into Main Movie
Hello - Can anyone suggest a reliable and efficient way to
preload several SWF movies into one Main "Container" SWF... and
show one progress bar. My problem is that I don't need all my SWF's
initially (they will be needed when the user navigates to that
page) but I would like to load them into some sort of cache for
later access. I would GREATLY appreciate any comments or
suggestions! Thank You!!
Here's what I am doing so far, but it's not working great:
On my master SWF I have the following Code in Frame 1:
stop();
//---------Function to Load New Movie--------------\\
var myMCL:MovieClipLoader = new MovieClipLoader();
var myListener
bject = new Object();
myMCL.addListener(myListener);
//---------/Preload Levels---------------//
myMCL.loadClip("Movie1.swf", 1);
myMCL.loadClip("Movie1.swf", 2);
myMCL.loadClip("Movie1.swf", 3);
myMCL.loadClip("Movie1.swf", 4);
myMCL.loadClip("Movie1.swf", 5);
myMCL.loadClip("Movie1.swf", 6);
THEN: on frame 2, I have all the movies I don't want to play
initially unload (with my thinking that they will be immediately
accessible when needed):
stop();
unloadMovieNum(1);
unloadMovieNum(2);
unloadMovieNum(3);
unloadMovieNum(4);
unloadMovieNum(5);
LAST OF ALL: I have this script in my preloader movie (to
supposedly add up all the bytes to load and show one seamless bar
for them all)
onClipEvent (enterFrame) {
// get the amount currently loaded for sum of all levels
loading = ((_root.getBytesLoaded()) +
(_level1.getBytesLoaded()) + (_level2.getBytesLoaded()) +
(_level3.getBytesLoaded()) + (_level4.getBytesLoaded()) +
(_level5.getBytesLoaded()) + (_level6.getBytesLoaded()));
// get the total needed to load for sum of all levels
total = ((_root.getBytesTotal()) + (_level1.getBytesTotal())
+ (_level2.getBytesTotal()) + (_level3.getBytesTotal()) +
(_level4.getBytesTotal()) + (_level5.getBytesTotal()) +
(_level6.getBytesTotal()));
// get percent variable by dividing amount still loading by
the total amount needed to load
percent -= (percent-((loading/total)*100))*.25;
// make the percent an integer (no decimal)
per = int(percent);
// display that integer with percent sign to make variable
percentage load in dynamic text box
percentage = per+"%";
//move movie clip slider to show percentage
tomMC._x = int(per * .01 * 230);
// if the amount loaded is great than 99 percent (i.e. it is
almost 100) then let master continue to play
if (percent > 99) {
_parent.gotoAndStop(2);
Text
Just a thought- can i refer to the external movie through the
loading component instance name?
Still wondering if I can control the time line inside the
external movie from the main movie...
Similar Messages
-
Control external swf file that is loaded into main movie
I've loaded an external movie into Scene2 of the main movie,
I want a button in the main movie, in scene two, which shows
up right now under the external loaded movie, to be able to
onRelease gotoAndStop at the first frame of the external movie
which is loaded into that scene. Do I just write that as:
AssociateSelected_btn.onRelease = function() {
gotoAndStop("RGSassociate.swf","frame1")
? I thought I tried this, but since the ext.movie is loaded
automatically on entering the scene it is not put into a level
(which would be easier to navigate)....
Any help/thoughts would be much appreciated, thanks!Just a thought- can i refer to the external movie through the
loading component instance name?
Still wondering if I can control the time line inside the
external movie from the main movie... -
Dling external .swf files while main movie is playing
Does anybody know a command to have your flash movie download
external .swf movies within the "main" movie while playing. I have
about 8 .swf's that are all linked together but the problem is the
loading of each one seperatly (kinda lags a bit b4 each movie is
loaded, because you have to download each and everyone) PLEASE help
me out I'm working on a big project here at work :yikes: Thank
you!!jsns wrote:
> Does anybody know a command to have your flash movie
download external .swf
> movies within the "main" movie while playing. I have
about 8 .swf's that are
> all linked together but the problem is the loading of
each one seperatly (kinda
> lags a bit b4 each movie is loaded, because you have to
download each and
> everyone) PLEASE help me out I'm working on a big
project here at work
> :yikes: Thank you!!
>
check help files for details and usage of "loadmovie" and
"loadmovienum" actions.
Best Regards
Urami
!!!!!!! Merry Christmas !!!!!!!
Happy New Year
<urami>
If you want to mail me - DO NOT LAUGH AT MY ADDRESS
</urami> -
Loading external swf`s into main page automatically after 300 frames
hi guys
i have a main file called DEMAND.fla that has a loader placeholder/positioner thingy in it with the instance name "loader_mc_james"
when the page opens it uses the code below to load in an external swf named demand_001.swf. to the placeholder location
loader_mc_james.loadMovie("demand_001.swf");
now at the moment i have 6 external files, demand_001, demand_002, demand_003 etc and use 6 individual buttons located on the DEMAND.fla page that the viewer clicks on to load each page as required, it all works fine and I happy with it.
In the future however i would like demand_001.swf to load up and when it gets to frame 300 autmatically load up demand_002.swf and so on.
MY QUESTION IS: What code would i stick at frame 300 to get that to happen?
Any advice would be appreciated.
Ps, it would also good if all the other exteranl files were loading into memory in the background as soon as the inital page is opened.
you can see what i have at the moment here
http://www.omega-completion.com/downhole_demand_activated_technology.htmlWhat you could do is have the DEMAND file include a fiunction that manages the loading and have your loaded files call that function. You could either have a variable that you increment to modify the name of the file to load, or just pass the name of the file to load in the function call. For the latter of the two your DEMAND function to load the files could be something like...
function loadDemands(swfFile){
loader_mc_james.loadMovie(swfFile);
loadDemands("demand_001.swf"); // to start things off
Then, in frame 300 of the 001 file you can have...
_root.loadDemands("demand_002.swf");
If you prefer the first option, then your DEMAND file would do the work of determining who gets loaded next and your loaded files would call the function without the argument. Something along the lines of...
var currentSWF = 1;
function loadDemands(swfFile){
loader_mc_james.loadMovie("demand_00"+currentSWF+".swf");
currentSWF += 1;
loadDemands(); // to start things off
Then, in frame 300 of the files you can have...
_root.loadDemands();
(NOTE: if _root fails, try _level0 ) -
Beginner! How to insert a dynamic swf file into a movie (AVI, FLA etc)
If I am intruding here with a silly beginner questions I apologize. I am new to Flash. I have purchased a dynamic flash intro sort of like this http://www.templatemonster.com/flash-intro/26664.html
It came with the full package including source files and but also simple editing through an xml file. I have the video as I want it but want to put it as an introduction for a full video (in AVI or .FLA format).
How can I export it as a video file without the need of anything else such as the xml?Just press insert into the program and bring up what you need to insert. Check out on http://www.famouswhy.com how do i did it.
-
Calling a function in the main movie from a loaded swf
I realize this is probably a very basic question, but I have
loaded a SWF file into another movie. I now want to call a function
in the main SWF. Is there a way to do that? Alternatively, I have a
custom class where I could put the function, but I haven't been
able to figure out how to call it from the loaded SWF either. Do I
somehow need to associate the class with the main movie,
or...?Never mind - I was doing something very stupid and wasn't
calling the function as a method of a movie clip. I was simply
calling checkTarget(event) rather than
event.currentTarget.checkTarget(event); which seems to work. -
Both main movie and external swf preloader - confusion!
Hi there!
I have a webite with my main movie (88kb) and an external swf
soundloop (1mb). I made a preloader, but it only loaded the main
movie, meaning that after the intro, the soundloop would not start.
I loaded the soundloop onto level 1, and then tried to make a
preloader with this code (I thoguht it worked but it really was a
total guess).
stop();
this.onEnterFrame = function() {
bl = _level1.getBytesLoaded()+this.getBytesLoaded();
bt = _level1.getBytesTotal()+this.getBytesTotal();
if (bt<=0) {
bt = 99;
bar.gotoAndStop(Math.floor((bl/bt)*100));
if ((bl == bt) && (bt>0)) {
delete this.onEnterFrame;
gotoAndPlay("Intro", 1);
Now when I test the movie, everything loads, but when the
soundloop is loaded after the intro, the preloader movie clip
appears and starts playing and repeating itself!
How on earth do I get rid of this?! You can see the problem
here:-
http://www.vanitee.co.uk/princess.swf
Thanks in advancePlease! Still in great need of help. Have tried all sorts
=( -
How does a loaded swf talk back to the main movie?
Hi,
I'm new to as3 and have troubles finding the right path for
swfs to "talk" to one another.
In my movie, I load an swf "news.swf" into a mc called
container_mc.
At one point I want to swap the "news.swf" to "ueberuns.swf"
via button click in my main movie, but not directly: "news.swf" has
a frame labeled "out", which builds down some elements over appr.
20 frames. In the last frame of "news.swf", I want "news.swf" to
either load the next "ueberuns.swf" into that same container_mc of
my main movie or have my main movie find out that "news.swf" is
through with it's last frame and then throw out "news.swf" and put
"ueberuns.swf" in that container_mc.
I already found out that I address "news.swf" by the
following code:
if (newsLaden.content != null) {
newsLaden.content.gotoAndPlay("out");
where newsLaden is the Loaders name. But how do I get
"news.swf" to reply?
Anyone can help? Thanks a lot!
Cheers, KarlThis is one of the biggest problems of AS3 as communication
between swfs, levels, and nested MCs has taken a completely
different path than the previous 9 versions of Flash. Both Erick's
and TheWabbit's suggestions will work but I sort of follow Erick's
approach as LocalConnection is the perfect fit for .swfs
communicating in the same HTML page not for nested. The key is
defining the timelines of MovieClips in each class when you want to
tell them to do something.
Try tera's example and see if that helps but if you
understand Erick's approach keep going. I just wanted to add that
you have to start thinking about defining the MCs you want to
communicate with in each Object Class file such as:
var _root:MovieClip = new MovieClip(parent);
and then you can always sort of define who you want to talk
to a bit easier.
THIS REALLY REALLY SUCKS for those of us who have been with
Flash since version 2 because they took away one of the best and
easiest things to do (but I'm glad telltarget is gone!! lol). Now I
fear people are going to start throwing everything back into one
LARGE SWF again thereby undoing all the work we in the Flash
community did in the first ten years to define 'best practices'
and_levels definitely was one of them along with an 'actions'
layer. I think Adobe's programmers who joined the Macromedia guys
led the product somewhere it didn't necessarily need to go. The
problem is many didn't know how to use the Flash Community's Best
practices. They were new to Flash. -
Closing swf loaded into movie clip
I have built a movie clip on my main flash file that I am loading separate swfs into. On the separate swfs I have a close button, but do not know what action script to attach to it to make the movie clip go away? I want these to go away every time you hit the close button on the separate Flash swfs loading into the main movie clip.
if the target movieclip has a non-negative depth and the close button is encoded on the loaded swf's main timeline, you can use:
var tl:MovieClip=this;
path.closeBtn.onRelease=function(){
tl.removeMovieClip(); -
How can I load an external SWF into a movie clip that's inside other movie clip?
Hi.
I creating my first flash (actionscript 3.0) website but I'm
stuck with a visual effect I want to create.
I have a window on my website called contentWindow. Every
time you click a button this window is supposed to leave the stage,
load the requested content and return to the stage.
The sliding window is a movie clip with 83 frames, 21 to
enter the stage, 21 to leave the stage again, 20 for nothing (its
just to simulate the loading time) and 21 to return to the stage.
Now my goal is, when the user clicks on a navigation button,
the window exits the stage, loads an external SWF with the content,
and then returns to the stage.
I've the "window" movie clip with an instance name of
"contentWindow". Inside there is another movie clip with an
instance name of "contentLoader". The content that the user
requested should appear inside the "contentLoader".
Now, when the contentWindow leaves the stage, I get this
error message:
quote:
TypeError: Error #1009: Cannot access a property or method of
a null object reference.
at rwd_fla::MainTimeline/trigger()
If I switch
"contentWindow.contentLoader.addChild(navLoader);" for
"contentWindow.addChild(navLoader);" it works fine, but the
external SWF doesn't move with the window.
How can I load an external SWF into a movie clip that's
inside other movie clip?Hi,
Recently, I have been putting together a flash presentation.
And I am just wondering if the following might help you, in your
communication with the said swf file:
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
onComplete);
function onComplete(event:Event):void
event.target.content.thinggy_mc.y -= 100;
Not the best example, but this allows you to target a mc
within an external swf file. I think if you look up this code, you
will have an answer ;)
Kind Regards,
Boxing Boom -
How to load swf into a movie clip?
i have an swf file i want to load into a movie clip within my
flash file, i think im supposed to use loadmovie () instead of
loadmovienum, can anyone help me out? thanksloadMovie("X",Y);
Where x is: the url of the swf file you want to load.
Where y is: the name of the movieclip you want to load it
into. You must give the movieclip an instance name.
For example, if I wanted to load '1.swf' into a movieclip
with an instance name of "loaderclip," my code would be:
loadMovie("1.swf", loaderclip); -
Making a loaded swf-file loading images into the movie..
Trying to convert my problem from norwegian into english
isn't always that easy... :)
Anyway..
I've created som cool buttons that I want to be loaded into a
movie (let's call i MainMovie.swf) and from there I want the
buttons to be able to load images into a movieclip (ImageContainer)
inside the MainMovie.swf.
Is it possible to make the MainMovie.swf communicate with the
the loaded buttons (each button is a swf-file containing the
actionscript, objects, etc.) so when the buttons are clicked they
load different images into the ImageContainer?
My idea here is to include an as.file into the MainMovie.swf
as well containing the url's to the images that I want to be loaded
into ImageContainer.
I've tried to create a button on a layer above the buttons
that's loaded into the MainMovie.swf but I end up with the loaded
buttons not working properlu because of the button that I've
created and placed above them.
Now, I don't want the url's inside the buttons thats loaded
into the MainMovie.swf as I want the ability to be able to replace
those buttons-files without having to use too much time writing the
url's in each button.
Thanks folks.are all your swfs using as3 or as2? if as3, you won't be
loading into a movieclip: you'll use a loader instance and you can
reference (or communictae with) the loaded as3 objects using the
content property of your loader once you cast it as a
movieclip. -
If I load an external swf:
my_loader.load(new URLRequest("abc.swf"));
addChild(my_loader);
abc.swf starts playing - how do I get it to tell the main movie that it reached the end of its timeline and finished playing? Added bonus: the loaded swf is AS1 and the main movie is AS3. I'm not sure if I could convert the loaded swf to AS3.
Thanks,
SeanI have not used this component but it may work for you:
http://www.jumpeyecomponents.com/Flash-Components/Various/ActionScript-Bridge-91/ -
Problem when load more swf files work with xml files into my movie
hi ;
I have one flash file & more of swf files which work with xml files .
when I load one swf file into my flash file and remove it and load anther one on the same movieclip in my flash file it load the old swf file.
when i load one on movieclip and remove it and load anther swf on anther movieclip the file doesn`t work and stoped.
when test my flash file to load and remove swf files without xml file it work fine but when repleaced the swf files with other work with xml files the problem hapend.
thanks;YOu should trace the names of the files that are being targeted for loading to see if they agree with what you expect. If you want help with the coding you will need to show the code that is relevant to your problem (not all of it)
-
I have a character in a game that has alot of animations
associated with him. these animations are triggered by a rollover,
and reside as seperate swf files on a server. what I want to do is
preload an animation from the server, without actualy loading it
into the movieclip. then once the rollover happens I want to play
the preloaded swf in the movieClip. I've tried using loadMovie, but
theres a few frames while the swf is loading where the movieClip is
empty. Anybody have any ideas?
Thanks,
SimonInstead of using loadMovieNum create a empty movieclip in
your main fla file. Assign a instance name to this movie clip and
use movieClipInstance.loadMovie("bigFile.swf");. You can use
MovieClipLoader class to check the progress of loaded content and
then use onLoadProgress event to set movieClipInstance._visible =
false;
Please let me know if I'm not clear and send me the FLA file
you are using. I'll make changes to the code.
Thanks & Regards
Ankur Arora
Project Leader(Flash and Flex)
http://flashdeveloper.blogspot.com
let your
thoughts fly to others... you will become rich.
Maybe you are looking for
-
I have installed PI 7.1 and will use it as central SLD. I am installing SCM 2007, ECC Oil and Gas and BI 7.0 and want to point these systems to the central SLD in PI system. During the install the WAS 7.0 system use SLDDSUSER however there is no user
-
Setting Title on Amcharts Windows QuickCharts serialChart / SerialGraph
Hello, I have an unexpected problem with SerialGraph Title text. I populate the text dynamically in codebehind. It seems that the text shown in Legend sticks to the first assigned value, and does not update. Tapping the graph shows correct content in
-
I'd like to resist buying yet more Apple Gear if possible, although fantastic and pretty much the best solution to everything about computers, because they're expensive. So I have pretty much ascertained that my PS3 isn't going to successfully stream
-
IOS 8.02 will not sync music
I have the latest version of iTunes on my MacBook Pro and iOS8.02 on my iPhone 5s, My problem is that some of the music tracks on the iPhone disappear when I try to play them - skipping to the next track and so on until it finds a track it can play!
-
Global Scheduled Services Failed in EPPM 8.3
Hi, I have been trying to configure Primavera with BI publisher. Everything works fine except for a step which requires administrator to enable the GLOBAL SCHEDULED SERVICES option and RUN either one immediately. Each time i tries to Run either one o