CS3 and AS2: Embedding an external swf file
Hey everyone,
I have built a few flash sites before and am trying to make one that is slightly more complicated and allows for dynamic, database stored images and text. I have built a dynamic gallery based on an XML feed in AS2 which works fine. I am trying to embed it into another FLA file that contains the remainder of the site (the gallery will be one page of the main site). I have tried a ridiculous number of different methods but just cannot get it to work. The gallery is built in AS2, so I am using an AS2 FLA file for the main template it is to be embedded in. The simplest method i have tried that i think should work is to create a new AS2 fla file, edit the actions on my actions layer to be:
Empty.loadMovie("My Gallery.swf");
I have then created a new layer for the content and added a MovieClip to the top left of it, named Empty. I have set the instance name of this movie clip to be Empty. From what I have understood from my reading this is the simplest way to display the external file but for some reason it just will not work. It seems to see My Gallery.swf as when i delete it from the local directory i get an 'Error opening URL 'file:///D|/Websites/My Gallery.swf'' message. This message does not appear when this file exists locally, however it just opens a blank screen with nothing within it.
I have been reading numerous tutorials and posts and i'm pretty sure i'm being thick, but for some reason i can't seem to get it to work!
Thanks so much for any light you could shed on this for my guys, it's driving me crazy!
Dave
I have checked that a number of times and unless i'm going crazy (which is distinctly possible) then the instance name is set to Empty. I have uploaded a zip file containing the fla and swf file and the test swf file that is being embedded. You can download it here.
Thanks so much for your help, i really am completely stumped and i know it's going to be something crazy i'm doing and i'm going to hate myself when i finally discover why!
Dave
Similar Messages
-
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. -
Load and unload the external swf file using AS3(for window, IOS and android)
For the external swf file loading, I use this code
load2.addEventListener(MouseEvent.MOUSE_DOWN, newvid);
function newvid(event:MouseEvent) {
trace("you clicked me");
var loadit = new Loader();
addChild(loadit);
var _lc:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
loadit.load(new URLRequest("scene02.swf"), _lc);
its working great but I don’t know how to unload the loaded swf files (looking: unload one by one and unload all)
in AS2 we have
on (release) {
loadMovieNum("scene2.swf", 1);
unloadMovieNum(2);
unloadMovieNum(3);
but i need in AS3Now I use this code and this time I got these compiler errors
package {
import flash.display.SimpleButton;
import flash.display.MovieClip;
import flash.events.MouseEvent;
//import flash.display.URLRequest;
//import flash.display.Loader;
import flash.events.Event;
import flash.system.ApplicationDomain;
import flash.net.URLRequest;
import flash.system.LoaderContext;
public class load1 extends SimpleButton {
var loadit:Loader;
public function load1() {
this.addEventListener(MouseEvent.MOUSE_DOWN, loadfile);
private function loadfile(event:MouseEvent):void {
trace("you clicked me");
loadit = new Loader();
this.parent.addChild(loadit);
var _lc:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
loadit.load(new URLRequest("s01.swf"), _lc);
private function unloadfile(event:MouseEvent):void {
loadit.unloadAndStop(); -
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.
-
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(); -
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] -
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
> -
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.
GaneshWhen 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.
-
OSX 10.5.2 and AR8.1.2 playing swf files
After applying the latest Apple updates to OSX 10.5.2 I find that I can no longer play
swf files from within a PDF file. I'm using AR8.1.2 with FP9,0,115,0 . Consider
the example:
http://www.amrita-cfd.org/4adobe/swf/swf.pdf
It contains an /Annot "Click to activate SWF!" that is supposed
to play the swf, but when I click it: a progress bar "buffering" appears
in the bottom right corner of the screen and then hangs. The swf file
is included as an attachment, shock-tube.swf, which can be
opened in an external viewer and so I don't think the swf file
is the problem.
I have the same problem with the PDF available at:
http://acrobat.timhuff.net/?p=92
where the swf is embedded using Acrobat,
rather than my homebrew approach.
I would very grateful if anyone could shed light
on this problem.
Thanks,
James QuirkJames,
I am seeing what you are seeing even on pdfs with swfs that I created
that previously worked. I guess we will need to file a bug report.
Mike -
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. -
External .swf files not playing, or showing up
Hello All,
I'm a bit confused. I have created a video interface (vidPlayer.swf) file, and am calling on external .swf's (movieName.swf), which contain paths to the original .flv files (movieName.flv) that are to play. The navigation lives on the the main interface file (vidPlayer.swf). This works fine when I'm publishing locally from my system, or if I upload it to a remote server, and play it on my computer. When another individual attempts to either (a.) play it from the server on their system, or (b.) publish it to the web for it's intended use, the interface appears and the loader performs when video track is selected, but the video never plays. Only on my system does it work. Even from a remote server, it plays on my system.
I have not wrapped my head completely around AS3 yet, so I'm using deprecated script. On the main interface swf (vidPlayer.swf) I have the following script controlling the loader ( I also use this same loading script for the external video swf's):
stop();
myInterval = setInterval(preloader, 10);
function preloader(){
if (getBytesLoaded()>=getBytesTotal()){
play();
clearInterval(myInterval);}
loadBar_mc._xscale = (getBytesLoaded()/getBytesTotal())*100;
loader_txt.text=Math.round(getBytesLoaded()/getBytesTotal()*100)+"%";
On the navigation buttons (tracks), I have the following script (there are 14 tracks total, so the content varies between load and unload content):
on (release){
mc_videoPlayer.unloadMovie("02-systemAdministration.swf");
mc_videoPlayer.unloadMovie("03-gatewaySetUp.swf");
mc_videoPlayer.unloadMovie("04-homePage.swf");
mc_videoPlayer.unloadMovie("05-addUser.swf");
mc_videoPlayer.unloadMovie("06-changePasswordOrPermission.swf");
mc_videoPlayer.unloadMovie("07-inventorySetUp.swf");
mc_videoPlayer.unloadMovie("08-storageContainer.swf");
mc_videoPlayer.unloadMovie("09-addDeicingOperator.swf");
mc_videoPlayer.unloadMovie("10-orderCryotechProducts.swf");
mc_videoPlayer.unloadMovie("11-recordDelivery.swf");
mc_videoPlayer.unloadMovie("12-adjustInventory.swf");
mc_videoPlayer.unloadMovie("13-deicingLog.swf");
mc_videoPlayer.unloadMovie("14-PTOCClog.swf");
_root.gotoAndStop(11);
mc_videoPlayer.loadMovie("01-firstLogin.swf");
I have all the .swf's (movieName.swf), .flv's (movieName.flv) and main interface .swf (vidPlayer.swf) in the same folder, so there shouldn't be any missing directory paths.
I don't know what's going on! I have this set up exactly as a previouse project, using the same interface, scripting and file directory, and it words perfectly from any system, being hosted from anywhere.
Can anyone help????
[ I'm working with Flash, CS3 - actions script 2 ]
Thanks in advance,
Jamesproblem solved. Solution? Redo the entire f&%#ing thing. For what ever reason, it now works.
Thanks anyways.
James -
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 -
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... -
How do I find the width of an external swf file that I am loading in
I have loaded in an external swf file and it works fine.
However, when I get the width dimensions of the movieclip that is housing the external swf file it gives me a '0' for the width.
Thanks for your time.you must wait until loading is complete before trying to access the loaded objects width. at that point you can determine the width,height of the onstage/backstage objects in frame 1 of the loaded swf.
-
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...
Maybe you are looking for
-
Problem returning variables from dynamic SQL/PLSQL
Hi, I have a problem I am trying to solve using a very short piece of dynamic SQL or PLSQL but I am having problems getting the variable values out of the dynamic block. I have 16 counters whose names are made up of three variable parts - 'scheme', '
-
OS X 10.6.8 upgrades.
I am currently running on Safari 5.0 on my iMac (OS X 10.6.8) and I have noticed recently that several websites are telling me to upgrade to the Safari 6.0. Can anyone advise if this is a free upgrade or do I have to pay for an upgrade combo through
-
Move from iPhoto '11 to Lightroom using PS Elements to keep Events and Albums
I am trying to move from iPhoto '11 to Lightroom by using PS Elements as a go-between to keep events and album but it doesn't appear that the option to keep events and albums is possible using iPhoto '11. However, the instructions for coming from iP
-
Getting file structure off system
Im trying to create a program which can read the directory stucture of a system and put it in a list of sum sort so i can process it. my aim is to be able to represent the file structure in an xml document i am totally lost and would just like to get
-
Hi! I have a question: Is there a way to controll where the errorTip appears when an Validation Error occurs? My problem is that I have a form (form.swf) that is loaded into another swf. On mouse over, the tip is showing, but extends outside of the m