Monkey And Flash?

Community Forums/Monkey Talk/Monkey And Flash?

MGE(Posted 2011) [#1]
Could someone explain how Monkey -> Flash works? I havn't seen a flow chart how it gets compiled, etc, etc. Thanks.


Perturbatio(Posted 2011) [#2]
1. Install monkey
2. Install flex sdk
3. ensure sdk path is in config
4. add monkey path to flash player's authorised paths list
5. write code
6. select flash target
7. press compile and build
8. play game



BlitzSupport(Posted 2011) [#3]
You install the free Adobe Flex SDK (see Getting Started docs for details) and select Flash as target -- that's pretty much it. Monkey translates to .as and does all the tricky stuff with the SDK for you... you just end up with a Flash game.


slenkar(Posted 2011) [#4]
is there a way of embedding pics and sounds into a flash swf?


MGE(Posted 2011) [#5]
ok...now my interest is peaked. Thx.


slenkar(Posted 2011) [#6]
the flex sdk comes as a zip file right? so you can install it anywhere?

when you say 'ensure sdk path is in config' do you mean monkey's config?


'add monkey path to flash player's authorised paths list' - how?


wmaass(Posted 2011) [#7]
slenkar,

I unzipped the sdk and put the folder in my c:\ drive

c:\flex_sdk_4.1.0.16076

The default settings on the monkey config.winnt.txt works with this out of the box.

Also, you should add your monkey folder to the authorized paths, use the tool below:

http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html


slenkar(Posted 2011) [#8]
thanks for the help


Grey Alien(Posted 2011) [#9]
I have the Adobe CS5 Suite which includes Flash Builder 4 so I'm guessing I shouldn't need to install the SDK right? Anyone know what path I point at in Monkey? Thx.


BlitzSupport(Posted 2011) [#10]
Don't know if it'll work with anything other than Flex SDK, but Monkey is looking for:

[your path]\FlexSDK\bin\mxmlc.exe


... and the config file is pointed to:

[your path]\FlexSDK\


... so if you have a \bin\mxmlc.exe in there somewhere, point it one folder up and see if it works!


xlsior(Posted 2011) [#11]
is there a way of embedding pics and sounds into a flash swf?


Not yet, it seems.

By default it uses external data, for which the local folder need to be explicitly authorized in the flash config tool... Mark responded to this on th eMonkey forum with:
Apparently, building data into the app fixes this, which I plan to do one day soon.


so it sounds like it doesn't currently support this, but that Mark is looking into it.


Grey Alien(Posted 2011) [#12]
@BlitzSupport: OK thanks for that!


slenkar(Posted 2011) [#13]
so it sounds like it doesn't currently support this, but that Mark is looking into it.



thanks, sounds interesting


CGV(Posted 2011) [#14]
so it sounds like it doesn't currently support this, but that Mark is looking into it.

I hope it's really soon because as Monkey now stands it's worthless to commercial flash game developers.

You can count on one hand the number of flash portals that will accept multiple file flash games.

Last edited 2011


Warner(Posted 2011) [#15]
If your game contains not too large images, isn't it possible to include the data directly into the source? Somewhat like:
pixels = [0,1,1,1,1,1,0,
          1,0,0,0,0,0,1,
          1,0,0,0,0,0,1,
          1,0,0,0,0,0,1,
          1,0,0,0,0,0,1,
          0,1,1,1,1,1,0]

If Monkey has zlib support, you could even compress your images first, and then unpack them before writing them into the pixmap.


CGV(Posted 2011) [#16]
Flash/Flex has an EMBED command for embedding media assets into the final swf.

It's just a matter of Mark implementing it in Monkey but it really should have been done from the outset.


Grey Alien(Posted 2011) [#17]
I stopped embedding images in code when I stopped using Assembly on the Amiga and moved to Blitz Basic 2. I don't plan to do it again.

We really need asset embedding in Flash for it to be properly useful.


MGE(Posted 2011) [#18]
"Flash/Flex has an EMBED command for embedding media assets into the final swf.

It's just a matter of Mark implementing it in Monkey but it really should have been done from the outset. "

Thanks, Monkey is useless for me until this is resolved.


slenkar(Posted 2011) [#19]
dunno if its possible to embed stuff without the official flash IDE,

if monkey can compile to haxe it could embed assets with a utility called samhaxe, i have used it sucessfully before.


Warner(Posted 2011) [#20]
Can you import .as files? Then you could maybe place the EMBED tag in there.

Last edited 2011


Canardian(Posted 2011) [#21]
Yeah, you can directly import any language it supports into Monkey. Currently it supports the following languages:
1) C++ (.cpp) [native app for Windows, Linux, MacOSX, iOS]
2) ActionScript (.as) [Flash]
3) JavaScript (.js) [HTML5]
4) Java (.java) [Android]
5) Monkey (.monkey)
6) C# (.cs) [XNA, Windows 7 Phone]

Last edited 2011


CGV(Posted 2011) [#22]
dunno if its possible to embed stuff without the official flash IDE

You only need the Flash IDE to embed wav files, everything else can be embedded through Flex.


MGE(Posted 2011) [#23]
CGV is correct. :) But you can embed .mp3 files (certain rates), .png, and pretty much anything else.


Warner(Posted 2011) [#24]
On a side note: if you are using Flash with sounds: the sound engine shuts down on some platforms when it is not in use. When a new sound is played, it takes a while for it to start up again, resulting in a huge latency.
The way to avoid this is either using looping background music, or playing an empty sample continuously.


wmaass(Posted 2011) [#25]
Great tip Warner, thanks for that.


Chroma(Posted 2011) [#26]
Got Flash working...that was a cinch. Be sure to set a default program for .swf files. (your favorite flash capable browser)

Last edited 2011


CGV(Posted 2011) [#27]
The standalone debug player would be better: click

The one called "Projector content debugger"


Brucey(Posted 2011) [#28]
The standalone debug player would be better

There are a bunch of them shipped with the Flex SDK...


Brucey(Posted 2011) [#29]
Monkey and Flash : An interesting combination

;-)


Chroma(Posted 2011) [#30]
Yeah I really like it. And I like the simple SetUpdateRate 60 command. It takes all the pain out of timing code. You just set it and go. Thanks Mark.

My only problem now is physics. I was using Chipmunk for my latest creation via your mod Brucey, but now I'm not sure what to do. Is there a way to get Chipmunk into Monkey? (ChipMonk!) Beaker made a cool physics thing over at MonkeyCoder but I don't know if the source is available.

Last edited 2011


CGV(Posted 2011) [#31]
I just read over at the indiegamer forum that Mark has added asset embedding to Monkey.

Can anyone verify that?

I can't find any mention of it over at the Monkey site.


Volker(Posted 2011) [#32]
Yes, with V32 a .swf is created with all data in it.


Big&(Posted 2011) [#33]
Yeah, it looks like it makes a single .SWF file with everything in it. I didn't know that had been implemented either.


CGV(Posted 2011) [#34]
Excellent news! Thanks.


BlitzSupport(Posted 2011) [#35]
Hmm, Mark mentioned it as the first item in the release announcement:

http://www.monkeycoder.co.nz/Community/posts.php?topic=385

Anyway, definitely a welcome change.