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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:25:54+00:00 2026-05-26T15:25:54+00:00

I am putting together a Flash game (using Flixel) and I have a lot

  • 0

I am putting together a Flash game (using Flixel) and I have a lot of sprites whose images (.png format, mostly) I need to include in my game. I’m used to using code like:

[Embed(source = "../../lib/ship-0001.png")]private var _ship0001Sprite:Class;

in order to include an image file. Is there a way I can do this other than embed? I’d like to use a for loop if possible, grabbing every needed file by number. This way instead if having several lines for each ship type (to grab its sprite, icon, store view, etc), I can just change a variable (eg NUM_SHIP_TYPES) and add the files by number for the new ship.

Is embed the only way to do this where the files are included in the .swf, or is there another way I can do this? Or is there a way I can use a for loop with embed?

  • 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-26T15:25:55+00:00Added an answer on May 26, 2026 at 3:25 pm

    This may not be a popular answer. But it depends on preferences. I'm not trying to start a best practices discussion, just listing a possibility.

    If you have multiple images for each ship. And its the same number of images per each ships then the below could be a possibility. Of not, then completely ignore what I suggest.

    Have a folder for each one of your ship types and then a class file within that folder and place your images within that folder along side the class files..

    package shipimages.ship1 { class Ship1Images {
        [Embed(source="0001.png")] public var img0001:Class;
        [Embed(source="0002.png")] public var img0002:Class;
        [Embed(source="0003.png")] public var img0003:Class;
    } }
    

    .

    package shipimages.ship2 { class Ship2Images {
        [Embed(source="0001.png")] public var img0001:Class;
        [Embed(source="0002.png")] public var img0002:Class;
        [Embed(source="0003.png")] public var img0003:Class;
    } }
    

    But as I said, this is only beneficial in a small case scenarios but it does mean everything is more sub divided and if you were to make an Interface it could be easily done for factory pattern.

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

Sidebar

Related Questions

I'm interested in putting together my first online game using Flash as the client
I'm putting together a basic photoalbum on appengine using python 27. I have written
I am putting together some ideas for our automated testing platform and have been
I'm putting together a portfolio website which includes a number of images, some of
I'm putting together a prototype to use XAML to create PNG buttons. The basic
I'm working on putting together a simple POC app using Fluent NHibernate to attempt
I'm putting together an MVC application where I have created a base Model which
I'm putting together a quick and dirty animation using swing. I would like the
I'm putting together a fixed, one-page site that deploys an overlay using jQuery. There
I am putting together a php script that pulls html using curl, copies it

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.