Avatar of britishknight
britishknightFlag for Germany

asked on 

Is there no REAL solution for this problem?

Hello,

I read the related question and I have the exact same problem. And I just cannot believe there is no way around.
I want to build a flash application that loads other swf-contents that are all structured the same way and load information from the same named subfolders and files. So there is no other way than to move them into folders.

My file system looks like this:

main.swf
content1-folder
      content.swf
      swf-folder
            some swf-files
      xml-folder
            config.xml
content2-folder
      content.swf
      swf-folder
            some swf-files
      xml-folder
            config.xml

Since every content expects to find its related files in the same subfolders with same names there is no renaming them. And since I dont have the sources of the content I cannot recompile them.
Is there no way for the main.swf to recognize what the loaded swf-file is loading and to correct that path?

And if there is really absolutely no way I just want to understand why. Because in my eyes it makes absolutely no sense.

Please Help!

Adobe Flash

Avatar of undefined
Last Comment
britishknight
Avatar of tomaugerdotcom
tomaugerdotcom
Flag of Canada image

Sorry, I'm having trouble understanding what your Main.swf application is trying to do?

You've got this main.swf app that loads up content1-folder/content.swf and, then maybe later on, loads content2-folder/content.swf, right?

And then content.swf will load a bunch of other swf-files.swf from swf-folder, and maybe some xml data from xml-folder.

Am I getting it right here?

So far, I don't see a problem, unless you're trying to load these files from someone's local hard drive rather than the webserver. Then there's a security issue and you can't do anything but save the SWF as an exe (projector). But I don't think that's what you're trying to do.

So I don't understand what you mean about the main.swf recognizing what the loaded swf-file is loading and "tor correct that path"?

Can you provide some detailed description please?
Avatar of britishknight
britishknight
Flag of Germany image

ASKER

You got it right. But the problem is:

Normally the example content1/content.swf would refer to a swf-file like swf/file.swf. When loaded into another flash movie (in my case the main.swf) that relative path changes into content1/swf/file.swf. Thus the content.swf doesnt find any files its trying to load, because the logical path to the files has changed, although physical relations stay the same. Thats due to the known issue, that when a swf (A) is loaded into another swf (B), everything swf A sees is relative to the physical position of swf B and NOT to the original position of swf A in the filesystem.

The main application will be compiled as a Windows-EXE and OS X Application an will reside on the root-level of a dvd. It provides a menu to select language and content. The content is provided by the customer who doesnt have the source codes.

Did it become clear? Thanks for your Help!
ASKER CERTIFIED SOLUTION
Avatar of tomaugerdotcom
tomaugerdotcom
Flag of Canada image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
SOLUTION
Avatar of Zeffer
Zeffer
Flag of New Zealand image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of britishknight
britishknight
Flag of Germany image

ASKER

Thanks for your help Tom!

I wonder if  the scenario (trying to load external swf-files from a subdirectory that also load external data from subdirectories) is that uncommon. I now understand that in many cases it makes sense that loaded swf-files share the same context with the loader-swf-file, but I miss some kind of switch to manipulate this behavior.

Now I know its true, but still I dont want to believe it. To me that behavior is somehow inconsistent and absolutely not object oriented.

Executing the external files or replacing the root-level is no solution for me. Im trying to build some kind of state of the art presentation, having a navigation (which should be visible at all time) and different slides containing all kinds of media (images, movies and interactive flash-content). Most of the content is already existing in some way (online flash content, product-movies on dvds etc.).  The presentation is about to be a give-away to consumers on the IFA 2008 in Berlin. So the customer wants a nice and shiny little presentation without popups or stuff.

Maybe Ill suggest rebuilding the flash-content or to abandon it :-(

Try the two suggestions I mentioned and see if either of them get you any closer. It's too bad you can't over-ride the swf loading functions and use your own to then load the content directly from their subdirectories.

Keep us posted on your success.

Tom
Avatar of britishknight
britishknight
Flag of Germany image

ASKER

Hey there,

it's me again. Finally the customer decided to rebuild the content I want to load in my application. Now it works when loaded from a subdirectory& BUT:
Only one content works at a time. When I load the first content, it works fine. So does the second content. But when I load the first content, unload it, and then load the second& its still not working the way it should.

Before posting lots of AS3 code, I decided to bundle a test case, which you can download and test for yourself. www.itao.de/downloads/testcase.zip (28 MB)

Feel free to change what you need to. I appreciate any answer leading to the solution.

Thanks to all of you
Björn

I was concerned that this might occur. When you load the SWF into the root, I suppose it's completely replacing the root. We need to figure out a way to re-load the root once the loaded SWF is complete.
Avatar of britishknight
britishknight
Flag of Germany image

ASKER

Sorry to ask this, but have you looked inside the test case?
I don't  replace the root element. I use the as3 loader class to load the external swf-file. (As said, the external swf-file was rebuild facing the subfolder-problem.)

Now I do something like:

      var loader:Loader = new Loader();
      loader.load(filename1);
      loader.unload();
      loader.load(filename2);

The first file is loaded, the second isn't. Trying:

      var loader:Loader = new Loader();
      loader.load(filename2);
      loader.unload();
      loader.load(filename1);

The file "filename2" is loaded, but "filename1" isn't.
Even using a second loader for the second file will not work:

      var loader1:Loader = new Loader();
      loader1.load(filename1);
      loader1.unload();
      var loader2:Loader = new Loader();
      loader2.load(filename2);

Avatar of britishknight
britishknight
Flag of Germany image

ASKER

... or let's say the files are loaded (you can see it because the embedded preloader is visible), but the file I load in second place doesn't work, although it works when I load it first.
Try out the test case... youll see.

Avatar of britishknight
britishknight
Flag of Germany image

ASKER

Thanks for your help, but there is still no solution to load the external content to my flash application the way I need it. I'm going to split the application in "menu" and "content" (and maybe some other parts that might be needed) and put it into a html-container. That way (and I've already testet it) the content will work.
Avatar of britishknight
britishknight
Flag of Germany image

ASKER

I've closed the question because it's possible to load the external swf file into the main context, replacing it. That way you loose control and the ability to go back to the main application, especially when you don't have access to the fla-file of the swf-files you want to load.
The only working solution I see at this moment is to split the application into menu and content surrounding it with an html-container. Nested in an html-website the content is working correctly.

Adobe Flash
Adobe Flash

Adobe Flash (formerly Macromedia Flash) is a cross-platform multimedia and software platform used to embed animations, video, and interactive applications into web pages and desktop and mobile applications and games. Flash displays text, vector and raster graphics to provide animations, video games and applications. It allows streaming of audio and video, and can capture mouse, keyboard, microphone and camera input. The ActionScript programming language allows creation of interactive animations, video games, web applications, desktop applications and mobile applications.

29K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo