Avoid delay in loading time when loading large external swfs into main swf
up vote
0
down vote
favorite
I have numerous large swfs that I am placing into a main swf using different buttons. I am experiencing quite a delay when the external swfs are called to load and play (because of their size). (Note: I do not experience any delay in loading the external swfs when playing the main swf locally, however when burned to a CD, the large external swfs load very slowly into the main swf each time their button is clicked.) The code I use to load the swfs:
var Lesson1_Loader:Loader;
Lesson1_Loader = new Loader();
Lesson1Numberbtn.addEventListener(MouseEvent.CLICK, playL1);
function playL1(e:Event):void
{
Lesson1_Loader.load(new URLRequest("Lesson1.swf"));
addChild(Lesson1_Loader);
}
My question: Is there a way to have the external swfs start loading themselves (but not playing) when the main swf is opened (there is an introductory animation in the main swf before any external swfs are played), so that when I click each button and addChild for each external swf, it is already loaded and will play instantly without delay?
Thank you in advance!
Update: I am using timeline code (I know not preferred). I've tried to this version:
var Lesson1_Loader:Loader;
Lesson1_Loader = new Loader();
Lesson1_Loader.load(new URLRequest("Lesson1.swf"));
Lesson1Numberbtn.addEventListener(MouseEvent.CLICK, playL1);
function playL1(e:Event):void
{
addChild(Lesson1_Loader);
}
...however then Lesson1.swf seems to play (behind the scenes) automatically at the start of main.swf (I know this because Lesson1.swf has sound on frame 1 and I hear it, however Lesson1.swf visually does not show up until I click the 'Lesson1Numberbtn' button and addChild. Lesson1.swf itself does not have "stop();" on Frame 1, so that it plays automatically when loaded. I could add stop(); to frame 1 of Lesson1.swf, but then how do I start Lesson1.swf to play from the main.swf once I addChild?
Update Again:
I have tried this code to control the playing and stopping of Lesson1.swf, but it does not work:
Lesson1_Loader.load(new URLRequest("Lesson1.swf"));
Lesson1_Loader.contentLoaderInfo.addEventListener(Event.INIT, NotYetL1 );
function NotYetL1(initEvent:Event ):void{
MovieClip(initEvent.currentTarget.content).stop();
}
actionscript-3 animate-cc
|
show 4 more comments
up vote
0
down vote
favorite
I have numerous large swfs that I am placing into a main swf using different buttons. I am experiencing quite a delay when the external swfs are called to load and play (because of their size). (Note: I do not experience any delay in loading the external swfs when playing the main swf locally, however when burned to a CD, the large external swfs load very slowly into the main swf each time their button is clicked.) The code I use to load the swfs:
var Lesson1_Loader:Loader;
Lesson1_Loader = new Loader();
Lesson1Numberbtn.addEventListener(MouseEvent.CLICK, playL1);
function playL1(e:Event):void
{
Lesson1_Loader.load(new URLRequest("Lesson1.swf"));
addChild(Lesson1_Loader);
}
My question: Is there a way to have the external swfs start loading themselves (but not playing) when the main swf is opened (there is an introductory animation in the main swf before any external swfs are played), so that when I click each button and addChild for each external swf, it is already loaded and will play instantly without delay?
Thank you in advance!
Update: I am using timeline code (I know not preferred). I've tried to this version:
var Lesson1_Loader:Loader;
Lesson1_Loader = new Loader();
Lesson1_Loader.load(new URLRequest("Lesson1.swf"));
Lesson1Numberbtn.addEventListener(MouseEvent.CLICK, playL1);
function playL1(e:Event):void
{
addChild(Lesson1_Loader);
}
...however then Lesson1.swf seems to play (behind the scenes) automatically at the start of main.swf (I know this because Lesson1.swf has sound on frame 1 and I hear it, however Lesson1.swf visually does not show up until I click the 'Lesson1Numberbtn' button and addChild. Lesson1.swf itself does not have "stop();" on Frame 1, so that it plays automatically when loaded. I could add stop(); to frame 1 of Lesson1.swf, but then how do I start Lesson1.swf to play from the main.swf once I addChild?
Update Again:
I have tried this code to control the playing and stopping of Lesson1.swf, but it does not work:
Lesson1_Loader.load(new URLRequest("Lesson1.swf"));
Lesson1_Loader.contentLoaderInfo.addEventListener(Event.INIT, NotYetL1 );
function NotYetL1(initEvent:Event ):void{
MovieClip(initEvent.currentTarget.content).stop();
}
actionscript-3 animate-cc
Should be simple enough. Are you using classes or using timeline code? Either way, you would need to find a way to execute the loading code (inside your current methodplayL1
) at the start of main.swf and not inside the click event handler of the button.
– Gurtej Singh
Nov 8 at 22:45
@Gurtej Singh please see update above. (The comment section said it was too many words for a comment.)
– Shana B
Nov 9 at 0:34
No worries! I found another thread that will help you as to how to stop and play the SWF based on your needs. Have a look here: stackoverflow.com/questions/2365695/as3-stop-external-swf
– Gurtej Singh
Nov 9 at 0:44
I tried this but it does not stop Lesson1.swf from playing:
– Shana B
Nov 9 at 1:00
Lesson1_Loader.load(new URLRequest("Lesson1.swf")); Lesson1_Loader.contentLoaderInfo.addEventListener(Event.INIT, NotYetL1 ); function NotYetL1(initEvent:Event ):void{ MovieClip(initEvent.currentTarget.content).stop(); }
– Shana B
Nov 9 at 1:00
|
show 4 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have numerous large swfs that I am placing into a main swf using different buttons. I am experiencing quite a delay when the external swfs are called to load and play (because of their size). (Note: I do not experience any delay in loading the external swfs when playing the main swf locally, however when burned to a CD, the large external swfs load very slowly into the main swf each time their button is clicked.) The code I use to load the swfs:
var Lesson1_Loader:Loader;
Lesson1_Loader = new Loader();
Lesson1Numberbtn.addEventListener(MouseEvent.CLICK, playL1);
function playL1(e:Event):void
{
Lesson1_Loader.load(new URLRequest("Lesson1.swf"));
addChild(Lesson1_Loader);
}
My question: Is there a way to have the external swfs start loading themselves (but not playing) when the main swf is opened (there is an introductory animation in the main swf before any external swfs are played), so that when I click each button and addChild for each external swf, it is already loaded and will play instantly without delay?
Thank you in advance!
Update: I am using timeline code (I know not preferred). I've tried to this version:
var Lesson1_Loader:Loader;
Lesson1_Loader = new Loader();
Lesson1_Loader.load(new URLRequest("Lesson1.swf"));
Lesson1Numberbtn.addEventListener(MouseEvent.CLICK, playL1);
function playL1(e:Event):void
{
addChild(Lesson1_Loader);
}
...however then Lesson1.swf seems to play (behind the scenes) automatically at the start of main.swf (I know this because Lesson1.swf has sound on frame 1 and I hear it, however Lesson1.swf visually does not show up until I click the 'Lesson1Numberbtn' button and addChild. Lesson1.swf itself does not have "stop();" on Frame 1, so that it plays automatically when loaded. I could add stop(); to frame 1 of Lesson1.swf, but then how do I start Lesson1.swf to play from the main.swf once I addChild?
Update Again:
I have tried this code to control the playing and stopping of Lesson1.swf, but it does not work:
Lesson1_Loader.load(new URLRequest("Lesson1.swf"));
Lesson1_Loader.contentLoaderInfo.addEventListener(Event.INIT, NotYetL1 );
function NotYetL1(initEvent:Event ):void{
MovieClip(initEvent.currentTarget.content).stop();
}
actionscript-3 animate-cc
I have numerous large swfs that I am placing into a main swf using different buttons. I am experiencing quite a delay when the external swfs are called to load and play (because of their size). (Note: I do not experience any delay in loading the external swfs when playing the main swf locally, however when burned to a CD, the large external swfs load very slowly into the main swf each time their button is clicked.) The code I use to load the swfs:
var Lesson1_Loader:Loader;
Lesson1_Loader = new Loader();
Lesson1Numberbtn.addEventListener(MouseEvent.CLICK, playL1);
function playL1(e:Event):void
{
Lesson1_Loader.load(new URLRequest("Lesson1.swf"));
addChild(Lesson1_Loader);
}
My question: Is there a way to have the external swfs start loading themselves (but not playing) when the main swf is opened (there is an introductory animation in the main swf before any external swfs are played), so that when I click each button and addChild for each external swf, it is already loaded and will play instantly without delay?
Thank you in advance!
Update: I am using timeline code (I know not preferred). I've tried to this version:
var Lesson1_Loader:Loader;
Lesson1_Loader = new Loader();
Lesson1_Loader.load(new URLRequest("Lesson1.swf"));
Lesson1Numberbtn.addEventListener(MouseEvent.CLICK, playL1);
function playL1(e:Event):void
{
addChild(Lesson1_Loader);
}
...however then Lesson1.swf seems to play (behind the scenes) automatically at the start of main.swf (I know this because Lesson1.swf has sound on frame 1 and I hear it, however Lesson1.swf visually does not show up until I click the 'Lesson1Numberbtn' button and addChild. Lesson1.swf itself does not have "stop();" on Frame 1, so that it plays automatically when loaded. I could add stop(); to frame 1 of Lesson1.swf, but then how do I start Lesson1.swf to play from the main.swf once I addChild?
Update Again:
I have tried this code to control the playing and stopping of Lesson1.swf, but it does not work:
Lesson1_Loader.load(new URLRequest("Lesson1.swf"));
Lesson1_Loader.contentLoaderInfo.addEventListener(Event.INIT, NotYetL1 );
function NotYetL1(initEvent:Event ):void{
MovieClip(initEvent.currentTarget.content).stop();
}
actionscript-3 animate-cc
actionscript-3 animate-cc
edited Nov 9 at 1:02
asked Nov 8 at 22:14
Shana B
12
12
Should be simple enough. Are you using classes or using timeline code? Either way, you would need to find a way to execute the loading code (inside your current methodplayL1
) at the start of main.swf and not inside the click event handler of the button.
– Gurtej Singh
Nov 8 at 22:45
@Gurtej Singh please see update above. (The comment section said it was too many words for a comment.)
– Shana B
Nov 9 at 0:34
No worries! I found another thread that will help you as to how to stop and play the SWF based on your needs. Have a look here: stackoverflow.com/questions/2365695/as3-stop-external-swf
– Gurtej Singh
Nov 9 at 0:44
I tried this but it does not stop Lesson1.swf from playing:
– Shana B
Nov 9 at 1:00
Lesson1_Loader.load(new URLRequest("Lesson1.swf")); Lesson1_Loader.contentLoaderInfo.addEventListener(Event.INIT, NotYetL1 ); function NotYetL1(initEvent:Event ):void{ MovieClip(initEvent.currentTarget.content).stop(); }
– Shana B
Nov 9 at 1:00
|
show 4 more comments
Should be simple enough. Are you using classes or using timeline code? Either way, you would need to find a way to execute the loading code (inside your current methodplayL1
) at the start of main.swf and not inside the click event handler of the button.
– Gurtej Singh
Nov 8 at 22:45
@Gurtej Singh please see update above. (The comment section said it was too many words for a comment.)
– Shana B
Nov 9 at 0:34
No worries! I found another thread that will help you as to how to stop and play the SWF based on your needs. Have a look here: stackoverflow.com/questions/2365695/as3-stop-external-swf
– Gurtej Singh
Nov 9 at 0:44
I tried this but it does not stop Lesson1.swf from playing:
– Shana B
Nov 9 at 1:00
Lesson1_Loader.load(new URLRequest("Lesson1.swf")); Lesson1_Loader.contentLoaderInfo.addEventListener(Event.INIT, NotYetL1 ); function NotYetL1(initEvent:Event ):void{ MovieClip(initEvent.currentTarget.content).stop(); }
– Shana B
Nov 9 at 1:00
Should be simple enough. Are you using classes or using timeline code? Either way, you would need to find a way to execute the loading code (inside your current method
playL1
) at the start of main.swf and not inside the click event handler of the button.– Gurtej Singh
Nov 8 at 22:45
Should be simple enough. Are you using classes or using timeline code? Either way, you would need to find a way to execute the loading code (inside your current method
playL1
) at the start of main.swf and not inside the click event handler of the button.– Gurtej Singh
Nov 8 at 22:45
@Gurtej Singh please see update above. (The comment section said it was too many words for a comment.)
– Shana B
Nov 9 at 0:34
@Gurtej Singh please see update above. (The comment section said it was too many words for a comment.)
– Shana B
Nov 9 at 0:34
No worries! I found another thread that will help you as to how to stop and play the SWF based on your needs. Have a look here: stackoverflow.com/questions/2365695/as3-stop-external-swf
– Gurtej Singh
Nov 9 at 0:44
No worries! I found another thread that will help you as to how to stop and play the SWF based on your needs. Have a look here: stackoverflow.com/questions/2365695/as3-stop-external-swf
– Gurtej Singh
Nov 9 at 0:44
I tried this but it does not stop Lesson1.swf from playing:
– Shana B
Nov 9 at 1:00
I tried this but it does not stop Lesson1.swf from playing:
– Shana B
Nov 9 at 1:00
Lesson1_Loader.load(new URLRequest("Lesson1.swf")); Lesson1_Loader.contentLoaderInfo.addEventListener(Event.INIT, NotYetL1 ); function NotYetL1(initEvent:Event ):void{ MovieClip(initEvent.currentTarget.content).stop(); }
– Shana B
Nov 9 at 1:00
Lesson1_Loader.load(new URLRequest("Lesson1.swf")); Lesson1_Loader.contentLoaderInfo.addEventListener(Event.INIT, NotYetL1 ); function NotYetL1(initEvent:Event ):void{ MovieClip(initEvent.currentTarget.content).stop(); }
– Shana B
Nov 9 at 1:00
|
show 4 more comments
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53216970%2favoid-delay-in-loading-time-when-loading-large-external-swfs-into-main-swf%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Should be simple enough. Are you using classes or using timeline code? Either way, you would need to find a way to execute the loading code (inside your current method
playL1
) at the start of main.swf and not inside the click event handler of the button.– Gurtej Singh
Nov 8 at 22:45
@Gurtej Singh please see update above. (The comment section said it was too many words for a comment.)
– Shana B
Nov 9 at 0:34
No worries! I found another thread that will help you as to how to stop and play the SWF based on your needs. Have a look here: stackoverflow.com/questions/2365695/as3-stop-external-swf
– Gurtej Singh
Nov 9 at 0:44
I tried this but it does not stop Lesson1.swf from playing:
– Shana B
Nov 9 at 1:00
Lesson1_Loader.load(new URLRequest("Lesson1.swf")); Lesson1_Loader.contentLoaderInfo.addEventListener(Event.INIT, NotYetL1 ); function NotYetL1(initEvent:Event ):void{ MovieClip(initEvent.currentTarget.content).stop(); }
– Shana B
Nov 9 at 1:00