Preloader + dynamically loading images

Hi there. I already plowed through these forums through the Adobe Community Help, which now fails me, so I thought I’d come here directly. :stuck_out_tongue:
I’m actually a beginner with Flash and AS, so please be gentle if my problems are stupid?
ETA: I’m using Flash CS5.

Preloader:

I’m sure this has been asked before, and I’ve actually read a bunch of stuff about preloaders in AS3 but [SIZE=“1”]it doesn’t apply to me because I’m special[/SIZE] I still can’t make it work as intended.

Firstly, I’m using TLF text, so there’s a RSL involved. I get that there’s a way to include the library in my own code, but I’d rather not do that unless there’s no other solution.

In Advanced Action Script Settings > Preloader Method, there’s a choice between “Preloader SWF” (five black dots, the default thing) and “Custom preloader loop”. My first question is then how to use this Custom preloader loop thing? What is it referencing? Do I have to write a special thingy somewhere? What?

And I already made a simple “bar filling up” kind of preloader, which I’m testing by using the aforementioned “Custom preloader loop” setting and simulating download. [SIZE=“1”]*(My project no longer compiles when not simulating download [VerifyError: Error #1014: Couldn’t find flashx.textLayout.container::ContainerController class.] which led to the conclusion that I’m doing something wrong here.) *[/SIZE] It does fill up, but it starts at about 60%. From my earlier badly worded Google searches, I think my problem is that I am using a bunch of external .as files which are loading before the preloader. Is there any way to tie the .as files later, or something?
(That, or my preloader actually takes up 60% of the project’s data, which would surprise me but isn’t impossible because it’s still very bare. Is there a way to find that out?)

Dynamically loading images:

This is more of a theoretic question as what I’ve done is working, but I have a feeling it’s done badly… :sigh:

I’m making a game and I’m sorta kinda using tiles to render the map screen. So I have a bunch of sprites on screen, for which I created a Refresh() method that I call whenever necessary. In this method, I use a Loader object to load desired bitmaps (which aren’t in the project’s Library), then add this Loader as a child. The main reason I did it that way is because I could then reference the images to load with a string, and so include arguments in there.
[SIZE=“1”](I don’t know if I’m clear, so let my try to be more descriptive. I basically have an array containing the map data. I’ll read that array and pass some properties as arguments to my Refresh() method to draw the screen correctly. I’ll then be able to load the image [“sprite” + arg1 + arg2 + “.png”] by using that string to create a new URLRequest (and then use that in the Loader).)[/SIZE]
If I understand the way this works correctly (and I probably don’t :-/), I’m downloading the images all over again each time I call Refresh instead of having them “cached” somewhere, which is inefficient (because they’re tiles and I’m reusing them multiple times). Am I correct in that assumption?

I thought the more “efficient” way would be to import my tiles in the project Library and export these for ActionScript. (They’re PNGs, so they inherit from BitmapData.) My problem with this method is that to use these images, I now have to instantiate a class, so there’s no string involved, and so I can’t concatenate variables with a string anymore to fetch the right PNG to display, which is really, really annoying.

So I’d like to have the best of both worlds: cache images while still being able to refer to them with a string. Is that possible? And more generally, what’s the “right” way to dynamically render images in the context of a tile-based map?

EDIT:
public vars vs. getters and setters

I have classes with properties. I’ve gathered that it’s good programming practice to declare these properties as private vars and then define getter and setter functions to access them. It’s easier to just declare these variables as public and move on. What are the pros and cons of both methods?

<----->

I tried to be as clear and precise as I could here, but if I still fell short of being understandable, please tell me what additional info is required.
Thank you for reading my rambling prose, and thank you for any help and advice you can offer. :slight_smile: