Jump to content

  • Log In with Google      Sign In   
  • Create Account

The Code Zone Bargain Basement Blog

AS3 Controls

  Posted by , 12 July 2011 - - - - - - · 444 views

Still doing my mobile games here. One problem I ran into is with controls. My games aren't very control-heavy, but there are times that I do need to impart a little textual or columnar information to the user (i.e. help and high scores). And I'd really rather not roll my own. And this problem is compounded by Adobe's apparent abandonment of the control model for mobile Flash.

Mind you, the standard AS3 Flash/Flex controls render fine in mobile apps. Problem is, a lot of the controls are not at all finger-friendly. Some controls, like PushButtons, work fine. After all, clicking a button with a mouse and tapping a button with your finger is the same operation as long as you make the button large enough to accommodate a finger. Some operations though, like scrolling a text-field with a scrollbar, are frustrating. Adobe addressed this on Flex by releasing several finger-friendly controls. But unlike the previous releases of AS3 controls, they didn't keep parity with Flash. If you're using Flash with mobile, and you want controls, you're pretty-much on your own.

I have played around with a couple of the mobile-friendly Flash control sets out there, but none of 'em really set me on fire. Some looked good but looked more like Android than iOS. Some were built around an odd model that made it difficult for me to just say something easy like myTextField = new TextField().

And I understand that it'll take time. The AS3 controls that come with Flash are pretty danged robust and well documented, and you won't be able to duplicate all that functionality in the short term. But I did find this, which I think is pretty interesting. Rather than write new controls, the author just wrote subclasses for the touch-unfriendly controls and added touch-friendly events. So, for example, you can now have a TouchDataGrid object that's just the old standard DataGrid control, only the mouse events are overloaded so you can drag in it with your finger to scroll it around.

And that's great for me, because I don't wanna have to mess with controls. I'd much rather create a DataGrid and populate it with high score data than manage all the drawing myself. When I use standard controls, it's usually for stuff that I just want to implement and then ignore so I can work on the game. For example, Help.

Posted Image

Wow, a scrolling text field and an OK button. Don't wanna spend much time on that!

One thing you'll notice is the little scroll-elevator thing on the right side. On iOS and Android, that little scroll indicator only appears when things are actually scrolling. And I don't really like that. Dice-A-Rama actually got down-rated on iTunes because one reviewer stated that there are just a couple sentences of help without a detailed rundown of scoring. And that's not true. There's quite a lot of help and detailed scoring for each game, but you get the impression that there's just one screen because there's no indication that you're looking at a scrolling field and there's more to see. And I do realize that it's an OS sin to go against the One True Mobile Look, but I think it's an equal OS sin to hide from the user that there's more information to be seen. So I'll either leave the scroll indicator on or I'll add some "drag the danged screen to read more help" text.https://blogger.googleusercontent.com/tracker/5927544581291786949-1165397969220548693?l=thecodezone.blogspot.com


Happy Birthday Gamedev!

Posted by , 15 June 2011 - - - - - - · 437 views

In honor of Gamedev's 12th birthday, I'm gonna release the design document for my latest game, Dice-A-Rama. Basically it's a game I tried to write in ten days to address the lack of a Yatzy ("Yahtzee" is trademarked) game on the Playbook. Actually it ended up taking about 20 days because I was still building a lot of cross-platform stuff. On the good side, it's now available on the Playbook App Store here and on the iPhone App Store here.

Posted Image

The big ZYNGA logos are because it's a pad of free sticky-notes I got at a game conference a couple of years ago. Stickies and pencils are the only design tools you need.

And yeah, this is kind of a joke. But it does give you a bit of a feel for design. If you're a one-man shop and you have a simple design and you're confident in your ability to implement it, then don't spend much time on design. I wrote my first computer game almost 30 years ago, so design documents come second to getting an idea working while it's still fresh in your mind.

My bug-fixing process is the same. I am never more than two feet from a pad of stickies, and when I find ANYTHING, I quickly write it down. You'll be surprised how many ideas are lost between the time you switch from the game running on the screen back to your text editor.

BTW, "Kismet" is also trademarked, so I went with "Destino". "Kismet" is the Turkish word for "Fate", so I went with the Italian word for "Fate". Get it?

And I ended up dumping the three-column mode. Made the game too long and it also made the cells too small for dinky iPhone and Android screens.

Now with Google +1

  Posted by , 07 June 2011 - - - - - - · 294 views

Well I haven't had any substantial updates to the site since November. And that's both good and bad. It's good in that there haven't been any site emergencies in six months. We're nice and stable.

But it's not good in that there haven't been any other site updates of note.

But I haven't been sitting on my mini-empire of puzzles. Blackberry Playbook Bulldozer, Duck Tiles, and Pop Pies Portable (based on Pop Pies 3) are shipping. Brain Bones and an all-new game called Dice-A-Rama are also getting ready for release on Playbook, Android, and iOS.

As for this site, I've just added yet-again-still-another social networking widget, I have now added Google +1 buttons on all of thecodezone.com's pages! Excitement!

The way it works is simple. If you have a particular game you like (ConFusebox, for example), click the little Google "+1" button at the bottom. That way the page gets a little boost on Google's search results. This will hopefully drive a few more people to the site, giving me another dollar or two of ad revenue and financing more puzzles.

Big thanks for your support!https://blogger.googleusercontent.com/tracker/5927544581291786949-6176849538216127994?l=thecodezone.blogspot.com


Your AIR for Android app is open source - like it or not!

  Posted by , 11 May 2011 - - - - - - · 3,421 views

First off, I’m not posting this with the hopes of inviting malice. I’m posting this to inform you that anything you thought regarding code security in AIR for Android apps is probably illusory, and that you (and hopefully also Adobe) need to take some extra steps if you don’t want your assets stolen.

That being said, here’s how to take apart an AIR for Android app you’ve downloaded from the Android Market.
  • Get the free Astro file manager from the Android Market.
  • Run Astro.
  • From the app menu, choose “tools” and then “Application Manager/Backup”.
  • Choose any app you’ve installed on your Android device. You can choose any app you want, but AIR apps are particularly egregious in their lack of security.
  • The application will be copied from internal storage and will be copied to your backup folder (most likely on your SD card) as an APK file.
  • While still in Astro, navigate over to that backed up APK file and click on it. Choose “send to”, and send it to your desktop machine via email or Dropbox.
  • Now that the APK is on your desktop computer, rename the APK extension to ZIP and open it with your favorite ZIP-reading program.
  • In the “assets” folder within the ZIP, you should find a file with the extension SWF. Yes, this is the same SWF that was created with Flash/Flex. The AIR Android packager doesn’t do anything to the file at all. It just copies it into the right spot in the APK ZIP-file so the AIR runtime can run it.
  • Copy that SWF out of the ZIP file, and you’re done.
At this point, you can do whatever you want with it. You can download the Adobe AIR SDK and Android SDK, re-package the SWF into a new APK, and upload it to the Android Market under your own name. You can decompile the SWF with a tool like Sothink SWF Decompiler (which worked great on all the examples I tried), then change up the game enough to pretend it’s an entirely different game. You can put the SWF on your website. Or you can just browse through all the author’s source code and copy out his code/graphics/sound assets into your game!

Note that there are tools like secureSWF (which I reviewed here) that are very effective at munging ActionScript bytecode into something that can’t be meaningfully decompiled, but that would only prevent people from decompiling and/or reading and/or recompiling your source code into a new SWF. There’s still nothing preventing me from making a new APK out of your game's SWF.

also note that exactly ZERO of the AIR for Android apps I tried actually had obfuscated their bytecode with a third-party tool . A couple of you guys have atrocious naming conventions :)

Fact is, if you are going with Adobe and Android’s recommended sequence to make an AIR for Android APK file with the aim of putting your app on the market, you are essentially open-sourcing your app. Unless you go with some further security (and I don’t even know what further security you could implement beyond obfuscating bytecode), you are leaving your app wide open for IP theft.

And I’m not doing this with the aim of convincing every 13 year-old creep with a decompiler to start stealing apps and republishing ‘em under his own name. It’s more like discovering that every door-keypad at the Pentagon opened with the combination 1-2-3-4-5. Would publishing such information be inviting terrorism or would it be informing the Pentagon that their security is worthless and needs updating ASAP?

Also I’m posting this because I’m angry. And I’m angry because I brought this up during a Q&A at an Adobe conference when AIR was announced as “Apollo” in 2007. The Q&A went something like this:

Me: If your compiling step is just zipping up all of the web-app’s assets with an XML manifest file and some icons, what’s to prevent me from unzipping that file, making changes, and re-deploying it.

AIR guy: We’re planning some security stuff.

Turns out the “security stuff” was apparently their app signing process. And the ONLY thing that prevents me from doing is me making changes within the AIR file itself. I can’t open an AIR (or APK) file and make changes to the file itself, as the certificate file would no longer match file checksums for the AIR/APK file. I’m still free to open, decompile, read, write, update, steal, and rebuild the app under my own name.

They’ve had four years to fix this.

Finally, a note about the iPhone. While an iPhone IPA file is also a renamed ZIP and IPA files are also easy to retrieve, the contents of AIR for iOS files beyond icon PNG files and a manifest XML weren't in a readily decompile-able format. Looks like the Adobe AOT compiler really works.https://blogger.googleusercontent.com/tracker/5927544581291786949-3240684431859205391?l=thecodezone.blogspot.com


Good book deal

  Posted by , 22 March 2011 - - - - - - · 222 views

Good deal today. O'Reilly has several good titles today. The good deal part is that they're giving all proceeds (minus author royalties, I'm sure that's a contractual thing) to Japanese disaster relief.


Couple of good looking titles there. Although I don't know how good a book on Audacity can be. Audacity is REALLY easy to use. Anyway, browse and get a book for a good cause.https://blogger.googleusercontent.com/tracker/5927544581291786949-6222312749055616603?l=thecodezone.blogspot.com