View Full Version : Loading (and Functioning) External SWFs in Flash MX 2004
AXXESS
01-12-2005, 09:29 PM
I am building another project in Flash MX 2004, this time having to load many external SWFs.
Using LoadMovie ("moviename.swf", target) works fine, EXCEPT when trying to load swfs that have _droptarget actions in them (created in SwishMax). Loaded into Flash, the swf acts like the "drag and drop" is not being dropped in the correct position. On its own, the swf works fine. Loading it into a target clip, it does not.
Loading the swf into a level using loadMovie ("moviename.swf", level) does work, but then my navigation buttons in the Flash slide presentation are covered up....
I have also tried loading nav buttons on top of the subject swf that is loaded into a level, but Flash won't let me assign actions to those buttons. I tried "pre-adding" the script to the external nav swf before loading it into a level... still not working.
Have checked out Flashkit, Kirupa, and Actionscript.org forums but didn't find anything....
AGRO, Corey, or any other Flashers have any suggestions...?
Corey
01-12-2005, 10:49 PM
Hi AXXESS. Hmmm, let's see. Sounds frustrating.
If I had to take one guess I would say it sounds like Swishmax may be referring to it's timeline as root whereas in Flash it won't work out that way unless you import the Swishmax frames directly into the Flash timeline, which is FWIW, I believe the manner in which Swish movies are imported.
So in other words the Swishmax code is probably trying to look for the drop target one level up from it's timeline in Flash. In this case that means it probably sees itself (the entire loaded movie) as the drop target no matter what. I might be wrong though.
How to fix this? Not too sure, I don't own Swishmax... I wish I could be of more help. I'm almost certain that the Swishmax support team/forum would know exactly what's going on as soon as you mention it to them. Surely you aren't the first person to experience this. Or perhaps AGRO knows something about this.
Anyhow sorry, wish I had a more tangible answer.
AXXESS
01-12-2005, 11:22 PM
Hi Corey,
Swishmax.. hmmm. The only thing I use it for is the quick swfs like the one I built and am trying to use.... its surprising that certain types of swfs can't run inside Flash... an swf should be an swf and not matter what timeline etc it is used in IMHO anyway...
Otherwise I do use Flash for everything else.... I don't really care for Swishmax anyway... I don't do any of the cheesy effects in Swishmax... I was just trying to use the original swf because I don't necessarily want to rebuild the original in Flash....
Yes, there are references to _root in the original file, I tried using MovieClip._lockroot to keep it from looking at the main timeline.... not working...
I will keep looking. Odds are I will find something eventually and post it here... just thought I would run it past my IR forum friends.... :)
Corey
01-12-2005, 11:28 PM
All you have to do probably is change those references to point into the loaded movie, so lets say you loaded in the Swishmax movie as a movie clip and named it "swish". So you now have your main Flash timeline and then your buttons, etc. plus now a loaded movie clip (under the buttons) named "swish".
Just change the references to "_root" into "_root.swish" and it should work.
If the Swishmax movie is just a single timeline you could also just change all the instances of "_root" to "_this" and that might work, but maybe not if it has internal movieclips.
AXXESS
01-12-2005, 11:59 PM
Actually I believe its the _root reference in the Swish generated file that is throwing things off. The clip loads fine, it is just not functional. I will do more digging and report back... :)
Corey
01-13-2005, 12:12 AM
Well yeah, sure it's going to load fine, it's only going to affect actions with paths not symbols, etc. All "_root" does is point to the top of the timeline hierarchy. In the Swishmax movie this is intended to be it's main timeline but when you load that movie into a Flash movie, it now becomes the timeline of the Flash movie. Know what I mean?
On other words the movie still loads and plays fine because none of that is dependent on actions. But now when you try to refer to _root you end up one level too high so the movie fails to work properly as it does when you run it standalone.
You can be sure of this by importing you Swishmax .swf directly into the frames on the main time line of a Flash movie, and then running it. now it works fine right? That's because the main Swishmax timeline and the main Flash timelines are at the same level. But if you import the Swishmax frames into a movie clip, or load it as a movie clip, the action references now point to the main Flash timeline which is one level up from the target movies, causing the _droptarget to be the entire movielip itself rather than one of the symbols within it.
Anyhow it's simple, I'm probably not explaining it well, but suffice to say that changing the references to "_root" in the Swishmax movie to "_root.mc_swishmax_name" will probably fix it.
Intrigued
01-13-2005, 12:39 AM
It does sound like the improper path is being referenced.
I ran into this soon after I started tinkering with Flash.
Maybe something like this:
_root.parentMovie_mc.childMovie_mc
Corey?
yosik
01-13-2005, 05:22 AM
Axxess,
It definitely is a bad path naming.
In SwishMax, you need to call the drop target as a relative path, not an absolute one. Do not use _root, just use _parent.
Here is a dummy example for what you want.
The zip file includes:
- The swish file
- Its swf movie
- A main Flash file (.fla)
- The main swf movie.
It works fine here.
Good luck
Yossi
Corey
01-13-2005, 07:09 AM
In this case using either "_parent" or "_root" from the Swishmax timeline will refer to the main Flash timeline into which the Swishmax movie was loaded. No difference.
But Yossi has a good point for certain scenarios, i.e. if you create a movie clip with a _droptarget action in it and you wish to be able to freely drag and drop that clip into any level timeline and have it work from there, then _parent and _this are excellent... Cool example Yossi, thanks! :)
AXXESS
01-13-2005, 08:58 AM
Hi,
Thanks for the input Yossi, however I am not attempting to load into a level (i.e..... loadMovieNum("movie.swf",1); - that already worked. I need to load the Swishmax clip into a target clip in the main Flash movie.... (i.e., loadMovie "movie.swf", targetname);
Loading into the target clip is where the the Swish generated file does not function, and yes, due to its references to _root. I have tried the following without success:
_parent
_this
_root.targetclip_name
_this.targetclip_name
When I change the reference to _this.targetclip_name, the loaded Swish movie just freezes when the dragged object is dropped.
Now where is that "bang your head against the wall" Smilie???? :)
yosik
01-13-2005, 12:02 PM
What about using a swapmovie action on the target movie, so as to put it in a defined level and THEN use the loadmovienum to load the swf from swish into that level?
I haven't got the time to play with this, but it may work.
Yossi
Intrigued
01-13-2005, 12:39 PM
How about a sample upload of the problematic file(s)?
AXXESS
01-13-2005, 12:50 PM
How about a sample upload of the problematic file(s)?
OK, here ya go. The .swi is attached. Anyone that wants to look but doesn't have Swishmax, you can download a free trial here:
Swishmax free download (http://www.swishzone.com/index.php?area=downloads&tab=downloads&product=max)
The exercise is supposed to work as follows:
1) Click to start
2) User clicks Ohms symbol ("Omega", or horseshoe shape)
3) User drags and drops red lead to red port on meter
4) User drags and drops black lead to "COM" port on meter
Remember to that it needs to be loaded into a target movie clip in Flash and still function as described.
Intrigued
01-13-2005, 01:36 PM
Here is something that may shed some light on this situation:
http://www.swishzone.com/forums/lofiversion/index.php/t4911.html ?
Intrigued
01-13-2005, 01:40 PM
Also, AXXESS I like the look of that swish file! :yes
One thing I did notice that may confuse the user of such is that to get the correct answer you have to drag the cables by the center of the round end of such and not the cable below.
A small gotcha' to check out.
But, this is really neat the way you set it up! I feel like I have the unit in my hand!
:yes
AXXESS
01-13-2005, 01:48 PM
Here is something that may shed some light on this situation:
Interesting, but I am not trying to loadMovie within Swish.... all I need to do is load the (1) Swish generated swf into a target movie clip in Flash and have it work.... :)
AXXESS
01-13-2005, 01:51 PM
One thing I did notice that may confuse the user of such is that to get the correct answer you have to drag the cables by the center of the round end of such and not the cable below.
Yeah you're right.... the user has to grab the "large end" of the meter leads (cables).
Funny you say that, because initially there were even fewer instructions, and my client brought to my attention that many of the users don't know what "drag and drop" means... so we needed to spell it out... "using your left mouse button, click and hold...." :)
I have never used swish. But from the link above I downloaded it and installed the trial. I opened your file and got this error message:
This movie has been modified so that it functions correctly.
This movie uses object names that are not allowed.
Please check your script where renamed objects are referenced.
The following objects have been renamed:
* Renamed 'try' to 'try_'
then exported it to a .swf. When exporting it says that there are errors in the movie. I clicked on continue playing.
I clicked on start, then I clicked on the ohms symbol and nothing happened. There is a button there, but after clicking on the ohms symbol nothing happens?
Intrigued
01-13-2005, 02:14 PM
I have the retail copy of SwishMAX... and I did not receive this error.
Hmmm...
AXXESS
01-13-2005, 02:22 PM
I clicked on start, then I clicked on the ohms symbol and nothing happened.
Well, the Swish file alone IS functional, and the exported swf is functional... clicking on the Ohms symbol takes you to the segment that you need to drag and drop.
Maybe they changed something in the latest download release.... Intrigued has it working.... hmmmm....
AXXESS
01-14-2005, 04:34 PM
Attached is the .swf for anyone that would like to try to load it into a target clip in Flash... :)
My ISP was down the whole time since my last post, but I am still working on this... :rolleyes
Ok, I had a bad download of the trial or something. I redownloaded the trial and it works fine by itself now. sorry.
Macromedia Flash sizes mask depths exactly to fit the layers the mask will cover. Since this SWF has not been published by MM, this SWF has two mask layers: one on layer 3 and another on layer 21. If this file would have been published with Macromedia Flash, the mask depth of layer 3 (21) would reach to layer 15 (28). The mask depths you'll find in this SWF reach both to layer 65535 , which leaves no free layer space to rearrange the mask layers.
Some 3rd party software publishes SWF's a little differently, this is one.
Unfortuanatly I would say due to the mask and the fact that I am just not familiar with swish I would recreate it in Flash if it was me, unless someone else has an idea.
Corey
01-15-2005, 05:44 PM
FWIW it couldn't hurt to make the Swish team aware that their content is not integrate-able due to this. They may not even know.
AXXESS
01-15-2005, 06:20 PM
Thanks guys for your input. I am convinced that it can't be done!
The_lockroot command is supposed to make the movie clip view its own timeline only, not the main timeline. Yet after many hours of trying different variations and possible solutions, no success.
I have found similar threads in other Flash forums and they all suggest _lockroot. I also tried changing the _root reference in the original Swish file, but then of course the swf doesn't work at all :)
The best solution is to find another way to present the content. I don't have time to rebuild it. I wanted to be able to insert this swf into a Flash MX 2004 slide presentation for the web, but I guess I may have to resort to a new browser window and getURL.
On the brighter side, I made a CD version of this presentation, and no probs! Each flash file was loaded on a separate AMS page, so there were no conflicts.
Anyway, thanks again for your input! :yes
Corey
01-15-2005, 07:04 PM
Whew, well I'm glad to hear you at least got the project out successfully. At this point I'm convinced that 40% of being a "good designer" is simply having the ability to steamroll these things.
I must admit I am rather surprised. I tried Swishmax and I didn't really like it. That may be because I'm used to Flash though. I really llike the Swish team, and the company behind the product. Great people. But the tool itself didn't really help me much. I use Swish from time to time to generate a quick title animation or two, but for the most part I wouldn't reccomend it as a tool for creating general Flash content. Nor Swishmax. Then again, I drink from the carton and put it back in the fridge. Can you really trust the opinion of such a cad?
Food for thought...
Intrigued
01-15-2005, 08:50 PM
Ok, I had a bad download of the trial or something. I redownloaded the trial and it works fine by itself now. sorry.
Macromedia Flash sizes mask depths exactly to fit the layers the mask will cover. Since this SWF has not been published by MM, this SWF has two mask layers: one on layer 3 and another on layer 21. If this file would have been published with Macromedia Flash, the mask depth of layer 3 (21) would reach to layer 15 (28). The mask depths you'll find in this SWF reach both to layer 65535 , which leaves no free layer space to rearrange the mask layers.
Some 3rd party software publishes SWF's a little differently, this is one.
Unfortuanatly I would say due to the mask and the fact that I am just not familiar with swish I would recreate it in Flash if it was me, unless someone else has an idea.
Interesting AGRO.
I learned something to watch out for myself now.
Alas, SwishMAX just sits on my H.D. now taking up space. Same as Corey... Flash it the way for me overall.
AXXESS
01-15-2005, 08:53 PM
Alas, SwishMAX just sits on my H.D. now taking up space.
start>control panel>add or remove programs...... :D
Intrigued
01-15-2005, 09:03 PM
Ha! Ha!
I was going to do that... but I did pay for it and I have plenty of room on this machine (120GB primary HD and 250 secondary HD).
So, I'll let it camp out a bit.
:lol
Corey
01-15-2005, 09:09 PM
That's the razor's edge I tell you. You let Swishmax camp out on your hard drive for a couple weeks and the next thing you know you've got Bonzi Buddy living in your poolshed. It's a slippery slope.
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.