Embedding external swf file flash.
Hi,
I have 1 swf file which generated through 3rd party tool.
Now I want to embed this file into empty flash file and want to save as new, I tried with following options,
1) import option ( File > Import ) but it is importing only Images and symbols. I want my original file as it in new file.
2) loader.load(), but this will load my external file at runtime only and to work smoothly it require both the files.
I want same but in design time, so I can add some extra functionality to it.
Is it possible to embed external swf file as it is in new flash file in CS4?
Thanks in advance.
Ganesh
When you import swf files into fla files they lose all actionscript/functionality. The only way to add it to the new file is to copy the timeline of the file into the new file. Since you probably do not have a file where you could copy this from, then your only options are to load the file during runtime, or take what the import gives you as far as parts go, and design in the functionality yourself.
Similar Messages
-
I can't seem to remove / unload the external swf files e.g when the carousel.swf (portfolio) is displayed and I press the about button the about content is overlapping the carousel (portfolio) . How can I remove / unload an external swf file from the main flash file and load a new swf file, while at the same time removing garbage collection from memory?
This is the error message(s) I am receiving: "TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/removeChild()
at index_fla::MainTimeline/Down3()"
import nl.demonsters.debugger.MonsterDebugger;
var d:MonsterDebugger=new MonsterDebugger(this);
stage.scaleMode=StageScaleMode.NO_SCALE;
stage.align=StageAlign.TOP_LEFT;
stage.addEventListener(Event.RESIZE, resizeHandler);
// loader is the loader for portfolio page swf
var loader:Loader;
var loader2:Loader;
var loader3:Loader;
var loader1:Loader;
// resize content
function resizeHandler(event:Event):void {
// resizes portfolio page to center
loader.x = (stage.stageWidth - loader.width) * .5;
loader.y = (stage.stageHeight - loader.height) * .5;
// resizes about page to center
loader3.x = (stage.stageWidth - 482) * .5 - 260;
loader3.y = (stage.stageHeight - 492) * .5 - 140;
/*loader2.x = (stage.stageWidth - 658.65) * .5;
loader2.y = (stage.stageHeight - 551.45) * .5;*/
addEventListener(Event.ENTER_FRAME, onEnterFrame,false, 0, true);
function onEnterFrame(ev:Event):void {
var requesterb:URLRequest=new URLRequest("carouselLoader.swf");
loader = null;
loader = new Loader();
loader.name ="carousel1"
//adds gallery.swf to stage at begining of movie
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
function ioError(event:IOErrorEvent):void {
trace(event);
try {
loader.load(requesterb);
} catch (error:SecurityError) {
trace(error);
addChild(loader);
loader.x = (stage.stageWidth - 739) * .5;
loader.y = (stage.stageHeight - 500) * .5;
// stop gallery.swf from duplication over and over again on enter frame
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
//PORTFOLIO BUTTON
//adds eventlistner so that gallery.swf can be loaded
MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
function Down(event:MouseEvent):void {
// re adds listener for contact.swf and about.swf
MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
//unloads gallery.swf from enter frame if users presses portfolio button in nav
var requester:URLRequest=new URLRequest("carouselLoader.swf");
loader = null;
loader = new Loader();
loader.name ="carousel"
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
function ioError(event:IOErrorEvent):void {
trace(event);
try {
loader.load(requester);
} catch (error:SecurityError) {
trace(error);
addChild(loader);
loader.x = (stage.stageWidth - 739) * .5;
loader.y = (stage.stageHeight - 500) * .5;
removeChild( getChildByName("about") );
removeChild( getChildByName("carousel1") );
// remove eventlistner and prevents duplication of gallery.swf
MovieClip(root).nav.portfolio.removeEventListener(MouseEvent.MOUSE_DOWN, Down);
//INFORMATION BUTTON
//adds eventlistner so that info.swf can be loaded
MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
function Down1(event:MouseEvent):void {
//this re-adds the EventListener for portfolio so that end user can view again if they wish.
MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
var requester:URLRequest=new URLRequest("contactLoader.swf");
loader2 = null;
loader2 = new Loader();
loader2.name ="contact"
loader2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
function ioError(event:IOErrorEvent):void {
trace(event);
try {
loader2.load(requester);
} catch (error:SecurityError) {
trace(error);
addChild(loader2);
loader2.x = (stage.stageWidth - 658.65) * .5;
loader2.y = (stage.stageHeight - 551.45) * .5;
// remove eventlistner and prevents duplication of info.swf
MovieClip(root).nav.info.removeEventListener(MouseEvent.MOUSE_DOWN, Down1);
//ABOUT BUTTON
//adds eventlistner so that info.swf can be loaded
MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
function Down3(event:MouseEvent):void {
//this re-adds the EventListener for portfolio so that end user can view again if they wish.
MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
var requester:URLRequest=new URLRequest("aboutLoader.swf");
loader3 = null;
loader3 = new Loader();
loader3.name ="about"
loader3.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
function ioError(event:IOErrorEvent):void {
trace(event);
try {
loader3.load(requester);
} catch (error:SecurityError) {
trace(error);
addChild(loader3);
loader3.x = (stage.stageWidth - 482) * .5 - 260;
loader3.y = (stage.stageHeight - 492) * .5 - 140;
removeChild( getChildByName("carousel") );
removeChild( getChildByName("carousel1") );
// remove eventlistner and prevents duplication of info.swf
MovieClip(root).nav.about.removeEventListener(MouseEvent.MOUSE_DOWN, Down3);
stop();Andrei1,
Thank you for the helpful advice. I made the changes as you suggested but I am receiving a #1009 error message even though my site is working the way I wan it to work. I would still like to fix the errors so that my site runs and error free. This is the error I am receiving:
"TypeError: Error #1009: Cannot access a property or method of a null object reference."
I'm sure this is not the best method to unload loaders and I am guessing this is why I am receiving the following error message.
loader.unload();
loader2.unload();
loader3.unload();
I also tried creating a function to unload the loader but received the same error message and my portfolio swf was not showing at all.
function killLoad():void{
try { loader.close(); loader2.close; loader3.close;} catch (e:*) {}
loader.unload(); loader2.unload(); loader3.unload();
I have a question regarding suggestion you made to set Mouse Event to "null". What does this do setting the MouseEvent do exactly? Also, since I've set the MouseEvent to null do I also have to set the loader to null? e.g.
---- Here is my updated code ----
// variable for external loaders
var loader:Loader;
var loader1:Loader;
var loader2:Loader;
var loader3:Loader;
// makes borders resize with browser size
function resizeHandler(event:Event):void {
// resizes portfolio page to center
loader.x = (stage.stageWidth - loader.width) * .5;
loader.y = (stage.stageHeight - loader.height) * .5;
// resizes about page to center
loader3.x = (stage.stageWidth - 482) * .5 - 260;
loader3.y = (stage.stageHeight - 492) * .5 - 140;
//adds gallery.swf to stage at begining of moviie
Down();
//PORTFOLIO BUTTON
//adds eventlistner so that gallery.swf can be loaded
MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
function Down(event:MouseEvent = null):void {
// re adds listener for contact.swf and about.swf
MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
//unloads gallery.swf from enter frame if users presses portfolio button in nav
var requester:URLRequest=new URLRequest("carouselLoader.swf");
loader = new Loader();
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
function ioError(event:IOErrorEvent):void {
trace(event);
try {
loader.load(requester);
} catch (error:SecurityError) {
trace(error);
this.addChild(loader);
loader.x = (stage.stageWidth - 739) * .5;
loader.y = (stage.stageHeight - 500) * .5;
// sure this is not the best way to do this - but it is unload external swfs
loader.unload();
loader2.unload();
loader3.unload();
// remove eventlistner and prevents duplication of gallery.swf
MovieClip(root).nav.portfolio.removeEventListener(MouseEvent.MOUSE_DOWN, Down);
//INFORMATION BUTTON
//adds eventlistner so that info.swf can be loaded
MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
function Down1(event:MouseEvent = null):void {
//this re-adds the EventListener for portfolio so that end user can view again if they wish.
MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
var requester:URLRequest=new URLRequest("contactLoader.swf");
loader2 = null;
loader2 = new Loader();
loader2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
function ioError(event:IOErrorEvent):void {
trace(event);
try {
loader2.load(requester);
} catch (error:SecurityError) {
trace(error);
addChild(loader2);
loader2.x = (stage.stageWidth - 658.65) * .5;
loader2.y = (stage.stageHeight - 551.45) * .5;
loader.unload();
loader2.unload();
loader3.unload();
// remove eventlistner and prevents duplication of info.swf
MovieClip(root).nav.info.removeEventListener(MouseEvent.MOUSE_DOWN, Down1);
//ABOUT BUTTON
//adds eventlistner so that info.swf can be loaded
MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
function Down3(event:MouseEvent = null):void {
//this re-adds the EventListener for portfolio so that end user can view again if they wish.
MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
var requester:URLRequest=new URLRequest("aboutLoader.swf");
loader3 = null;
loader3 = new Loader();
loader3.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
function ioError(event:IOErrorEvent):void {
trace(event);
try {
loader3.load(requester);
} catch (error:SecurityError) {
trace(error);
addChild(loader3);
loader3.x = (stage.stageWidth - 482) * .5 - 260;
loader3.y = (stage.stageHeight - 492) * .5 - 140;
loader.unload();
loader2.unload();
loader3.unload();
// remove eventlistner and prevents duplication of info.swf
MovieClip(root).nav.about.removeEventListener(MouseEvent.MOUSE_DOWN, Down3);
stop(); -
What happens when the Main Flash is 25 fps and an external SWF file is 12 fps?
Hello everyone,
I have a Main Flash which is set to 25 fps. This Flash is
used to load an external swf file which was created using 12 fps. I
would like to know what really happens when the Main Flash loads
the external swf file? Does the Main file forces the external file
to be run on 25 fps or the swf file is run with its own 12 fps?
Any ways, if someone can take the time and explain this, I
would be greatful.
Thank you very much and have a great day.
Khoramdinthe external swf plays at 25fps - all loaded movies will take
on the frame rate of the parent movie.
Chris Georgenes
Adobe Community Expert
mudbubble.com
keyframer.com
http://tinyurl.com/2urlka
Khoramdin wrote:
> Hello everyone,
>
> I have a Main Flash which is set to 25 fps. This Flash
is used to load an
> external swf file which was created using 12 fps. I
would like to know what
> really happens when the Main Flash loads the external
swf file? Does the Main
> file forces the external file to be run on 25 fps or the
swf file is run with
> its own 12 fps?
>
> Any ways, if someone can take the time and explain this,
I would be greatful.
>
> Thank you very much and have a great day.
>
> Khoramdin
> -
How to load and unload more than one external swf files in different frames?
I do not have much experience on Adobe Flash or Action Script 3, but I know the basics.
I am Arabic language teacher, and I design an application to teach Arabic, I just would like to learn how to load and unload more than one external swf files in different frames.
ThanksLook into using the Loader class to load the swf files. If you want to have it happen in different frames then you can put the code into the different frames.
-
FAQ: How do I load an external SWF file into a parent SWF file?
A ton of Flash users visit Adobe’s we site every month wondering about how to load an external SWF file from within another SWF.
Adobe's own TechNote on the subject attempts to answer the basic question, along with some common follow-up questions, including:
How do I load more than one SWF?
How do I load a SWF into a specific location in the display list?
How do I resize the loaded SWF?
How do I set its X and Y location?
Here are some additional resources that elaborate on loading content and on working with the display list:
Sample files for the above TechNote. A set of 3 FLA and 3 corresponding SWF files, including a parent SWF and 2 SWFs that the parent loads.
Help > AS3 Developer’s Guide > Loading an external SWF file
Help > AS3 Developer’s Guide > Loading display content dynamically
Loading multiple external SWFs within a main SWF – CreativeCow.net forums
Video tutorial: ActionScript 101 – Episode 6: Adding named objects to the Stage. By Doug Winnie. An example of how to add the loaded external asset to the Stage and modify its location or other properties.
Video tutorial: Preloading in ActionScript 3.0. By Lee Brimelow. A slightly more complicated example, showing how to make the parent SWF display information about the progress of loading the external SWF.
Tutorial: Loading and unloading SWFs - FlashAndMath.com
This article provides several examples of how to communicate between a parent SWF file and the loaded SWF:
SWF to SWF Communcation via ActionScript 3.0 (by kglad)quote:
Originally posted by:
NedWebs
You now seem to want to get rid of the swf once it has loaded
and played itself thru. To do that you would need to have something
in the swf itself that triggers its removal in its last frame. The
following might work...
MovieClip(this.parent).removeChild(this);
Unfortunately I couldn't get this to work. I placed it on the
last frame of the SWF to be called - is that right?
I am not sure I am doing it correctly... -
Loading external swf file in a new window
Hi,
I've got a few .swf files with video tutorials I've created using Captivate 4.
I wanted to link them so I've created a main screen with menu with buttons in Flash.
I've added AS to load the external swf files but they load in the same window. How can I load these .swf files in seperate window so that you could get back to the main window after you've finished watching?
Here's my code:
stop();
var myLoader:Loader = new Loader();
button1_btn.addEventListener(MouseEvent.CLICK, movie1_1);
function movie1_1(e:MouseEvent):void
var myURL:URLRequest = new URLRequest("01_01_Welcome.swf");
myLoader.load(myURL);
addChild(myLoader);
I'm also attaching screenshot with menu in flashI've deleted the line and now the code lookes like that:
stop();
var myLoader:Loader = new Loader();
button1_btn.addEventListener(MouseEvent.CLICK, movie1_1);
function movie1_1(e:MouseEvent):void
var myURL:URLRequest = new URLRequest("01_01_Welcome.swf");
addChild(myLoader);
Unfortunately, it doesn't load the .swf file when you click on the button... -
Trouble loading an external swf file implemented with AS3
I am using Adobe Flash CS3
At first, I tried
swf_mc.loadMovie("//swf file
location");
It gave me
quote:
Warning: 1060: Migration issue: The method loadMovie is no
longer supported.
USE: var l = new Loader(); addChild(l); l.load(new
URLRequest("your url"));.
Well, the given code isn't working at all.
But since it is a migration error, I thought maybe I can just
save it into Flash5 format with AS1. Then it worked with most
external swf files. However, the one I am trying to load is a swf
file with AS3, so my older version swf can't load it at all.
Anyone has any ideas about how to load an external AS3 swf
file?AS3 is a completely different beast than AS1 or 2. loadMovie
was removed from the language.
The answer to your question is two fold. First, Adobe was
kind enough to give us the code when it finds a migration issue.
var _ldr:Loader = new Loader();
addChild( _ldr );
_ldr.load( new URLRequest( "your url") );
Handling progress has also changed. I have a ContentLoader
package on my site that you're free to use that should familiarize
you with the new way that things are done in AS3.
http://sd-dezign.com/blog/?page_id=10 -
Hi,
Does somebody knows what is happening?
I'm using the mcLoader class to load all my external swf
files, everything worket perfectly until I decided to use
flvPlayBack on one of those external files. If the player is on my
main stage it works great and if I run directly the loaded swf it
also works, but now when i run the external swf through the
mcLoader the player doesn't appears.
my mcLoader code:
var mcLoader01:MovieClipLoader = new MovieClipLoader();
mcLoader01.loadClip("clientes/targetTrade.swf",mcConatiner);
The flvPlayer should be on the second frame of this
targetTrade.swf ("click to watch the video")
thanks,
PeterHi,
You said swfs are Flash 8. Did you also set them to
Actionscript 2? If it's
Actionscript 3, that may be the problem. You may be
interested in looking at the
Flash Video templates I have at:
http://www.deansdirectortutorials.com/FlashVideo/
regards
Dean
Director Next Roadmap Survey
http://www.deansdirectortutorials.com/survey/DirectorRoadmap/
Director Lecturer / Consultant / Director Enthusiast
http://www.deansdirectortutorials.com/
http://www.multimediacreative.com.au
email: [email protected] -
I have loaded an external swf file which plays a flv file by default as swf is loaded. Now the problem is how do i remove the swf file from memory. my code :
var myLoader:Loader = new Loader();
var url:URLRequest = new URLRequest("ExternalSWF.swf");
myLoader.load(url);
detailMovieClip.movieHolder.addChild(myLoader);
I have tried many combinations of removeChild, unload and unloadAndStop but none works. I figure its all about not referencing correctly.Hi Jah,
i understood your problem,i faced this problem many time but couldn't find correct solution.
I'm using now Event.REMOVED_FROM_STAGE. this method dispatch to parent swf for when the External swf removed from stage.
The sample example code below for the way of remove externalswf events:
parent swf actionscript code:
import flash.events.MouseEvent;
var myLoader:Loader = new Loader();
var url:URLRequest = new URLRequest("ExternalSWF.swf");
myLoader.load(url);
b_mc.addChild(myLoader);
a_mc.addEventListener(MouseEvent.CLICK,onClick);
function onClick(event:MouseEvent):void
a_mc.removeEventListener(MouseEvent.CLICK,onClick);
myLoader.unload();
b_mc.removeChild(myLoader);
myLoader=null;
ExternalSWF.swf actionscript code:
import flash.events.Event;
var num:Number=0;
addEventListener(Event.ENTER_FRAME,onRun);
addEventListener(Event.REMOVED_FROM_STAGE,onRemoveFromParent);
// remove all local events here//
function onRemoveFromParent(event:Event):void
trace("remove");
removeEventListener(Event.ENTER_FRAME,onRun);
function onRun(event:Event):void
num++;
trace(num);
Thanks/ -
External swf file not using URLRequest
Good morning guys.
You can load an external swf file not using URLRequest? Since embed html code is setted as <param value="never" name="allowscriptaccess"/>
I have this problem and I need to load a swf skin
thank youare you loading a swf (done during runtime) or importing one (done during authortime)?
in either case, the allowscriptaccess parameter of the external swf (that your loading or importing) is irrelevant. allowscriptaccess is assigned in the main (loading or importing) swf's embedding html page and is used to control html/js access of the main and loaded swfs.
if you trust the swf you're loading, you can change allowscriptacess to always. if you're importing a swf, none of its actionscript will execute anyway so it doesn't matter whether its trusted or not. -
Can not load an external swf file from my site
Hi ...
I have a fla file which is loading external swf files from my local folders.
I inserted some of the swf files to a web site and tried to load them from the site, not from my local folder...
So it gave me a security error like below:
*** Güvenlik Sanal Alanı İhlali ***security domain-area violation
http://www.celiktek.com.tr/KIRIL.swf' SecurityDomain öğesi -- security domain element, 'file:///C|/Users/Acer/AppData/Local/Temp/Untitled%2D1.swf' uyumsuz bağlamına erişmeye çalıştı - tried to reach this incompatible url
SecurityError: Error #2070: Güvenlik sanal alan ihlali -- security area violation: http://www.celiktek.com.tr/KIRIL.swf arayanı - searcher of this can not reach stage in file:///C|/Users/Acer/AppData/Local/Temp/Untitled%2D1.swf içindeki Stage'e erişemiyor. -
at flash.display::Stage/requireOwnerPermissions()
at flash.display::Stage/get numChildren()
at KIRIL_fla::MainTimeline/frame1()
so in my computer, I can load this swf , but how from a website ?
thnx ...Thnaks ...
I tried to use the securiyt panel that is openede and I added there my site
www.celiktek.com.tr/KIRIL.swf
but I still take the error
*** Güvenlik Sanal Alanı İhlali ***
http://www.celiktek.com.tr/KIRIL.swf' SecurityDomain öğesi, 'file:///C|/Users/Acer/AppData/Local/Temp/Untitled%2D1.swf' uyumsuz bağlamına erişmeye çalıştı
SecurityError: Error #2070: Güvenlik sanal alan ihlali: http://www.celiktek.com.tr/KIRIL.swf arayanı file:///C|/Users/Acer/AppData/Local/Temp/Untitled%2D1.swf içindeki Stage'e erişemiyor.
at flash.display::Stage/requireOwnerPermissions()
at flash.display::Stage/get numChildren()
at KIRIL_fla::MainTimeline/frame1()
from my code
var req:URLRequest=new URLRequest("http://www.celiktek.com.tr/KIRIL.swf");
var lod:Loader=new Loader();
lod.load(req);
addChild(lod);
lod.x=0;
does this code works on your computer ... I know it is a weird question ... you dont have to try ... -
Trying to properly code a menu with buttons that can go back and forth between external swf files
I have a project I've been working on that, when properly coded, has a "main menu" with 4 "doors" (buttons). When the corresponding buttons to these "doors" are clicked, it should go to and play an external .swf file. If that doesn't make sense, think of a DVD menu. You click play movie, it plays the movie. When the movie is over, there's two buttons on that swf file to either play the movie over or go back the main menu, which is an external .swf file (Remember, we go to the movie from the menu, which is a seperate file). So far, the buttons work. The menu works. However, from the movie, at the conclusion, when I click the button to go back to the main menu, it displays the movie clip and the buttons, but none of the buttons work. I'm starting to think it has to do with the fact the main menu was written in AS3 and the movie was made in AS2. If anyone can assist me in being to able to keep both files and still navigate between the two, being able to bring up the menu from the movie and be able to play the movie again, and so on and so on, that'd be GREAT. I'm somewhat of a noob to Flash, but I learn quickly and I'm open to any suggestions. Here's the code for main menu, which I guess acts as the parent file, and the movie. If I get this to work, I essentially would duplicate the same actions for the other 4 doors, once I complete the environments for them. Thanks
Main.Fla/Swf (written in AS3)
(This is the action on the first frame, that has all the buttons. For this question, I'm just trying to properly code for 'Door4', which is the "door" to the movie.)
import flash.display.Loader;
stop();
var myLoader1:Loader=new Loader ();
Door4.addEventListener(MouseEvent.CLICK, jayzSwf);
function jayzSwf(myevent1:MouseEvent):void
var myURL1:URLRequest = new URLRequest("jayzspeaks.swf");
myLoader1.load(myURL1);
addChild(myLoader1);
myLoader1.x = 0;
myLoader1.y = 0;
Movie.Fla/Swf (written in AS2)
(This is action on the button that returns to the menu)
on (release) {
this.createEmptyMovieClip("container",this.getNextHighestDepth());
container.loadMovie("main.swf");At least you're going in the correct (mis)direction. You have AS3 loading AS2. So that's not a huge hurdle.
I believe all you really need to do is send your Main.swf a signal that the content it loaded (e.g. jayzspeaks.swf) is done and you want to get rid of it.
The code I pointed you to asks you to (upon download and import then) instantiate it in both AS2 and AS3. They give a very simple easy to understand line of code.
// as2, load this in jayzspeaks.swf
var myBridge:SWFBridgeAS2 = new SWFBridgeAS2("connectionID", clientObj);
// as3, load this in main.swf
var myBridge:SWFBridgeAS3 = new SWFBridgeAS3("connectionID", clientObj);
Make sure the connectionID matches between them. Set it to whatever you want.
When you're done with your as2 loaded content you'd send a signal (over localconnection) back to the AS3 Main like they say:
myBridge.send("someFunctionToUnloadContent");
myBridge.close();
You'd need to make the as3 function "someFunctionToUnloadContent()" (example purposes only name) and it should unload the jayzspeaks.swf that was loaded in the loader.
Make sure you get that close in there so you don't drill up a bunch of localconnection objects just like the simple source code says. -
Control external SWF file?
Is it possible to control an external SWF file with buttons
on the main clip?
I have an external SWF loading into the stage, but I wanted
to control "play" "stop" and "goto" with buttons outside that
SWF.I need to do the same thing, but i get an error.
TypeError: Error #1009: Cannot access a property or method of
a null object reference.
at page2sub1page1_fla::MainTimeline/frame1()
TypeError: Error #1034: Type Coercion failed: cannot convert
flash.display::AVM1Movie@3dcb7359 to flash.display.MovieClip.
at page2sub1page1_fla::MainTimeline/finished_loading()
here is my code:
var external:MovieClip;
//LOADER//
var request:URLRequest = new URLRequest("slideshow.swf");
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE,
finished_loading);
loader.load(request);
function finished_loading(e:Event) {
external = MovieClip(loader.content);
LoadMov.addChild(external);
external.my_ssp.xmlFilePath="images.xml";
why do i get that error? -
Hi all,
I am trying to load an external SWF file into my website.. but it is not working. Here is my code
public var CD:Loader=new Loader();
protected function application1_creationCompleteHandler(event:FlexEvent):void
CD.load(new URLRequest("http://localhost/assets/slide.swf"));
addChild(this.CD);
CD.x=2;
CD.y=170;
// TODO Auto-generated method stub
Can anyone tell me what is going wrong..
The url is correct and its working in my browser when i type 'http://localhost/assets/slide.swf' in the browser... So problem is with flex..I am pretty sure that Flash's security measures prevents the coder from loading swfs that are not local to the swf that is trying to load them. So the swf that is trying to load another swf would have to be on the same system or same networked server. From what I have experienced its best to reference the location of the files from the swf that is doing the loading. I am not sure if you are still referencing your swf as "http://localhost/assets/slide.swf" but that might be a problem as well.
so
mainfolder
movie.swf
assets
slide.swf
so in movie.swf
//Start: Put in desired function
var swfLoader:Loader = new Loader();
swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
swfLoader.load(new URLRequest("assets/slide.swf"));
//End
Also add this function
public function loadComplete(e:Event):void
stage.addChild(e.target.content);
This might help explain it
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Loader.html
the first set of bullet points highlight the security options
ps. I got this working on my end, copy and pasted the code, of course i had to recreate the file system structure and slide.swf -
Loading external swf files in a swf - Error#1009
I have been having trouble using a swf file within a swf file. The external swf files all work as expected. However when used within another swf file I get the standard TypeError #1009 for some of my swfs. The external swf files are mainly actionscript 3 files. A typical swf file will have an object (or objects) in the library which has an export for ActionScipt property enabled and an addEventListener(Event.ENTERFRAME, somefunction). About four years ago when I had to do some work with AS2 I seemed to get around a similar issue with the _lockroot method but this is no longer part of AS3. I have searched various forums and note that I am not the only one with this issue but did not find any relevant solutions. If anyone could give me any ideas on how to get around this it would be appreciated.
Regards
NormanHi,
I have added a download to rapidshare and its link is:
Download link: http://rapidshare.com/files/380202712/ExtSwfs.zip
The main file Training01.fla has been set up with links to download several swf's. The links that do not work properly are those labelled : Module6 and Module 8. The first Module 6 connects to a function that is a variation of how I was trying to load external swfs using Application Domain, while Module 8 is a link to a swf that uses and external class. Module 8 is supposed to load with rotating stars, while Module 6 loads the same file as the link called Module 1. As soon as I use the two links Module 6 or Module 8 the whole lot ceases to work properly. I did also follow through the examples on the Adobe site. The examples for Module 6 and Module 8 are tutorials I have used from the Internet as part of my training from the site FlashMyMind.com but they replicate the type of work we have been doing with respect to using ActionScript3.
Re my background, at this stage I am self-taught using tutorials on the web and whatever books I can lay my hands on here. There is no structured training available where I live as there is insufficient demand and no books available on Flash or ActionScript at the local book stores or libraries so the books are ones I have ordered via the Internet. The one I am currently using apart from Adobe Classroom in a Book Flash CS4 is O'Reilly's Learning ActionScript 3.0 a Beginners Guide.
The other problem I have been trying to solve and still researching is why one loses sound in the flash player when playing flv files, if the user has selected or restarted a video (or videos) many times eg 25 to 30 times as we create video training files and serve them to the user within the flash environment using Flash Player 9 and IE6.
Regards
Norman
Maybe you are looking for
-
In order to take advantage of the iPhone trade in, do I need to have met my upgrade eldigbility date, or do I just need to re-sign up for a new 2 year plan with the new iPhone 6?
-
End-to-End user authentication with XI
Dear community, we sit in a situation where the customer wants to have an end-to-end-authentication throughout an integration process. The setup is as follows: a dialog-user in a legacy system uses an application that triggers an integration process
-
Is it possible to prevent the admin hack on a mack
Hi any of youse know that there is an hack for macs where users can easily delete a setup file on the mac and reboot it so they can setup another mac admin account Im wondering how to prevent this from occuring
-
Script Repository "publisher could not be verified" error
Hello, I'm trying to add a script to the script repository, but when I test it to download it, I get the "publisher could not be verified" error. My script is not signed. I do not get this error when downloading other user's scripts, even though thei
-
11.1.2.4 64 bit client crash managing metadata
Hi. I recently installed the EPM 11.1.2.4 product suite. In the HFM 64 bit client, I am trying to use "manage metadata" to open an11.1.2.2 XML file in hopes of being able to convert it to an 11.1.2.4 XML file. When I try to open the file, a message o