Posts Tagged flex

Quick Flex Hack: Turn a LinkBar into a ToggleButtonBar

I love how Flex’s (talking Flex 2 here, we haven’t jumped to Flex 3 yet at the day-job) LinkBar looks, but I’m not a big fan of view stacks. I wanted to use one just as you would normally use a ToggleButtonBar, but by default the LinkBar only grays out the “selected” item if its dataProvider is actually a ViewStack. Solution: subclass it and toss in a little hack that gets the results we want. Without further adieu, here’s the code to turn a link bar into a toggle bar:

package {

import mx.controls.*;
import mx.events.*;

public class ToggleLinkBar extends LinkBar {

public function ToggleLinkBar() {
super();
addEventListener(ItemClickEvent.ITEM_CLICK,changeToggle);
}

private function changeToggle(e:ItemClickEvent):void {
for(var i:int = 0; i < numChildren; i++) {
Button(getChildAt(i)).enabled = (selectedIndex != i);
}
}
}
}

Works like a charm!

1 Comment

filler: a game

Not much activity lately, but all for a good cause. After negotiating with various sponsors (the game’s been more or less done since mid-December), I released my first sponsored game today: filler. I had several offers on the table upwards of a couple of thousand dollars, but in the end I decided to go with a non-exclusive sponsorship from Kongregate. The game will be living on their site exclusively for a week or so before I start an upload-fest and try to get it as widely distributed as possible (which will bring in even more money via MochiAds). Because Kongregate offers non-exclusive sponsorships (meaning I can resell ad-free, site-locked versions to individual portals), I’m eventually expecting to make several thousand dollars off of this game. I may do a longer post-mortem later, but for now it just feels so good to have it out there. Read the rest of this entry »

, ,

26 Comments

Piqqem in FlexApps on flickr

A little while ago at work, we switched veins from “Totally Super Secret” to “Shhh, don’t tell too many people, but we’ll give out a few accounts.”  The bosses didn’t want any press releases or newspaper articles just yet, but my co-worker and I spent a couple of days seeing if there were any slightly-stealthy ways to get some word out.  I had stumbled across Ted Patrick’s FlexApps component a couple of months ago, so this seemed like a perfect excuse to test it out.  There hadn’t been any new posts since April, so there was a chance that the group (even though it’s only run by one person) was defunct–but that didn’t deter me.  I’d sort of forgotten all about it until this morning my boss sent us a link asking who’d submitted them  (in a “good job” sort of way).

,

No Comments

Compiling a Stock Flex Component.

I work a lot with MXML, but even I still think there’s a little bit of chicanery going on when it comes to getting it to play nice with the other kids. Due to all the various problems that normal TextFields have with image support (via htmlText), at work I decided to replace the stock Rich Text Editor with a custom-built version that uses an estended TextArea instead of the stock TextArea. Because the extended TextArea is literally an extension of TextArea, I hoped I’d be able to just grab the source for the RTE, copy it into my source tree, fix the package, and swap out any references for the mx:TextArea with my own. So that’s what I did… only for some reason I decided to test this as a standalone instead of trying to immediately integrate it with our other code. The new RTE file compiled with no complaints, but whenever I ran it I wold get a Run Time Error (the OTHER RTE): Read the rest of this entry »

,

No Comments

Windows Media Player and Flex Embed Don't Play Nice

While putting some final polish on my latest flash game, something utterly bizarre happened.  I usually save putting in sounds for the last job, but due to re-used interface code the menu sounds (on rollover) for this game were already in place.  While sorting through my somewhat pathetic sound library (around $15′s worth off of  SoundRangers) on my laptop, I came to the sad realization that Windows Media Player was the only software on it that would play mp3s.  I loaded up my library and listened to everything a few times to try to sort out which  sounds would go where.  Once done, I closed WMP and switched back over to NetBeans.  I dropped in the code for a few new sound effects to test, compiled, and loaded the SWF.  Nothing.  Nada.  No sound.  Not even the menu sounds, which I KNEW were already working.

Read the rest of this entry »

No Comments

Nibblets and the State of Flex Game Development

I had an idea for a game about a month ago. Normally I just prototype this things, file them away, and move on to the next one (there’s always a next one). I was taking part in the MochiAds beta at the time, though, so I figured I’d put a little more work into it and release it on a few sites. To cut a not-too-long-story short, making games sucks. I’ll qualify that. I love prototyping, but I’ve spent the last month (on and off in my after-work non-girlfriend free-time) essentially adding instruction screens, level selection screens, and high score integration. The actual gameplay (and all 10 levels) haven’t changed at all since my first prototype (which took about 2 hours) over a month ago. Read the rest of this entry »

, ,

1 Comment

ToggleButtonBar fix

I’m working on adding Header controls to my version of the Flex Rich Text Editor, and I noticed that the ToggleButtonBar doesn’t… exactly… work. I dug into the source and saw why. When using the “ToggleOnClick” property, the TBB does some funny stuff that it’s parent, the regular ButtonBar, doesn’t really care about. While it’s possible to set the TBB’s selectedIndex to -1, this doesn’t actually get transmitted to the parent ButtonBar. This means that, while the TBB deselects the item properly, the parent BB still think you have the same thing selected. Which means you can’t click on it again until you select something else and then come back to it. Read the rest of this entry »

,

1 Comment

Adobe RIA Dev Camp

On Monday, I headed up to San Fran for one of Adobe’s little community events: an “Adobe Rich Internet Application Developer’s Camp.” I have to say, I really liked their corporate digs. Besides the 2-man behemoth of a company I’m working at now, I’ve worked at Electronic Arts and been to several events hosted by Apple/Google/Yahoo (to name a few). I could probably fill an entire post on the differences (perceived by me anyway) between the corporate cultures of the various mega-corporations, but I’ll keep it to a minimum by saying I liked Adobe’s HQ a lot better than any of the others I’ve been to. And free beer didn’t hurt, either. Read the rest of this entry »

,

No Comments

Flex RTE Part 2: Faking mouse:hover

Before getting into the meat of my post, I suppose it’s all right to now mention that I’m working at a site called Piqqem. As of last week we’re no longer officially in “stealth,” but we’re not quite ready to go into full-on publicity-seeking mode yet, either. The RTE code I’ve been working on is for our “Piqqem Notes,” a wiki like section for all of the stocks we cover.
See also: Flex RTE Part 1: Link Buttons

I’ve actually skipped an installment on converting real HTML to what flash considers HTML and converting the gobbledy-gook that flash considers “HTML” into real-world-usable HTML. This installment, though, (mostly) fixes one of the more annoying features of the Flex Rich Text Editor control. The new code hasn’t yet been integrated into my code from Part 1, just in case someone wants to see the “simple” example.
The Flex CSS support actually covers a:hover, but there’s no way to use CSS with an editable TextField, which means the RichTextEditor control doesn’t inherently support mouse hover states. The only indicator you get that you’re mousing over a link is a hand cursor–but there’s no built-in way to see where that link points to. Read the rest of this entry »

,

No Comments

Flex RTE Part 1: Link Buttons

In this post earlier this week, I set out the project goal of making the Flex Rich Text Editor control a little more user-friendly. Here’s the first bit. I’ve removed the old add link textField completely and replaced it with two new buttons: “Add Link” and “Remove Link.” Read the rest of this entry »

,

1 Comment