Jump to content
Search Community

Embedding resources/loading them dynamically and building project swf

Koshmaar test
Moderator Tag

Recommended Posts

Hey

 

What is the best way to load and store data? I've been using Embeds for sprite graphics, tilemaps and sounds, and they're easy, they're fast and no problems with them... apart from flexibility:

 

public class Level1 extends LevelBase
{

	[Embed(source = "../../assets/mapCSV_Level1_Sky.csv", mimeType = "application/octet-stream")] public var skyCSV:Class;
	[Embed(source = "../../assets/mapCSV_Level1_Map.csv", mimeType = "application/octet-stream")] public var mapCSV:Class;

	[Embed(source = "../../assets/backdrop.png")] public var skyTilesPNG:Class;
	[Embed(source = "../../assets/tiles.png")] public var mapTilesPNG:Class;

	[Embed(source = "../../assets/levels/level1_path1.txt", mimeType = "application/octet-stream")] public var paths:Class;

	[Embed(source = "../../assets/levels/level1.xml", mimeType = "application/octet-stream")] public var enemy_zones:Class;

 

I'd rather define level name in base class, that would be prepended with all assets names, ie.

 

var level_name : String;
level_name = "level1";

var base_path : String = "../../assets/";

LoadSomeResource( base_path + level_name + ".xml"); // pseudo-code
LoadOtherResource( base_path + level_name + "_path.txt");

 

I could to that with loaders, either Adobe or GreenSock flavours, but there's one thing that bothers me: how to create single .swf file that can be distributed without any references on directories. Embeds are good in that they automatically are embedded in the final swf.

 

Is there any system that takes all the dynamic assets you want and packages them to swf? Perhaps LoaderMax can perform such a feat? :) Sorry I'm new to flash platform, and my google fu didn't help with this

 

What I'm aiming at, is a flash Flixel game that can be distributed globally and sold to FGL. I heard it has to be delivered as a single swf file. Fair enough. Is going with Embeds the only way? I'm using latest FlashDevelop.

Link to comment
Share on other sites

Hi.

 

Yes, if the end goal is 1 single swf there will not be any benefit to using LoaderMax. LoaderMax only helps when loading assets external to the swf. From what I know, your method of using embeds is what you should be doing.

 

-c

Link to comment
Share on other sites

Ok so LoaderMax has nothing to do with embeds? Too bad. From my experiments I noticed that things like:

 


public static var base_path = "../../assets/";
[Embed(source = base_path + "mapCSV_Level1_Sky.csv", mimeType = "application/octet-stream")] public var skyCSV:Class;
[Embed(source = base_path + "mapCSV_Level1_Map.csv", mimeType = "application/octet-stream")] public var mapCSV:Class;

 

... are also not possible. I'm just looking for a way to make it a little more flexible and managable - so there's no hope? no secret trick, library or compile time switch...

 

I was also going to ask abour preloading, but found very nice articles: http://active.tutspl...ingle-swf-file/

and http://gamedev.micha...ame-tutorial-8/

 

Perhaps they will help someone.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...