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();










share|improve this question























  • 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














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();










share|improve this question























  • 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












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();










share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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
















  • 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















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

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















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






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














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





















































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







Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế