Adding MochiMedia to Monkey Game

Monkey Targets Forums/Flash/Adding MochiMedia to Monkey Game

Wagenheimer(Posted 2011) [#1]
Anybody here had any success on adding Mochimedia to a Monkey Game?

I'm trying to use Live Updates of Mochi on my game and it is really not working! The "Mochi Loading" shows, but the game does not works after this.

https://www.mochimedia.com/developers/liveupdates.html

Anybody here had any success with this?


Wagenheimer(Posted 2011) [#2]
Well... It is working now! Rabbit Jump is available for Free-Play here.

http://www.wagenheimer.com/rabbitjump/

The var _mochiads_game_id:String = "" should be added to public function MonkeyGame()


Hima(Posted 2011) [#3]
Congratulations!
Do you mind writing a tutorial on how to achieve this? I'm sure many people would appreciate it! :)


degac(Posted 2011) [#4]
+1 for tutorial!

It will be a GREAT thing!


JD0(Posted 2011) [#5]
If all you want to do is add live updates to a game then you just need to add the variable that Wagenheimer listed above, and pack it up on the Mochimedia website.

No need for a tutorial on that!

Did a few things with Mochimedia in a game I released awhile ago here that I created when first learning Monkey:
http://www.mochimedia.com/games/balloon-popping-frenzy/

With high scores, link tracking etc by Mochi.. any specific problems you guys are having with Mochi?


Hima(Posted 2011) [#6]
Highscores, ads and microtransaction would be awesome and highly appreciated!


JD0(Posted 2011) [#7]
Well, I haven't implemented microtransactions, but ads are fairly easy.

Just use their encryption tool to package your game, and there you have it.

You will need to make a wrapper as the constructors don't work (unless this is fixed in a recent Monkey update -- have not been using Flash w/Monkey for some time) to add those other features. Just wrap up the functions you want to use in Actionscript. It is extremely basic AS programming.


Aman(Posted 2011) [#8]
I am trying to add mochi ads to my game.
I tried their encryption tool. It breaks the game. After I click Play Game, a box with "download the latest version of flash" shows up.

Do you guys have any idea how to implement it into the .as file?


York(Posted 2011) [#9]
Hey a little quesion.

I also want to use the Preloader and I added the "_mochiads_game_id" to my public Monkey function. The preloader shows a pre ad and after building it works.

So far so good, but it was not approved by mochimedia, because

The ad is scaled. Ad sizes should not be modified and should be shown in their original size. 


I am also using 320*480 as resolution.

How did you use the preloader with the ads?


Aman(Posted 2011) [#10]
What is your test page? is it a webpage containing the swf file or is it the swf file itself?


York(Posted 2011) [#11]
So now it should be work with MochiMedia. My problem was the size of the swf file.


DerHase(Posted 2011) [#12]
I am done with my game now. But somehow I am to stupid to set the Mochi live update the add and the score. I can not figure out, in which files I should put which code. I would be happy if someone could explain it.


JD0(Posted 2012) [#13]
@york 320x480 is a very uncommon resolution for flash games, try 550x400 or 640x480. You'll need to check with Mochi to do it.

@derhase I'll look for my implementation - it's hiding somewhere I haven't looked at in 8 months or so. The thing is I did nearly all of it in ActionScript and the only part I just created a few methods in a Monkey module to start the ads, send the scores, show/hide the login. So I'm not sure how good it would be for people that don't understand how to work with ActionScript.

MochiMedia's got literally 50+ ActionScript examples right in the documentation when you download the API.

I just copied the same pattern of the modules that come with Monkey.


JD0(Posted 2012) [#14]
Added the code I used in the code forum at http://monkeycoder.co.nz/Community/posts.php?topic=2264 to add mochi high scores, logins and stuff.


Farflame(Posted 2012) [#15]
I'm not sure how get the ads to work. I've downloaded the Mochi folder, put that into the same root as my game, but I'm not sure where I'm supposed to add the Pre-Game code. Is this something that can just be pasted into the SWF file or somewhere? If so, where do I put it?


skid(Posted 2012) [#16]
The tutorial says it goes in your project's flash build folder.


Farflame(Posted 2012) [#17]
I think I've got everything sorted now except this final step. I've put the folder into the correct folder (I assume so at least, it just goes into the flash folder), but there's a one-line piece of code that needs to be added somewhere and I'm not sure which file to add it to, nor where to add it in the file.

This is what it says on the Mochi page.

Choose the type of ad you want to show and paste the following code into your .fla. We recommend creating an empty frame before your game for the pre-game style or in-between levels for the inter-level style. When the ad begins, it will call stop() and when the ad completes it will call play().

I assume .fla is the same as the .swf? The problem comes with the empty frame talk, because I think this is aimed at Actionscript users. It's just a single line of code, but I'm not sure what to do with it. I've tried adding it to the start of the .swf but nothing happened. I assume it goes in there somewhere but the contents of that file are all Greek to me.


Psychosanity(Posted 2012) [#18]
I'm having the same problem Aman is/was having, i can't get the Download the latest flash message to go away after the live update upload.

If Anyone can help me fix this, that would be phenomenal. I can't figure out the problem, and this mochi thing is very important to me


Farflame(Posted 2012) [#19]
I'm still in the same boat. Frankly, I can't get anything to work at all. I've followed the instructions several times, to the letter, but I don't get anything showing at all. I'm not sure if there's some extra step required in Monkey that I don't know about. I honestly know absolutely nothing about ActionScript etc, so I may be missing something really obvious.

It would be nice if somebody could talk us through the process, or if they just followed the instructions at Mochi and it worked first time, why I'm not seeing anything whatsoever?

Same as you, I'd really like to get Mochi working. I don't have any good games running at the mo, but I'm working on one and it'd be nice to generate a bit of revenue from it, even though I'm aware people don't earn much.


NotSure(Posted 2012) [#20]
Just to use live updates is really easy. I never had a problem.

1.) create your game using monkey => target FLASH

2.) go into the monkey flash build foder and edit MonkeyGame.as as described on the bottom

3.) add a new game @ mochi, this will create a new game-id

4.) add this game-id to your MonkeyGame.as as described on the bottom and save it

5.) in monkey do a build and run again

6.) take the new MonkeyGame.swf and upload it using live updates ... done


where to add the id in MonkeyGame.as

public class MonkeyGame extends Sprite{
	
		public var runner:Function;
		private var _mochiads_game_id:String = "your mochi game-id here";
		
		public function MonkeyGame(){
		
			game=this;
			addEventListener( Event.ADDED_TO_STAGE,onAddedToStage );
		}


Examples:
http://kstadler.ch/se/flash.html

http://kstadler.ch/nd/flash.html


Psychosanity(Posted 2012) [#21]
Thanks Notsure, but already did those steps. The game breaks when uploaded into live updates and no longer plays. I'm not sure why, I am using diddy as well if that matters


siread(Posted 2012) [#22]
where to add the id in MonkeyGame.as


You don't even need to edit the .as file, you can just add the line in Main()...

Function Main()
	Local _mochiads_game_id:String = "xxxxxxxxxxxxxxxx"
	
	maingame = New GameEngine
End



Farflame(Posted 2012) [#23]
I think Siread's solution works. Something's happening with my game now, there's a loading bar but then I keep getting a 'Download the latest Flash Player' message, and no matter how many times I download and install it, it keeps doing the same thing and will go no further.

Still, this is probably an issue with Mochi or Flash or something and might resolve itself. At least I think my uploaded game might have the ads installed now, although it's hard to tell at the mo - I'll wait to see if they approve it.

The ads are now showing, so I think everything is looking fine, so thanks for the help guys. I'm still getting the flash message but it's probably something to do with my PC not realising that it's already updated.


Farflame(Posted 2012) [#24]
Still getting the same problem as above, and when other people try my link, they're also getting the same error. It's currently at http://www.soccerstar.org.uk/survivors/MonkeyGame.swf - if you try it, you see the Mochi loading bar, then the install message described above. Anyone had this problem or have any idea how I can resolve it?


Farflame(Posted 2012) [#25]
This is the same problem that Psycho and Aman had above I see. If Aman is reading this, did you ever get past that 'Download the Latest Flash Player' message?


Psychosanity(Posted 2012) [#26]
Ok, i had a friend fix the problem for me. It's now up and running on my website WITH live updates working.

The explanation he gave me was

"I just encapsulate into a new valid Flash 11.0 file the no freeloader version.
It look like Monkey don't export in 100% on the right format and FlashPlayer crash with the mochi live update."

So if that helps anyone else


Farflame(Posted 2012) [#27]
Hmm, well it's good that there's a solution, but I don't understand your explanation. How did he 'encapsulate into a new valid Flash 11.0 file'? Could you get him to give a more detailed explanation of how he did this, as I'm still having this problem.


Farflame(Posted 2012) [#28]
I think the problem is that Monkey is attempting to compile to a version of Flash higher than 11.1, but the latest Flash download is only 11.1? How can I make Flash compile to 11.0? I've used Flex 4.0 but the same problem.