Solved

How to get a .swf file to run in a .fla project (Flash CS5, AS3)

Posted on 2010-09-23
8
477 Views
Last Modified: 2013-11-11
I have the wonderful joy of redesigning a website so it is 100% done in flash. I use to program in flash but I haven't touched it in years so I need to learn the basics all over again.

I created a .swf file that works perfectly (It's a slide show of a number of images).
Now I'm trying to figure out a way to include this .swf file into my .fla file.

I'm able to import it to my library and have its symbol on the flash website but when I look at the website, the .swf file/symbol does nothing. When I open up the .swf file on its own, it runs without any problems.

What do I need to do to fix this problem?
0
Comment
Question by:JohnnyBCJ
  • 5
  • 2
8 Comments
 
LVL 4

Expert Comment

by:thepanch
ID: 33747441
use the loadMovie

loadMovie('ToLoad.swf',mvTheMovie,'GET');

http://www.flashperfection.com/tutorials/How-to-use-loadMovie-function-59957.html
0
 

Author Comment

by:JohnnyBCJ
ID: 33747484
Ok, Thanks for the comment!
Give me a few minutes to try out your suggestion and I'll get back to you.
0
 

Author Comment

by:JohnnyBCJ
ID: 33747594
As much as I'm trying to figure this out, I can't.

I'm following as closely as I can but I'm clearly missing something because I can't get this to work.
0
 
LVL 8

Accepted Solution

by:
ActionScript_Helper earned 500 total points
ID: 33751268
You can load that SWF at runtime, instead of putting that into Library.

As you are writing it in AS3, so here's the AS3 code to load external SWF:

==========

var swf1:Loader = new Loader();
swf1.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
swf1.load(new URLRequest("xyz.swf")); //replace "xyz.swf" with the original swf path

function imageLoaded(evt:Event):void
{
      // replace "this" with the parent container name where would you like to add the loaded SWF
      this.addChild(evt.target.content);
}

==========
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:JohnnyBCJ
ID: 33752711
Thank you ActionScript Helper!

I followed your code and got it working but not quite 100%. Using your code I have the .swf file running in the top left corner (because I'm still using the following code...)

// replace "this" with the parent container name where would you like to add the loaded SWF
this.addChild(evt.target.content);

What are you refering to? a Movie Clip for example?
0
 

Author Comment

by:JohnnyBCJ
ID: 33752912
Better yet, this was working until I did something that I can't figure out.

Now when I run the file I get the following error:

Your content will not stream. Runtime Shared Library (RSL) preloading will require all of your content to download before the first frame will play.

To prevent this you can change the Runtime Shared Library Library Settings in the Advanced ActionScript 3.0 Settings dialog which can be raised from the PublishSettingsdialog.

The Runtime Shared Libraries being preloaded are:

textLayout_1.0.0.595.swz for TLF Text



What do I do to solve this?
0
 

Author Closing Comment

by:JohnnyBCJ
ID: 33754631
Thanks Again!
0
 
LVL 8

Expert Comment

by:ActionScript_Helper
ID: 33759490
I rarely use Flash CS5, and there are some new publishing settings for RSL in CS5 and I am not quite aware of that.. so may be will check and let you know if I find anything..
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
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.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

757 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now