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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:25:29+00:00 2026-05-27T14:25:29+00:00

My LoaderInfo will return the swf itself rather than the image given via the

  • 0

My LoaderInfo will return the swf itself rather than the image given via the FileReference and Loader. I had problems debugging it, as LoaderInfo.content returns [Object Main] (My document class). After investigation, I discovered LoaderInfo.content is a swf file, according to contentType.

The problem is, the file reference for the image is correct (It is an image, and it is not the swf).

My code:

    private function onAction(e:MouseEvent){
        if(e.currentTarget.name == 0){
            myFileReference = new FileReference();
            myFileReference.browse(getTypes());
            myFileReference.addEventListener(Event.SELECT, loadedImage);
            myFileReference.addEventListener(Event.COMPLETE, loadImage15);
        }
    }
    private function loadedImage(e:Event){
        var imgHolder:ImageHolder = Main.imageHolder;
        while(imgHolder.numChildren > 0){
            imgHolder.removeChild(imgHolder.getChildAt(0));
        }
        myFileReference.load();

    }
    private function loadImage15(e:Event){
        var loader:Loader = new Loader();
        loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadImg2);
        loader.loadBytes(myFileReference.data);
        trace(myFileReference.type); // .JPG
    }
    private function loadImg2(e:Event){
        var lInfo:LoaderInfo = (e.target as LoaderInfo); //e.target is indeed LoaderInfo
        lInfo.removeEventListener(Event.COMPLETE, loadImg2);
        trace(loaderInfo.contentType); //application/x-shockwave-flash
        var newSprite:MovieClip = loaderInfo.content as MovieClip;
        Main.imageHolde.addChild(newSprite); //Error as you can't addChild Main to Main
    }
    private function getTypes():Array {
        return [new FileFilter("Images","*.jpg;*.jpeg;*.gif;*.png")];
    }
  • 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-27T14:25:30+00:00Added an answer on May 27, 2026 at 2:25 pm

    EDIT

    I originally had a very complicated answer – which was wrong…

    You simply have an error in your program:

    // here you reference the Loader's contentLoaderInfo
    
    var lInfo:LoaderInfo = (e.target as LoaderInfo); 
    lInfo.removeEventListener(Event.COMPLETE, loadImg2);
    
    // but from here on out, you reference your parent class' "loaderInfo" property!
    
    trace(loaderInfo.contentType);
    var newSprite:MovieClip = loaderInfo.content as MovieClip; // <- this is your Main class!
    Main.imageHolde.addChild(newSprite); //Error as you can't addChild Main to Main
    

    Change loaderInfo to lInfo, and you should be fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to import a SWF file into a custom loader and then
I have this code that works from an .as file if (loaderInfo.loader) loaderInfo.loader.dispatchEvent(new Event(pageFinish,
Flash gives access to query-string parameters via calling loaderInfo.parameters() method. And I couldn't delete
When loading images using Loader, what's the preferred way to add the image to
I have a swf that I call as /SWFUploader/upload.swf?single=true Then in ActionScript 3 I
I've got a SWF to which I added a Preloader scene. The preloader works
Adobe page for LoaderInfo states: The two sources of parameters are: the query string
In an AS3 project, we can access loaderInfo in the first line of the
I'm writing a preloader: package { import flash.display.DisplayObject; import flash.display.Sprite; import flash.text.TextField; import flash.display.LoaderInfo;
I'm trying to pass a variable from my main swf to another one that's

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.