loading swf on top of another without conflict

I have a complete site on flash (main.swf) with xml....I am trying to load another swf (gallery.swf) with xml as well but it doesn't load at all...it looks like when the gallery.swf loads..it takes over the main.swf and conflicts with it.  Are there some ways to load the external swf totally isolated from whatever swfs are running?....ive tried calling the swf in 2 ways...:

var tmp:MovieClip = _root.createEmptyMovieClip("clip_instance", getNextHighestDepth());
tmp.loadMovie("gallery.swf");

and

_root.createEmptyMovieClip ("mc_loader", _root.getNextHighestDepth ());
        _root.mc_loader.loadMovie ("gallery.swf");



thanks,
johanwilchesAsked:
Who is Participating?
 
Aneesh ChopraCommented:
If you are using following line of code to create a holder movie for gallery.swf
-------
var tmp:MovieClip = _root.createEmptyMovieClip("clip_instance", getNextHighestDepth());
------

then abviously, "clip_instance" will become the top level movie, and I assume that you are loading the gallery.swf in "clip_instance"

because here, you have choosen the depth , "getNextHighestDepth"

try assigning depth manually,
for example: try using following like of code:
--------
var tmp:MovieClip = _root.createEmptyMovieClip("clip_instance", -3333);
tmp.loadMovie("gallery.swf");
---------

Rgds
Aneesh
0
 
Aneesh ChopraCommented:
Both are perfect method to load an external swf to a new empty movie on root..

I hope "main.swf" should be there but "gallery.swf" might hide it behind "gallery.swf"...

you try this by using the following code..
----------
var tmp:MovieClip = _root.createEmptyMovieClip("clip_instance", getNextHighestDepth());
tmp._x=300;
tmp._y=300;
tmp.loadMovie("gallery.swf");
----------

Rgds
Aneesh
0
 
Aneesh ChopraCommented:
another problem might be:

you may have used obsolute references in "gallery.swf" which is conflicting when you load the "gallery.swf" in "main.swf"

for example: if you have used "_root" in "gallery.swf" then it might be creating problem..

because as "gallery.swf" loads in a "clip_instance" movieClip, its relative root  should be "clip_instance" not the actual "_root"


to avoid such situation, you should code using "relative" references,
for example: "this", "_parent"


I hope it would be clear.

Rgds
Aneesh
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
johanwilchesAuthor Commented:
I had an idea about the conflict with when calling with _root and _parent......I wasn't sure how the code would go though, I tried:

this.parent.createEmptyMovieClip("my_mc", 999);
loadMovie("newmovie.swf", logo_mc);  

and nothing loads.....since the swf it loads in a "clip instance" movieclip.....is it possible to call this swf just by itself completly isolated from other swfs? I did try to load it the simple way..."loadmovie" but still conflicts with the code from the main swf.  Maybe there is a way to have 2 swfs one on top of each other completely separated....like having 2 html pages in frames...they both work in the same page but each one is isolated...is it possible ?
0
 
Aneesh ChopraCommented:
try to understand that you need to update the reference in newmovie.swf not in main.swf.....

if possible can you upload the both FLA so that I can have a closer look and provide you the solution
or mail it.

email is in profile

Rgds
Aneesh
0
 
johanwilchesAuthor Commented:
thank you aneesh, i sent you the email with the links for the fla's
0
 
Aneesh ChopraCommented:
Hi,

thanks for the source file, issue was the same as i mentioned in gallery.fla "_root" have been used in 72 times in different movies
I have created a global variable in root with relative reference to root. and replace all _root (absolute) reference with the relative reference.
sent the FLA to you mail already.

I feel that I have fixed the issue but I cannot test it properly because the xml files and other resources were not available.

Rgds
Aneesh
0
 
johanwilchesAuthor Commented:
aneesh i didn't get the fla/email
0
 
Aneesh ChopraCommented:
I have sent it again..
I hope now you would have got it

Rgds
Aneesh
0
 
Aneesh ChopraCommented:
Finally I have uploaded it and You can download it here.

download link:
http://s64.yousendit.com/d.aspx?id=0YL2P0BKXUPGB0TJ2U72E86ZWG

I have tried twice but both time, delivery gets failed.
---------
Delivery to the following recipients failed.

      absolute<AT>absolute-studios.com


Final-Recipient: rfc822;absolute<AT>absolute-studios.com
Action: failed
Status: 5.5.0
Diagnostic-Code: smtp;550-"The recipient cannot be verified.  Please check all recipients of this
550 message to verify they are valid."
---------
0
 
johanwilchesAuthor Commented:
sorry about the mail trouble aneesh....the server went down for a few hours.....it does work...although it comes up on top of the main movie...which had some orange rectangles..so for exmaple lets say if the main movie had a menu...when gallery comes up..then the menu would dissappear....and for the publishing settings i have it as transparent windowless so it could work...but it takes over the main movie.  
0
 
johanwilchesAuthor Commented:
works wonderuflly....sorry to bother once again....last question....how did u make gallery.swf work/load successfully? so i could use this code for future references/projects because im staring using lot of xml in the swfs and be always confronting this type of issues...how/where would i put this code?  thank you aneesh...
0
 
Aneesh ChopraCommented:
I just changes all absolute references of _root to relative....

Secondly I can't pin point each code, as there were total 72 code replacements,
but abviously, you can compare ur old actionscript with new one.

Rgds
Aneesh
0
 
johanwilchesAuthor Commented:
makes sense i can compare the old...dumb question...sorry :) Thank you very much aneesh for the assistance.

cheers,

Johan
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.