Solved

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

Posted on 2010-09-23
8
483 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

Question has a verified solution.

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

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…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

685 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