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 993669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:27:37+00:00 2026-05-16T06:27:37+00:00

I have a movie with a document class (Main.as) wich load 2 SWF: private

  • 0

I have a movie with a document class (Main.as) wich load 2 SWF:

private var mainContainer:Sprite = new Sprite();
addChild(mainContainer);

var loaderx:Loader = new Loader();
loaderx.contentLoaderInfo.addEventListener(Event.COMPLETE,loadingComplete);

loaderx.load(new URLRequest("PhotoLoader.swf")); // PhotoLoader.as


var viewer:Loader = new Loader();
viewer.contentLoaderInfo.addEventListener(Event.COMPLETE,loadingComplete);

viewer.load(new URLRequest("PhotoViewer.swf")); // PhotoViewer.as

private function loadingComplete(evt:Event):void {
  evt.target.removeEventListener(Event.COMPLETE,loadingComplete);
  mainContainer.addChild(evt.target.content);
}

Now I need to access some var/objects in PhotoLoader from PhotoViewer but anytime I compile PhotoViewer the compiler complains:

trace(root.loaderx.dbFields);
1119: Access of possibly undefined property loaderx through a reference with \
static type flash.display:DisplayObject.

Notice I need communication between the 2 loaded SWFs, not from the movie that loaded them

  • 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-05-16T06:27:38+00:00Added an answer on May 16, 2026 at 6:27 am

    EDIT

    I’m surprised that type casting as a MovieClip fails but then again I only have the code you’re showing here to go by. According to the error message you can do this then :

    var photoLoader:PhotoLoader = PhotoLoader(evt.target.content );
    

    or even

    evt.target.content as PhotoLoader
    

    which is even better than casting as a MovieClip since you can directly access the properties & methods of the PhotoLoader class!

    I’m not sure what your environment is and you’re right, I assumed that you wanted to access the classes from the the Main class. Clearly my mistake! If you have DocumentClasses on each SWF , then it’s done to the way your code is structured, you don’t event need LocalConnection, you could have a Singleton Class to be used as a FrontController, a central access to the properties of both classes.

    END OF EDIT

    First you could cast your loader content as MovieClip, like this:

    var content:MovieClip = MovieClip(evt.target.content);
    mainContainer.addChild(content);
    

    evt.target.content should be from DisplayObject type , therefore you can’t access your movie clips properties.

    If you need to access the properties of your loaded SWF, you should declare them like this:

    private var photoViewer:MovieClip;
    private var photoLoader:MovieClip;
    

    then you could do:

    photoViewer = MovieClip(evt.target.content);
    mainContainer.addChild(photoViewer);
    
    photoLoader = MovieClip(evt.target.content);
    mainContainer.addChild(photoViewer);
    

    just give a name to your loader to differentiate the MovieClips

    loaderx.name = "photoLoader";
    viewer.name = "photoViewer";
    

    then you can do this

    private function loadingComplete(evt:Event):void 
    {
        switch(event.currentTarget.loader.name)
       {
            case "photoLoader":
              photoLoader = MovieClip(evt.target.content);
              mainContainer.addChild(photoLoader);
              break;
    
            case "photoViewer":
              photoViewer = MovieClip(evt.target.content);
              mainContainer.addChild(photoViewer);
              break;
       }
    
      if( photoViewer!= null && photoLoader!= null )
           evt.target.removeEventListener(Event.COMPLETE,loadingComplete);
    }
    

    After that you should be able to access your MovieClips properties like this

    trace( photoLoader.dbFields );
    

    or

    var prop:Object = photoViewer.whateverNameYouGaveToYourProperty;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hi need to instantiate document class in as3. I have a main movie which
I have used this code in my AS3 document class to remove all objects
I have the following HTML: <ul class="main-navigation"> <li class="left">&nbsp;</li> <li class="normal">Home</li> <li class="normal">Internet</li> <li
I have something that looks like the following document structure: public class Document {
I have an entity class Document and another one called Space. The relation: @ManyToOne(fetch
I have this code : function move() { $(document).mousemove(function(e){ var x = e.pageX; $('.linkHover').animate({'right':
I have an .fla that links to a generic Document class which manages the
All, In the Flash app I'm building, I have a main SWF that will
I have a class... class Document { public int GroupID { get; set; }
I have Movie table & TblMovieVideos table and I have relations with this tables,

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.