Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

loading swf file into an existing flash file - script for waiting it to play until it's fully loaded

New Here ,
Feb 06, 2010 Feb 06, 2010

I have a flash file that is 1.5mb in size. As it takes about 6 minutes for someone on dialup to load this file, I have created a smaller swf file and loaded the larger one from it but I don't want the larger one to begin to play until it's fully downloaded. How do I set this up? I have set up the action script 2 as follows: loadMovieNum("top2.swf", 0);

TOPICS
ActionScript
711
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Feb 06, 2010 Feb 06, 2010

yes, that should be addListener instead of addEventListener.

and, if you used that code, please mark this thread as answered.  if you used different coding, please post your code for others and mark this thread as answered.

Translate
Community Expert ,
Feb 06, 2010 Feb 06, 2010

that won't work (as you probably now know).

insert an empty keyframe at frame1 of your loaded swf and attach a stop() to that frame.

then load that swf into your preloader using any target movieclip (or _level other than 0).  when loading is complete execute a target.play().

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 06, 2010 Feb 06, 2010

Thank you for the help but can you be more specific please in the action script that I am to use for this part:

then load that swf into your preloader using any target movieclip (or _level other than 0).  when loading is complete execute a target.play().?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 06, 2010 Feb 06, 2010

you can use:

var mcl:MovieClipLoader=new MovieClipLoader();

var lo:Object={};

lo.onLoadInit=function(target:MovieClip){

target.play();

// remove any preloader display you have on-stage

}

mcl.addEventListener(lo);

this.createEmptyMovieClip("targetMC",0);

mcl.loadClip("yourlargeswf.swf",targetMC);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 06, 2010 Feb 06, 2010

This doesn't work. There is an error in the code:

There is no method with the name 'addEventListener',

source mcl.addEventListener(lo);

This is what I used:

var mcl:MovieClipLoader=new MovieClipLoader();
var lo:Object={};
lo.onLoadInit=function(target:MovieClip){
target.play();
// remove any preloader display you have on-stage
}
mcl.addEventListener(lo);
this.createEmptyMovieClip("targetMC",0);
mcl.loadClip("top2.swf",targetMC);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 06, 2010 Feb 06, 2010

I figured it out - not so complicated.. Thanks for you help anyway.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 06, 2010 Feb 06, 2010

yes, that should be addListener instead of addEventListener.

and, if you used that code, please mark this thread as answered.  if you used different coding, please post your code for others and mark this thread as answered.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 08, 2010 Feb 08, 2010
LATEST

This is how I eventually did this:

Created 2 layers.

Layer 1 has my existing image which I put a stop action to in the 1st frame.

Layer 2 has a link to the external swf file with this action: loadMovieNum("top2.swf", 2); in the 1st frame.

So the initial image stays up until the top2.swf is fully loaded. This is for people with dialup. A lot of the clients who will look at this particular web site are rural and only have dialup access to the internet. The animation loads quickly for high speed.

Here's the web site if you wish to view the result.

http://www.watertonbiosphere.com

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines