The forums have permanently moved to This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

Results 1 to 10 of 10

Thread: Linking SWF files

  1. #1

    Pallete Linking SWF files

    I made several SWF files and I am trying to link them together but I am not sure how, let me give you a short description to help illustrate my problem.

    Right now I have 3 applications, and a main page. All 4 SWFs were compiled from different FLA files. The main page has 3 buttons that links to all 3 of the SWF files. When I tried to do a URLRequest-URLLoader method to load the swf files, I realised I had to compile all the MovieClips of the 3 applications within the main.fla for them to actually work when you do URLLoader to load them(or it will throw a missing file error). I couldn't move all the graphical assets into main.fla as there are many replica names of different graphics from all 3 different application fla files.

    Is there a way to still link up different SWF files without the need for all the graphics to be in one similar FLA file? or is there a way to remedy my situation without having to rename all the MovieClips?
    Last edited by DjTeddySpin; July 25th, 2011 at 10:34 PM.

  2. #2
    Bump~ Still interested to know.

  3. #3
    Ok I found the answer. The error that I was getting was the null object error and I immediately assumed that it has something to do with MovieClips not correctly named or the Class was not found. I was wrong, the error was simple, it does not recognise this:

    Probably something to do with stage.

  4. #4
    You can't access stage within a Class until that Class object has been added to the Display List (meaning added to the stage or added to another object that has been added to the stage.) More here.

    You'll probably want to use the ADDED_TO_STAGE event within your child SWFs, when that event is fired, then you can set up your Object knowing you can access the stage and it's properties.

  5. #5
    Thanks for the reply, I have a new question. Now that I have loaded my swf file, it is suppose to play to the end and then remove itself. I tried using:


    and it works, but I want to inform the main.swf of the removal thus I wrote something like:


    manager is a public function within my main.swf, but this code doesn't seem to work. So is there still a way to inform the main.swf whenever I remove one of the 3 applications?

    (the trigger for removal lies within the 3application swf, since I am suppose to remove only after they end the application. So it has to speak to main.swf in some way to inform of the removal)
    Last edited by DjTeddySpin; July 28th, 2011 at 12:02 AM.

  6. #6
    Can you post the code from Main that loads your swf? One simple way is to dispatch an event from the child, but you need to set Main to listen to the event. I can probably get you in the right direction if you post that code.

  7. #7
    *and so the file path is sent into the function*

    private function loadSWF(path:String):void {
    	var req:URLRequest = new URLRequest();
    	req.url = path;
    	swfLoader = new Loader();
    private function setUpListeners(dispatcher:IEventDispatcher):void {
    	dispatcher.addEventListener(Event.COMPLETE, addSWF);
    private function addSWF(event:Event):void {, addSWF);
    	swfContent =;

  8. #8
    PHP Code:
        private function loadSWF(path:String):void {
    req:URLRequest = new URLRequest();
    req.url path;

    swfLoader = new Loader();


        private function 
    setUpListeners(dispatcher:IEventDispatcher):void {

        private function 
    addSWF(event:Event):void {


    // *************************************
            // Add your listener to the target.content property.
            // You can use whatever string you'd like:
        private function 
    onChildEvent(e:Event):void {
    trace("CHILD_EVENT captured...")
        // Within the main timeline in your child SWF, you can dispatch this event from any frame — again, doing it this way, it will
        // only be heard if it's dispatched from the main timline. 
    dispatchEvent(new Event("CHILD_EVENT")); 

  9. #9
    Wow thanks I will try that out once I am back in the office. What I did to bypass that issue is by adding an enterframe listener onto a Holder that checks for numChildren. I would add the swfContent onto that holder. So when the swf removes itself(when the application is completed) from the Holder, the numChildren will fall to 0, and thats when I startup my main.swf again. But I know how enterFrame slows down the application unnecessarily in this case.

    But thanks really, if I manage to get your suggestion to work it's really going to help me a bunch! I will update again soon

  10. #10
    Amazing, it works! Thanks! Now I have to go read up on the cool custom event!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Home About Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012