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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:00:41+00:00 2026-05-22T21:00:41+00:00

I want to embed all xml files of a given folder. For now I’m

  • 0

I want to embed all xml files of a given folder. For now I’m doing something like this:

[Embed(source="../somefolder/file1.xml", mimeType="application/octet-stream")]
private var MyClass1:Class;

[Embed(source="../somefolder/file2.xml", mimeType="application/octet-stream")]
private var MyClass2:Class;

[Embed(source="../somefolder/file3.xml", mimeType="application/octet-stream")]
private var MyClass3:Class;

and

var file:XML;
var bytes:ByteArray;

switch (fileId) {
    case 1:
        bytes = new MyClass1();
        break;
    case 2:
        bytes = new MyClass2();
        break;
    case 3:
        bytes = new MyClass3();
        break;
}

file = new XML(bytes.readUTFBytes(bytes.length));

The list of XML files will grow to 10+ files, so I’m looking for a more elegant and dynamic way to embed those files.

The files should be embedded on compilation, to load them via URLLoader is not an option.

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-05-22T21:00:42+00:00Added an answer on May 22, 2026 at 9:00 pm

    I don’t think there is a way to do something like :

    [Embed(source="../somefolder/*", mimeType="application/octet-stream")]
    

    But you could use a Zip file and access to his content. I use often http://nochump.com/blog/archives/15 to do this kaind of things :

    package
    {
        import flash.display.Sprite;
        import flash.utils.ByteArray;
    
        import nochump.util.zip.ZipEntry;
        import nochump.util.zip.ZipFile;
    
    
        public class TestTextfield extends Sprite
        {
            [Embed(source="files.zip", mimeType="application/octet-stream")]
            private var zipContent:Class;
    
            public function TestTextfield()
            {
                var zip : ZipFile = new ZipFile(new zipContent);
    
                for each(var entry : ZipEntry in zip.entries)
                {
                    var entryContent : ByteArray = zip.getInput(entry);
    
                    if(entry.name.indexOf(".xml") != -1)
                    {
                        var xmlContent : XML = new XML(entryContent.readUTFBytes(entryContent.bytesAvailable));
                        trace("File " + entry.name +" :\n" + xmlContent);
                    }
                }
            }
    
        }
    }
    

    This exemple will display all XML File content contained in embeded files.zip

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

Sidebar

Related Questions

I want to Embed SVG into XUL. I tried to use the this tutorial
Like most people I use SWFObject to embed Flash (swf) files to my Web
I want to separate concerns here. Create and embed all the UI logic for
I want to embed different Stylesheet files with assetic in a twig template of
Essentially I want to embed some XHTML in an XML document that must validate
I want to embed Javascript in a hobby game engine of mine. Now that
I want to embed a dsl or existing full language within my application. It
I want to embed a custom c# windows form (or WPF) user control into
I want to embed a Flex application (i.e. a Flash SWF) into a PDF
I want to embed vimeo videos in my Vf page. I am trying to

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.