Forum Multiplayer How to make my own TinyLoader?

Discussion and help relating to the PlayerIO Multiplayer API.

How to make my own TinyLoader?

Postby Vania » August 5th, 2010, 11:48 pm

I want to use GameFS for my game, but I dont want to put my whole game in there.
I want to keep it reasonable so I dont exceed the traffic of the Plus plan.

Specifically what I want to do is this:
Make something like a tinyLoader, but with the music included, and then load everything but the music from GameFS.
(since the mp3 is like 90% of my .swf size, and it will never change)

Could you guys share the code used to make a tinyLoader,
or at least give me some hints? Please.
Vania
 
Posts: 198
Joined: March 24th, 2010, 9:01 pm

Re: How to make my own TinyLoader?

Postby Benjaminsen » August 5th, 2010, 11:58 pm

TinyLoader make use of a small trick that allows us to unload an AVM1 VM from memory and load in the real file. Not something you would want for your game.

You could however just use the redirect url to load the actual game into your SWF. I can make an example if this sounds horrible complex.

/Chris
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: How to make my own TinyLoader?

Postby Vania » August 6th, 2010, 12:31 am

load an AVM1 VM from memory and load in the real file

Woosh!

Dont worry I think I got it. Browsed the web a little and this seems to be working:

Code: Select all
var url:String = "Main.swf"
var urlRequest:URLRequest = new URLRequest(url)
var loader:Loader = new Loader()
addChild(loader)
loader.load(urlRequest)
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loadComplete)   


Then I can just pass the music into the newly loaded swf.

Code: Select all
private function loadComplete(e:Event):void
{      
    Object(e.currentTarget.content).passMusic(gameMusic)
}
Vania
 
Posts: 198
Joined: March 24th, 2010, 9:01 pm


Return to Multiplayer