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

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

Guest
Apr 20, 2014 Apr 20, 2014

Copy link to clipboard

Copied

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

Views

859

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

"swf" with flash cc

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

    }

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

    }

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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 ?

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

what swf is failing to load?

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

what are the problematic swf names?

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

001.swf

002.swf

0013.swf

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

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