You know you’ve been coding in Flash Lite too long when you see this in your diff tool for a Flex file…
BWAHAHAHA!
You know you’ve been coding in Flash Lite too long when you see this in your diff tool for a Flex file…
BWAHAHAHA!
The effect classes in Flex 2 have a wonderful new API. In particular, you can pause and rewind the effects as well as access them by id. They do not, however, act like I’d expect when you abort them. For example, I’m building a scrubbable component. You can scroll the slider, and the View it’s attached too will show and hide objects over time, like markers on a map that are date specific.
I want these markers to fade in when they appear, and fade out when they are no longer relevant to the date range. The problem I kept running into is that the effects wouldn’t either finish all the way, or wouldn’t play what I told them too correctly and would just blink in without fading in. In this case, the Fade effect wasn’t always fading correctly. It is a race condition you can easily repeat. You basically just tell one effect to fade something out from 1 alpha to 0 alpha, and another to fade in from alpha 0 to alpha 1. If you call the disappear method before the appear method’s fade effect is done, you can see it’ll either interrupt it and not fade out, or just flash. Really gross looking.
I implemented 2 methods, appear and disappear. It seems that calling fade.stop() is not enough. I tried fade.end(), but that didn’t work either. I also removed the event listener for the end, and then null’d the Fade effect property before creating the new one that did the opposite, but to no avail. I’m guessing that because garbage collection doesn’t run immediately even if I told the effect to stop and removed all pointers to it, the effect still held onto the applicable properties of the UIComponent it was affecting. I’m sure I could open up the classes and look, but I don’t really have time; on a tight deadline. Best excuse I have, anyway.
Suffice it to say, fade.pause() did the trick. For some reason, this particular method, as opposed to stop, or end, allows another effect to override the properties the original one had set, and continue on. Seems trivial, but to get fast, good looking transitions and visuals, this took me an hour to figure out. Blogging so others don’t have to spend that time.
Example code:
public override function disappear():void { if(__fadeIn != null) { __fadeIn.removeEventListener(EffectEvent.EFFECT_END, onFadeInDone); __fadeIn.pause(); // magic method! __fadeIn = null; } if(__fadeOut == null) { __fadeOut = new Fade(this); __fadeOut.duration = fadeOutSpeed; __fadeOut.alphaFrom = alpha; __fadeOut.alphaTo = 0; __fadeOut.addEventListener(EffectEvent.EFFECT_END, onFadeOutDone); __fadeOut.play(); } }
They used to be “un-read” Fridays, and then Flagged Fridays, and now that I use GMail for both my personal and hosted POP email, starred Fridays. Basically, on Friday, I check all the email that took longer than 5 seconds to respond to during the week, or just ones that need followups. I don’t always do it on Friday, but I strive to tie up all loose ends for the week. This week was busy despite travelling all day Sunday & today, and being at 360Flex Monday through Wednesday. So, I have to hit 42 emails tomorrow morning. The record is 18. Usually when they get above that, there is no hope. I’m looking forward to that same recruiter that’s been calling my phone all week calling at 9:00am this time instead of 6:00am, haha!
360Flex was cool. I missed the XBox room. It’s always rad to meet the people in the community I know to build up more of a report in person for better communication, to garner more corroboration, and clear up things you’ve been wondering about for awhile. Additionally, it’s great to meet those I’ve never met in person. The one thing I’ve always dug about consulting is meeting new people, and 360Flex was no different. Finally, since I appear to be the only Flexdev on the planet not fully entrenched in employment yet, there were a plethora of start-ups and companies to talk to. It’s neat to get a pulse on what the industry is working on by hearing a variety things that companies are doing with Flex & Flash.
Finally frikin’ got to catch up with Joe Berkovitz. I really wanted to get some answers to my burning questions about certain framework things spawned from my earlier blog entry. Unfortunately, I had didn’t really get the justification I was looking for, and instead got context with regards to understanding his ideas & uses for MVCS, one particular framework style he uses. I was hoping I’d either stump him (not a chance, he outranks me in experience, hah hah ) or he’d relay this wonderful tale of how you can scale certain parts, and encapsulate others. The reality wasn’t that glorious. Instead, he had valid reasons why things work based on his work environment. Specifically, the leadership there following through with expectations on server-side API’s & data, clear communication channels with their customers, and the opportunity for the client developer to have a hand in the server-side.
Those business realities have far reaching implications on why one does not need Delegates in Cairngorm for example. In fact, one could perceive my use of them, if one were in Joe’s position, as a reactionary step to shield yourself from the server-side’s ever changing mess so your model can remain clean within your Commands. If your server-side is clean, gives you what you need, and isn’t changing because of an unstable work-flow, you don’t need Delegates. Unfortunately, I’ve never worked in a place like Joe does, thus I still need to have Delegates. Furthermore, after talking in person, I really got to understand how he uses multiple Controllers in MVCS (real ones, not the Cairngorm namesake). Finally, I realize we’re only getting the condensed, edited story since some things are NDA which I totally understand. His use of modules was quite interesting too. I view them as GUI widgets, while he (paraphrasing badly) uses them as class repositories. You can’t do these things over email; in person just rocks, hence the need for these types of get together’s to really grow to the next level.
BTW, Hamachi is off the chain. Joe showed me some examples, and man… wow, I’m all over that, twice on Sundays.
It’s also funny to hear everyone has their own Flex framework. They don’t advertise it like I would; instead, you have to start acting all high-horse about Cairngorm to get them to talk about it, but that’s all the prodding you need to get the good stuff… alcohol helps too.
I will say speaking here was way better than MAX. I could see the blank stares at MAX on a few faces where others seemed completely bored out of their minds; I knew I was doomed to alienate pretty much half of my audience. Here, however, I got the impression everyone pretty much followed the code, and just wanted to know about the technical logistics behind it as well as the gotchas… which is exactly what you want when you are speaking about this stuff. So, felt a ton better. Grant Skinner pretty much did the same talk I did in the later part of his slides the day before, so I took the opportunity to speak more on the code parts about what you can do right now vs. when CS3 is released and they release Grant’s solution, which is very much needed mind you. I’ll post the links to the details tomorrow.
Finally, got home just in time to catch the History Channel’s special on Sparta’s 300, to tie in with the movie the
It’s not blasphemy, it’s not madness. THIS… IS… SPARTAAAAAAAAAA!!!!
For an up to date conference schedule on your phone / device, I’ve created this Flash Lite 2 app. It’s better than the paper they gave you because it updates from this XML file. Therefore, if there are any changes in the schedule, we can update the XML file, and the he app will have the most up to date schedule. I’m a little cracked out from Denny’s-the-morning-after, so bear with me. I also left my good pixel fonts at home, so am waiting for new, better ones to arrive in my inbox. For updates, check the bottom of this blog entry; don’t forget to refresh your browser.
Here’s the SWF.
Don’t have a Flash Lite 2 enabled phone? No worries! Just keep this page open in a browser tab next to Twitter.
For Nokia, Windows Mobile, and PSP devices, go here and click the downloads tab to get Flash Lite.
*** Update: Changed download SWF to Flash Lite 2.1, site SWF to Flash 7.