Monkey
Store
Community
Apps
Contact
Login or Signup

How to add Preloader to Monkey - Plz add this Mark

Monkey Programming Forums/Flash/How to add Preloader to Monkey - Plz add this Mark

therevills(Posted 1+ years ago) 
First we need to alter trans, open up src\trans\targets\flash.monkey.

Alter the Execute command (around line 72) so it looks like this:
Execute "mxmlc -static-link-runtime-shared-libraries=true -frame=MonkeyGame,MonkeyGame Preloader.as"

And the FLASH_PLAYER execute (76):
Execute FLASH_PLAYER+" ~q"+RealPath( "Preloader.swf" )+"~q",False

Compile trans, then move the exe to the bin folder.

Now go into the folder targets\flash and create the Preloader.as:


Alter the MonkeyGame.html embed line to look like this:
<embed src="Preloader.swf" type="application/x-shockwave-flash" width="640" height="480" wmode="direct">


Alter MonkeyGame.as, add the following line after [SWF(width="640",height="480")]:
[Frame(factoryClass="Preloader")]


Then compile your game... hopefully you will have a loading bar. Play around with the Preloader.as.

Test:
http://www.therevillsgames.com/monkey/flash/MonkeyGame.html