Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8374143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:51:18+00:00 2026-06-09T14:51:18+00:00

I’ve generated a class to load and unload SWFs, however, it does not seem

  • 0

I’ve generated a class to load and unload SWFs, however, it does not seem to load to swf visually, but it doesn’t return any errors either.

Parent code:

 //specify the path for the child SWF
  var PageURL:URLRequest = new URLRequest("home/home_index.swf");

//include the SWF loading class 
import MM_swfloader;
var mainPage:MM_swfloader = new MM_swfloader();
//evoke the load
mainPage.LoadSWF(PageURL);

MM_swfloader class:

package  {

import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;  
import flash.net.URLRequest;
/**
 * author: Me
 * email: lala@lala.com
 **/

public class MM_swfloader extends Sprite {

    public var loader:Loader = new Loader();
    public function MM_swfloader():void
     {
        // constructor code
     }

    public function LoadSWF(val:URLRequest):void{
        var loader:Loader = new Loader();
        loader.load(val);
        addChild(loader);
trace("loaded"); //returns true
    }

    public function UnLoadSWF():void {
        loader.unload();
    }

  }

} 

I don’t understand where the loaded SWF is being loaded to. Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T14:51:20+00:00Added an answer on June 9, 2026 at 2:51 pm

    You need to add the instance of your SWF loading class to the stage in the parent class:

    //specify the path for the child SWF
    var PageURL:URLRequest = new URLRequest("home/home_index.swf");
    
    //include the SWF loading class 
    import MM_swfloader;
    var mainPage:MM_swfloader = new MM_swfloader();
    // add the instance to the stage
    this.addChild(mainPage);
    //evoke the load
    mainPage.LoadSWF(PageURL);
    

    There are also a couple of problems with the code in your loader class which I have fixed below (see the comments for an explanation):

    // Poor practice to use the default namespace, stick it in com.lala 
    package  {
    
    import flash.display.Loader;
    import flash.display.Sprite;
    import flash.events.Event;  
    import flash.net.URLRequest;
    /**
     * author: Me
     * email: lala@lala.com
     **/
    
    public class MM_swfloader extends Sprite {
    
        public var loader:Loader = new Loader();
    
        public function MM_swfloader():void
        {
            // constructor code
    
            // listen for loader complete on the loader instance
            loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderCompleteHandler);
    
            // add loader to stage
            this.addChild(loader);
        }
    
        // Note that by convention loadSWF would be a better name for this method
        public function LoadSWF(val:URLRequest):void {
            // commented out to avoid creating a new locally-scoped
            // loader each time the method is called
            //var loader:Loader = new Loader(); 
    
            loader.load(val);
    
            // commented out to avoid adding child each time
            // method is called, added in constructor instead
            //addChild(loader);
    
            // loading is asynchronous, this needs to be in a handler
            // for the loader.complete event
            //trace("loaded"); //returns true
        }
    
        // call this unloadSWF
        public function UnLoadSWF():void {
            loader.unload();
        }
    
        // handler for loader.complete event
        private function loaderCompleteHandler(event:Event):void {
            trace("loaded");
        }   
      }
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
I need a function that will clean a strings' special characters. I do NOT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.