?
Solved

loading swf on top of another without conflict

Posted on 2006-04-20
14
Medium Priority
?
193 Views
Last Modified: 2011-10-03
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,
0
Comment
Question by:johanwilches
  • 8
  • 6
14 Comments
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 16504613
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
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 16504626
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
 

Author Comment

by:johanwilches
ID: 16507542
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 16508469
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
 

Author Comment

by:johanwilches
ID: 16509458
thank you aneesh, i sent you the email with the links for the fla's
0
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 16513203
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
 

Author Comment

by:johanwilches
ID: 16516527
aneesh i didn't get the fla/email
0
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 16517352
I have sent it again..
I hope now you would have got it

Rgds
Aneesh
0
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 16517608
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
 

Author Comment

by:johanwilches
ID: 16520914
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
 
LVL 34

Accepted Solution

by:
Aneesh Chopra earned 2000 total points
ID: 16521186
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
 

Author Comment

by:johanwilches
ID: 16522255
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
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 16522411
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
 

Author Comment

by:johanwilches
ID: 16526620
makes sense i can compare the old...dumb question...sorry :) Thank you very much aneesh for the assistance.

cheers,

Johan
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question