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

Preview Mode is OK but some of external swf not loaded in Published file

Guest
Apr 20, 2014 Apr 20, 2014

I have a wierd problem. everything is ok in Preview Mode but when I Publish the file external swf will not load in main swf.

I didnt change the location of main file and swf file are locally available. SO i have no idea what is the problem.

Is it related to AS3 setting or something ?

TOPICS
ActionScript
919
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 ,
Apr 20, 2014 Apr 20, 2014

what are you publishing?  web-based, ios, android, air, projector app?

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
Guest
Apr 21, 2014 Apr 21, 2014

"swf" with flash cc

it is not a network project  just locally will be used . and "access local files" is chosen..

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 ,
Apr 21, 2014 Apr 21, 2014

what's the code in the main swf used to load?

what's the location (relative to the main swf) of the loaded swf?

is there any code that would cause the loaded swf to be unloaded or no longer seen?

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
Guest
Apr 22, 2014 Apr 22, 2014

// loading external swf

// We'll store our buttons in an array to make it easier to register for events.

var btns:Array = [

    btn_octapus,

    btn_shark,

    btn_dolphin

]

// Now cycle over them in bind to our listener

for each (var btn:MovieClip in btns) {

    btn.addEventListener("mouseUp", btnEvents);

}

function btnEvents(e:MouseEvent):void {

    // With one event listener, we can sort out each condition

    switch (e.currentTarget.name) {

        case "btn_octapus":

            loadGame("001.swf")

            break;

        case "btn_shark":

            loadGame("002.swf")

            break;

        case "btn_dolphin":

            loadGame("0013.swf")

            break;

    }

}

function loadGame(url:String):void {

    // Now we only have to write our loader code once (for all buttons)

    trace("Loading " + url);

    // Because we're unloading our swfs (and unloaded assets get garbage collected),

    // we'll want to make a new loader each time we call a load op

    var loader:Loader = new Loader();

    loader.name = "current_game";

    loader.load(new URLRequest(url));

    addChild(loader);

loader.x=100;

loader.y=100;

    }

I just added external swf to main folder for test..

It works for preview in flash correctly but after Publishing, No external swf will be loaded.

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 ,
Apr 22, 2014 Apr 22, 2014

that's problematic if you intend to reference any loaders and you failed to answer the 2nd and 3rd questions.

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
Guest
Apr 22, 2014 Apr 22, 2014

2nd Question:In the main folder where the FLA file is.

3rd Question : No

In Preview Mode it works fine  but only when I publish the fla I have problem with that...

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 ,
Apr 22, 2014 Apr 22, 2014

no?  then why do you have this comment

    // Because we're unloading our swfs (and unloaded assets get garbage collected),

and why are you using different loaders and why are you making them local to loadGame?

unless you have reasons for the above and know what you're doing, change your loadGame code to:

var loader:Loader=new Loader();

    addChild(loader);

loader.x=100;

loader.y=100;

function loadGame(url:String):void {

    // Now we only have to write our loader code once (for all buttons)

    trace("Loading " + url);

    loader.load(new URLRequest(url));

    }

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
Guest
Apr 22, 2014 Apr 22, 2014

I want to use 1 loader for all external swf. there are 13 swf that i want to load. there is 13 button for every swf.

and I want when one external swf are loaded , others should be unloaded(to reduce memory use and cpu&...)

So whats your suggestion ?

we have 13 btn and 13 swf .

buttons named differently

btn_octapus

btn_shark

....

but swf are in sequence of 001.swf to 0013.swf

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 ,
Apr 22, 2014 Apr 22, 2014

then use the code i suggested in message 7.

though, if there are open streams (video/sound etc) in a loaded swf, use:

var loader:Loader=new Loader();

    addChild(loader);

loader.x=100;

loader.y=100;

function loadGame(url:String):void {

if(loader.content){

loader.unloadAndStop();

}

    loader.load(new URLRequest(url));

    }

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
Guest
Apr 22, 2014 Apr 22, 2014

thank you.

but still I have Problem with the external swf...

By the way , Is there any protected swf ?

you know , I create slideshow with program named "UltraSlideshow" and I can not load them.Can it be the problem or not ?

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 ,
Apr 22, 2014 Apr 22, 2014

what swf is failing to load?

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
Guest
Apr 24, 2014 Apr 24, 2014

swfs that I created as an slide show ... they are not loading in main SWF. but in preview mode they load but not in Published. .

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 ,
Apr 24, 2014 Apr 24, 2014

what are the problematic swf names?

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
Guest
Apr 27, 2014 Apr 27, 2014

001.swf

002.swf

0013.swf

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 ,
Apr 28, 2014 Apr 28, 2014

what's the url to your main swf's embedding html?

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
Guest
May 01, 2014 May 01, 2014
LATEST

it is a local project and I need to make a .exe or at least swf. not html version...

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