Loading external swf files in a swf - Error#1009
Copy link to clipboard
Copied
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
Norman
Copy link to clipboard
Copied
check the applicationdomain class.
Copy link to clipboard
Copied
Thank you for your prompt response. I had checked the applicationdomain class and done some reading on this but that did not seem to be the issue. I did some experimentation on this with swfs that did and did not work to see how it all worked. All my swfs are in the same domain. My original thought was that maybe it had something to do with timelines or the stage. Looking at the common elements, I have used either Event.ENTER_FRAME, or stage.StageWidth (or similar) and library objects such as 'particle' or 'button' which have linkages.
Regards
Norman
Copy link to clipboard
Copied
if you have classes set for export in your loaded swf's library and you're having trouble instantiating them WHEN your swf loads and not when it runs without being loaded, the applicationdomain is the issue.
Copy link to clipboard
Copied
Hi,
Yes, they run when loaded in their own right but not when run from within another swf file. I have tried a variety of ways including following the examples in the help files that accompany Flash.I get different errors when using application domain. eg ArgumentError: Error #2180: It is illegal to move AVM1 content (AS1 or AS2) to a different part of the displayList when it has been loaded into AVM2 (AS3) content. This error took me by surprise given everything has been created in FlashCS4 and AS3
An online example of the type of swf file I am trying to run is at the following link:
http://tutorials.flashmymind.com/2009/03/interactive-bubbles-with-actionscript-3/
Regards
Norman
Copy link to clipboard
Copied
oops. you're trying to load an as2 swf into an as3 swf?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
zip your two flas, upload to a file server and post a link. leave the code that caused the av1m error message.
Copy link to clipboard
Copied
I have zipped the files and added a readme - could not zip the originals as they were on a work computer which, as a terminal, does not have the ability to save to an external device or the Internet. Have replicated problem could you suggest a file server to upload the file to as I see I cannot attach the file to this response.
Regards
Norman
Copy link to clipboard
Copied
Hi,
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

