:::: MENU ::::

What to do when Flashbuilder forgets how to debug Flash Pro files!

After finally getting FlashBuilder to successfully edit and debug Flash Professional projects I was feeling quite triumphant, not to mention ecstatic that I could get all the nice bells and whistles of the Flashbuilder debugger while publishing to Flash Pro! All was good for about three days, and then, in standard fashion, Flashbuilder just forgot how to debug my files and refused to open them in anything but Flash Pro! This was completely out of the blue. I published once and Flashbuilder played nicely, launched the debugger, and let me inspect my properties. I launch again, and it opens the file in Flash Pro with no debugging!!!

After a few minutes of banging my head into the nearest table top, I took a deep breath, counted to 10, rebooted my computer, and said a little prayer. Unfortunately, Flashbuilder was still hosed after the reboot. I then asked the Googs for some help. Not much luck their either. Finally, I decided to pull a hail-mary and open up Flashbuilder preferences. Here I finally had some success!

What happened: Flashbuilder lost track of where to the Flash Debug Player lives.

How to Fix it: Open FlashBuilder Preferences -> Flash Builder -> Debug and look for the input for “Standalone Adobe Flash Player (debug version)”. Click on browse, then browse your standalone Flash Player Debugger. Click ok, and run debug on your project! That should fix the issue (at least it did for me).

If you don’t have the standalone Flash Player Debugger installed, you can download it from Adobes site and unpackage it anywhere on your machine, then just point at the file and you’re good to go (hopefully).


Building Robotlegs SWC Using Maven – Failed to launch Flash Player

First, a little backstory on how I got to this error in the first place (bear with me). I recently start a project using Robotlegs 2.0.0. Since this version was just released, a lot of the extensions are still being ported over. In my case, I had need of the RelaxedEventMap extension, which I had used heavily with RL1. Thankfully, CReynders was kind enough to port the existing RL1 source over to an RL2 extension; however, porting the extension also required a few minor tweaks to the RL framework source. What this meant to me is that if I wanted to use the RelaxedEventMap extension, I would need to download the latest Robotlegs source from GitHub which contained the previously mentioned tweaks (i.e. I could no longer use the latest compiled version of the RL2 SWC). I didn’t assume this would be a big deal, that is, until I tried to compile my application using Flash Pro. The compile-time went from about 2 seconds using the compiled RL2 SWC, to upwards of 30 seconds when including the RL2 framework source. All this led me down the path of compiling the RL2 SWC myself for the first time (see, I told you’d I’d get to the point eventually!).

Continue Reading


PhoneGap Android Errors – ANDROID_BIN=”${ANDROID_BIN:=$( which android )}” – GeekGoneNomad

While trying to get PhoneGap setup, I ran into an issue when creating a test android project. I was trying to run the following command to create my android project:

When I ran this command I immediately received an error:

After checking my .bash_profile paths, and a bunch of digging, I finally found the cause of the issue. If you open up the create file (phonegap-2.4.0/lib/android/bin/create), there is a line that lists ANDROID_BIN=”${ANDROID_BIN:=$( which android )}”. The “which android” is the cause of the issue (or at least it seemed to be in my case). If you replace this line with the full path to your android tools (as listed below) it should resolve the issue. My final line looked like this:

There is also another solution that has seemed to work for many people and is (in my opinion) a better and less obtrusive one than what I outlined above. That being said, this next fix did not work for me. If it works for you, I’d suggest you use it, and use the first fix as a fallback in case it does not work for you.

The second fix is to add the Android SDK to your Path environment variables. You can find detailed instructions on how to setup these environment variables for both Windows and Mac OSX in the PhoneGap documentation under sections 3A and 3B.


AS3 Regular Expression Global Flag

I’ve been playing around with using Regular Expressions in AS3 using the RegExp class, and recently ran into an issue where only a single result was being returned when running my regex against a string that should have contained multiple results.

To give a bit more detail, I was trying to parse all of the tags out of an HTML document. I went about doing this by using the match() method of the String class, which returns an Array containing all the matches found in the given String. The basic code was as follows:

As noted in my comment, this would always return an Array containing only one result (even though I could see multiple matches in the string).

The Solution:
The reason my search was only returning a single result was that I did not include the global flag in my RegExp. The reason I did include it is that I had never heard of it. For those of you that have also not heard of it: “When the g (global) flag is not included, a regular expression matches no more than one match.” Luckily, its’ implementation is quite simple. All you need to do is include “g” at the end of your expression.

So to update my original code to include all matches:

There are also some additional flags that you can include in your Regular Expressions, you can read about them all here: http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7ea7.html


AS3 – Removing Elements While Iterating Over an Array

I recently ran into an issue where I had a foreach loop iterating over an ArrayCollection of objects. Inside the loop, I was doing a simple check to see if the current object contained a matching property, if it did, I then removed it from the collection. I soon realized that the number of elements being removed didn’t quite match up to what I would have expected. The cause was quite simple: When removing items from a collection, you update the length of that collection, which in-turn breaks your iteration. This seemed like a very common problem (which I found to be true after a bit of googling), and luckily there are a number of ways to solve this. The very simple solution which I ended up implementing is as follows:

The Solution:
Instead of using a foreach loop, I switched to using a for loop. I then iterate over the collection backwards so that any updates to its’ length have no effect on the iteration.

That’s all there is to it. It’s quite simply when you stop to think about it, but when banging out code at the speed of light, who has time to think.. ;-)


FlashBuilder 4.6 Broken Workspace FIX

I’ve been running into a plaguing issue lately with FlashBuilder 4.6, and that is that every few days/weeks/other random increment of time, my workspace will become corrupt, and I will no longer be able to open it. The signifier (for me) of a corrupt workspace is generally that FlashBuilder freezes while I am in the middle of coding some (usually extremely important and time-sensitive update), then when I try to restart the application it hangs on the “Loading Workbench” portion of the startup sequence. Thankfully, I found THIS post written by Valentin Romonov which outlines a fix for the problem that doesn’t involve deleting the entire .metadata folder of the workspace (which then forces you to reset up all preferences, ties to version control systems, layouts, etc.).

The fix is quite simple: go into your project directory, and locate a file called .snap which is listed under the following path on Mac OSX: .metadata/.plugins/org.eclipse.core.resources Once you have deleted this file, simply restart FlashBuilder and you should be good to go! *Note that you will need to turn on hidden files in order to see the .metadata folder, instructions on how to do that can be found HERE.

A big thanks to Valentin Romonov for blogging about this fix, it has saved me a LOT of time and frustration!


Debugging Flash/Flex Apps in Google Chrome (and killing the cache)

Since switching over to Google Chrome as my default browse some months back, I have had one persistent (see also annoying) issue: I have been unable to get the Flash Debugger to run properly in Chrome. I initially tried a number of fixes, none of which seemed to resolve the issue. Eventually, I gave up, and simply started using FireFox for debugging. Fast-forward a few months, and I am now ready to bail on FireFox due to memory usage issues (my Macbook AIR has almost gone up in smoke a few times thanks to these lil problems). To add to the fire, I have also been dealing with the HUGELY bothersome (and very common) issue of the browser caching my .swf files while I am debugging (i.e. I run debug, and the file displayed is a cached version, so I end up trying to resolve bugs that may not even exist anymore). So this morning, sitting in a cafe in Little Italy (San Diego), listening to the rain falling softly on the concrete outside, I decided it was high time I tackle theses issues. Luckily for me (and you), the solutions came quickly, and I now have Google Chrome debugging my flash builds, and running the latest build every time no less!

Debugging in Chrome:

Aaron West wrote a nice blog post outlining the how to make sure Google Chrome is using the debug version of the flash player here: http://www.aaronwest.net/blog/index.cfm/2010/4/27/Configuring-Chrome-with-Flash-Player-Debugger . Aaron did a very nice job of explaining the changes necessary to make force Chrome to use the debug player, so I will not reiterate them here; however, I will add one thing (which turned out to be the missing link for me): In order to find the correct Flash plugin to disable, you may first need to click the “Details” link in the upper right-hand corner of the screen. Doing this will expand the list of plugins (in my case, there were 2) and allow you to disable the correct one.

Plug ins

 

 

 

 

 

 

 

 

 

 

 

 

Disabling Caching:

I saw a number of fixes for the caching issue, some of them better than others, but none quite as elegant as I would hope (i.e. a setting in Chrome to simple disable caching). Then I came across a blog post by Andre Gil’s (sorry for the spelling, I don’t know how to make the fancy accent over the e), which outlined a very nice solution in which Andre had written a small application that essentially gives you the option to launch Google Chrome with the cache disabled. You can get the app, and read about its’ use in the section titled “Cache Problems” of the following post: http://blog.somepixels.net/2010/05/how-to-develop-and-debug-flex-on-google-chrome/

 

That’s all folks. Now get back to work, and happy debugging!

 

**Update**

I am still having some issues with caching. Currently, I have found that I most often have to do a hard-refresh in Chrome in order to force it to load the latest build of the .swf. I will be working on finding a solution for this and will update once I have it!


Listening for events in a (Flex) Spark Itemrenderer

I recently ran into an issue where I was creating a custom itemrender in Flashbuilder (Flex) which contained a button. I wanted to listen for the button’s Click event and have an event handler within the itemrenderer respond to it. Sounds simple enough; however it did not work.. AT ALL! After a bit of fumbling around, and a whooooole lot of Googling, I found the problem AND (more importantly) the solution!

What was happening was this: When the button inside of my itemrenderer was clicked, the itemrenderer itself was receiving the click event first, and after notifying the parent list that it had been clicked, some updating took place in the list and all further events were killed (including my button’s click event). I’m sure there are way more technical ways to explain exactly what was occurring; however, I’m lazy, and I have a rather simple fix which works just fine for my purposes, so I’ll spare you the tech jargon and smart talk for now..

THE FIX:
Instead of listening for the buttons MouseEvent.CLICK event, I instead listen for MouseEvent.MouseDown. That’s it (told you it was simple). Apparently, the MouseDown event is triggered before the click event (which actually makes quite a bit of sense), and as such, you are able to capture it before the itemrenderer swoops in and steals all the glory (and the events)!

THE GOTCHA:
It’s important to note, in the MouseDown event handler inside of your itemrenderer, you MUST call event.stopImmediatePropogation() on the event that gets passed into the handler method. Failing to do so will allow the event to bubble up the chain and once again give the itemrenderer a chance to steal the show. Calling event.stopImmediatePropogation() will stop the event dead in its’ tracks, and give you a chance to apply any logic you might have in your event handler (I’m assuming there is actually a reason you want to capture the event, other than making it your bitch..).

EXAMPLE ITEMRENDERER:


Byron Bay – Australia

IMG 3633

This afternoon I caught a ride with the Oz Experience bus to get from Spot X to Byron Bay (about 2 hours away). Pretty much everyone on the bus fell asleep within minutes of our departure (apparently everyone had a late one the night before) except for the driver (a cool Aussie chic), a Scottish lad named Michael, and myself. We all congregated in the front of the bus, and took turns swapping stories and expanding each others musical horizons via our iPods. The pleasant company made the ride go very quickly and we arrived in Byron around 6:30PM. Our driver was kind enough to supply me with an Oz Experience VIP wrist band, which gave me access to the Oz Experience table at “Cheeky Monkeys” (an infamous bar and restaurant in Byron Bay) , and would prove quite useful in the days to come. I grabbed my bags and made plans to meet up with Michael (my new Scottish friend), and his buddy Steve at Cheeky Monkeys for dinner and beers a bit later that evening. As it turns out, we all ended up at the same hostel (Nomads Byron Bay), and even ended up in the same room that night, which made everything a bit easier.

After dropping our bags and cleaning up a bit, we ventured out for our first taste of the famed Cheeky Monkeys. When we arrived at the bar, the place was pretty much empty, save the table full of people from the Oz Experience. We grabbed a seat with our (their) fellow bus-mates, where we were immediately greeted with free jugs of beer. Apparently the Oz Experience table (in return for showing up early enough for dinner) received from jugs of beer for the table until around 9PM. It was around this time that I noticed I was surrounded by maple leaves, and people decorated in Canadian flags. It was Canada Day! To show support for our little brother to the North, I dawned some sporty Canadian flag sunglasses (which were provided by our waitress). The beer began to flow, and things proceeded to get a bit rowdy. It was around this time that the host announced that they were going to have a contest for a free skydive. The game: “heads or tails.” The premise was simple: Each contestant would place their hands on either their head, or their “tail,” the host would then flip a coin, and if you had guessed incorrectly, you were asked to remove a piece of clothing (or optionally bow out of the competition). As no Canadians volunteered for the game, the host asked if any American (who he referred to as Canada’s big brother) would represent them. Before I really had a chance to think about it, my hand shot up and joined the other contestants on stage. When in Rome.. After a few rounds, I was standing strong, and hadn’t lost a single article of clothing. The poor bastard next to me was down to his boxers, which he then lost, and was forced to ask the audience if someone could lend him their hat so that he could cover his junk and continue on (as a legal matter you were not allowed to get nude below the waist). The game continued; however, my good fortune did not. A few more rounds found me in nothing but my boxers (and some Canadian flag stickers covering my nipples, I thought this a nice touch). I was one of the last three competitors when I finally lost  my boxers (no one would borrow me a hat, not that I blame them), so I was forced to bow out of the competition with my underwear (say nothing for my dignity) intact. When all was said and done a cute (and topless) girl, unsurprisingly was declared the winner. After the competition was over, the host announced that the restaurant was now closed and the club was now open. This meant that it was time for everyone to drink up and start dancing on the tables, this is what Cheeky Monkeys is famous for. As the story goes, the owner (sick of going to bars where dancing on the tables was frowned upon) opened the bar with the specific goal of making dancing on table tops its’ main attraction. He added diamond plate and other reinforcements to the tables, and the legend was born. We danced until late into the evening, then stopped by a local bakery (which was highly recommended by our bus driver, and is open 23 hours a day) sample a “Paris Brest” (also recommended by our driver). As we found out, the Paris Brest has a thing layer of pastry on the bottom, a ridiculously thick layer of custard in the middle, and is topped off with chocolate and a cherry, It was insanely rich, but really good!

The next morning was, needless to say, a bit rough. I wandered around town for a bit and found some breakfast, before returning to the hostel. I was asked to move rooms since there was an error with my reservation (a task that I would need to repeat again before the work was through). Later on, I joined the guys, and a bunch of other people from the hostel, for a game of beach volleyball, and spent the rest of the afternoon lounging at the beach and enjoying the sunshine (this was after all the first time I’d seen sun and warmth in a few weeks). We returned to Cheeky Monkeys for dinner and drinks that evening, though I called it a night much earlier than the night before.

IMG 3616

Sunday morning. I got up early and met up with the Scots to take a tour bus out to Nimban.  Nimban is an old hippie town that was originally founded to host the first jazz festival in New South Wales back in the 60’s. After the festival, the hippies never left, and the town that remains is known for being very “pot friendly” if not “pot pushy.”  It’s one of those places you just have to visit to experience (even if you’re not after any elicit goods, it’s still a fun trip). We started our day with a winding journey through country roads, listening to classic rock and Bob Marley blaring through the stereo (this would continue for the entire trip). 2 hours of driving found us in Nimban. As we soon discovered, the town is not much more than a single street about 2 blocks in length, littered with shops selling hemp goods of all kinds, a “hemp museum,” (which displays a history of the marijuana movement in the states, as well as that of the town), and various cafes and coffee shops. While walking down the street, you are often approached by various characters selling “cookies” and “weed.” Before departing our bus, the driver gave a lengthy speech warning about the strength and effects of these cookies, and shared some stories of past passengers who did not head his warning. One such story included a 21 year old Israeli who was ex-military (aka a hard ass). He consumed three cookies (the recommendation is no more than one half) and ended up spending the four hour return trip at the front of the bus crying his eyes out because he was convinced that the rest of the passengers were Pakistani and were going to kill him. Needless to say most people proceeded with caution. We spent an hour (more than enough time) walking around town and grabbing a bit of lunch, then returned to the bus for our return trip. We stopped for a picnic on the way back, and with 2 hours having past, it started to become quite apparent who had indulged in Nimban, and who had not. After our picnic we took a short walk to a nearby waterfall, then all piled back onto the bus for another 2 hours of rock and reggae. Upon returning to town, we all decided that a night off from Cheeky Monkeys was probably a good idea, so we opted to head to the Cinema and check out Transformers 3. One of the Scottish lads slept through the entire movie (you can probably guess why)…

IMG 3635

Having celebrated Canada Day a few days before, it was now time to celebrate a “real” holiday (I kid): The 4th of July! I rallied the troops and spent the entire day hanging out at the beach. In the evening we went to Cheeky Monkeys, where they had Jim Beam on special in honor of us whiskey chugging Americans. Needless to say it was a good night.

IMG 3641

Over the course of the next few days, I spent a bit more time exploring Byron Bay. I walked along the beach, and through the parks and coastal forests to visit the Lighthouse. I watched the surfers riding huge waves off of what can only be described as one of the most perfect surf spots I have ever seen. I visited various restaurants and cafe’s, and generally just kicked back and took it all in. Along the way, I met Dean: a fellow American, who (as luck would have it) was also traveling to Cairns on the same flight as I was.  After a full week in Byron Bay, I made my way to the airport (joined by my new friend) and caught my flight North to Carins, where I would soon learn to breathe underwater.


Spot X Surf Camp – Australia

 

What a morning! After having a rather anxious dream about missing a flight, I woke up startled. It was 6:10AM and I had 5 minutes to pack my bag, check out of my hostel, and run 6 blocks to the neighboring hostel where I was scheduled to meet up with the Mojorsurf team and begin my surf adventure. I flipped on the light (which my dorm-mates thankfully were very understanding about), and, not having enough time to think about things such as dignity, proceeded to strip down and give them quite an eyeful while trying to manage to get my pants on (still half awake and quite unbalanced). After successfully managing to clothe myself, I forced all of my belongings (“all” being a hopeful term) into my pack, grabbed my food bags out of the kitchen, and pausing only momentarily to drop my key at the front desk, took off in a full sprint down the street and through central station, arriving at Wake Up Sydney to the beautiful site of the Mojosurf bus!

I was immediately greeted by Nat: a scruffy guy with shaggy, dirty-blonde hair, and a very warm personality. Nat is the founder of Mojosurf, and would also be our bus driver for most of the day. After everyone was on-board, we fired up the bus, cranked some Bob Marley, and began our trip up the coast from Sydney up Spot X. About an hour into our trip, we made a quick breakfast stop, and upon returning to the road, watched “Endless Summer 2” to set the mood for the week to come. Upon arriving at Spot X, we threw our bags in the common room, and immediately grabbed some boards and headed out to the surf. The wind was cold, the water was warm, and the sun was shining, overall a good day to surf! The waves were quite small, but it was actually kind of perfect for a bunch of beginners. We spent the next two hours trying our best to catch some waves, most often failing miserably. The few waves that we did catch though were enough to keep us pumped up and pushing forward, a truly exhilarating feeling! After surfing, we returned to camp, cold, hungry, and generally exhausted. After dinner and a few beers with new friends (and failing to get a fire going), we called it a night.

Our second day greeted us with clouds, rain, wind, and generally anything that would make one feel cold when wet. We got up at 8 for breakfast, and were in our wetties and on the beach by 9. After a quick warm up, we plunged into the surf to take our second try and surfing. I had pinched a nerve in my back on day one, so I found it a bit frustrating (see also painful) trying to get up on my board. Each time I’d try to jump up, my back would pinch, my legs would go limp, and I would fall off the board. This didn’t exactly encourage the learning process, but I did my best to push through. By the time we finished our morning session we were all freezing and exhausted. We returned to camp, grabbed a quick shower, then collapsed and slept for the next hour until lunch. Lunch was good, but didn’t seem to quite give us the energy boost we had hoped for (the thought of putting on a cold wetsuit and going back out to freeze again didn’t exactly provide much inspiration either). Regardless of how we felt, we pushed through it and jumped back into the water. After another 2 hours my back was really starting to bug me, but I was doing the best I could to enjoy the experience. The afternoon brought a much needed yoga class (instructed by the Yoga for Surfers DVD), which I hoped would also help to sort out my back. During the evening, we ate dinner, had a few beers, then watched a rather intense limbo competition (which I gracefully sat out). I decided to head to bed early and rest up for the next day of surfing.

Day 3: After a good nights rest, I was still quite exhausted, but ready to get back out in the water. Breakfast, wetsuits, surf. The waves were quite choppy this morning, and we were getting pounded by the surf. Despite this fact, the morning was a lot of fun! The sun even made a few (much needed) appearances! We finished our sessions with a fun group swim, diving through waves, attempting front flips into the surf, and watching in amazement as Rob (aka Handsome Rob, our instructor) somehow swam in the waves as if he was part dolphin..

Day 4:
– 9AM session, another cold, cloudy morning, with pretty huge swells. Once again, got my ass seriously handed to me by the waves. It was more an exercise in paddling, and managing to get out past the waves, than it was in surfing. I basically spent the better part of two hours getting smashed by wave after wave and just trying to stay afloat. That being said, it was good fun, and I am getting more comfortable sitting on my board. 
– Afternoon session: Still tired from the morning, and struggling to drag myself out in the cold (see also rain, see also wind, see also huge, choppy waves) we once again jumped in and hoped for the best. Fista (my instructor) took me “out the back” past the break to help me find a few good waves to try and ride.  I once again found myself getting tossed around like a ragdoll in the wild surf. I got sucked under a few times and properly thrown through the wash, finding myself disoriented from having so much water forced up my nose and into my ears. At the end of the day I managed to catch one huge wave, and rode it all the way in, feeling quite comfortable on my board once I managed to find my footing. This single wave made the hours of getting beaten down by the ocean worth it. I felt the high, the zen of surfing for the first time, and I loved it!

Day 5: My right ear is properly fucked from yesterdays beating, so I’ve opted to sit out the last session this morning. I’ve been up most of the night with a stabbing pain in my ears and really don’t want to push it any more at this point. It’s been a good week at Spot X, an experience I will truly cherish in years to come. This afternoon I catch the bus up to Byron bay where I plan to spend the next week kicking back (and praying for some sunshine and warm weather).