by John C. Bland II | Apr 14, 2009 | Speaking Engagements
Introduction to Mate (PowerPoint | Code | Recording)
Description: Mate is an amazing Flex framework. This presentation showcases the basics of Mate. There are MUCH deeper levels to go but the introductory talk is what was requested by the Great Lakes Developers user group.
(more…)
by John C. Bland II | Apr 1, 2009 | General
The Flash Player uses the same epoch as Unix (January 1, 1970). An epoch is “a particular period of time marked by distinctive features, events, etc.” (source: Dictionary.com)
One thing to note is the date pertains to the UTC (univeral time coordinated: “Universal time, taking into account the addition or omission of leap seconds by atomic clocks each year to compensate for changes in the rotation of the earth.” [source: Dictionary.com]). Flash can handle this just fine. Let’s get to the code (starting to itch with all of these definitions).
One option to get the UTC date:
var now:Date = new Date();
var epoch:Number = Date.UTC(now.fullYear, now.month, now.date, now.hours, now.minutes, now.seconds, now.milliseconds);
trace(now, epoch/1000, Math.round(epoch/1000)); |
var now:Date = new Date();
var epoch:Number = Date.UTC(now.fullYear, now.month, now.date, now.hours, now.minutes, now.seconds, now.milliseconds);
trace(now, epoch/1000, Math.round(epoch/1000));
The only real thing to note is the epoch/1000 is there because Flash uses milliseconds and epoch is in seconds so we divide by 1000 to get the seconds since the epoch. Now, that is how I first did it until I RTFM (read the freaking manual). It felt so dirty and unnecessary. Here is the easiest way to do it.
var now:Date = new Date();
var epoch:Number = Math.round(now.valueOf()/1000);
trace(now.valueOf(), epoch); //1238595716133 1238595716 |
var now:Date = new Date();
var epoch:Number = Math.round(now.valueOf()/1000);
trace(now.valueOf(), epoch); //1238595716133 1238595716
Notice the first trace shows a lot more numbers since it is milliseconds since the epoch. The second number is the epoch/1000 and rounded. Don’t forget to round or you’ll get three decimal places. Date.value() is the trick here. By definition: “Returns the number of milliseconds since midnight January 1, 1970, universal time, for a Date
object.” (source: Adobe LiveDocs)
Anyways…that’s it. No need to pontificate (been wanting to use that word; lol) anymore about such a simple task.
UPDATE
Since someone on Twitter made the statement about getTime() I guess I wasn’t clear. Let me clarify.
The above is NOT the only way to do it. Yes, you can use new Date().getTime() or new Date().time (preferred over getTime() since it really is a property). They both yield the same result as new Date().value(). Dividing by 1000 and rounding is still required since we’re still fooling with milliseconds since epoch.
Thanks.
by John C. Bland II | Mar 31, 2009 | Flash Platform
Ok…I’m following the herd and blogging about it yes but I have a different reason. Let’s get the basics out of the way:
https://www.adobe.com/devnet/facebook/
https://code.google.com/p/facebook-actionscript-api/
There we go. Now we can get down to business.
(more…)
by John C. Bland II | Mar 29, 2009 | Flex, Software
If you have ever used FlashDevelop (https://www.flashdevelop.org; windows only), you are familiar with the GREAT code completion it provides. FB is lacking terribly, in comparison. So…let’s vote to build it up.
https://bugs.adobe.com/jira/browse/FB-18507
(more…)
by John C. Bland II | Mar 28, 2009 | General, Software
Please vote for this bug: https://bugs.adobe.com/jira/browse/FB-18487.
Dev should be made simpler in now the 4th release of FB but there are still numerous areas where FB is terribly lacking in comparison to Java development in Eclipse.
by John C. Bland II | Mar 28, 2009 | General, Software
Please vote for this bug: https://bugs.adobe.com/jira/browse/FB-18488.
Dev should be made simpler in now the 4th release of FB but there are still numerous areas where FB is terribly lacking in comparison to Java development in Eclipse.
by John C. Bland II | Mar 28, 2009 | ColdFusion, Flex, Writing
Yesterday I was pinged on IM by John Farrar about an issue he was having connecting Flex to ColdFusion on his new system. He’d done this many times before but hit a bump so we jumped on Adobe Connect and looked into it.
(more…)
by John C. Bland II | Mar 28, 2009 | General
So I’ve been Twittering (https://twitter.com/johncblandii) a lot lately, as usual, and I noticed I tend to Twitter my dev’ thoughts more than blog them. I want to get back to blogging them so this is an FYI.
You will see some quick posts here soon. By quick I mean random things I figure out or discover while developing or quick posts about dev approaches, design patterns, or whatever. I’ll still get a meaty post in here at times but you’ll see quicker posts here/there.
Flex 3 Remoting one coming in a second. ๐
by John C. Bland II | Mar 2, 2009 | General
I have a few suggestions on training desires and I’m pretty stoked about doing them.
- Flex+LCDS+CF: A Sexy Relationship (preso will be for AZCFUG)
Many Flex dev’s from back in the day loved AMF integration in CF. It seriously was the fastest way to get up and running but there is a newer, much sexier way to pull your data: LiveCycle Data Services. This is native to ColdFusion 8 and it even boasts some sweet features you can’t easily/quickly accomplish in regular CF-AMF.
- Flex Development for .NET Developers
I’ll utilize WebORB here to show a REALLY sexy integration point between Flex and .NET. General integration using web services will be shown as well but that isn’t nearly as sexy as WebORB. ๐ Along with data integration I’ll discuss the comparisons between Flex dev’ and .NET dev. You may even hear the word XAML in there somewhere. ๐
- Flex/PHP Integration
You will see data integration between Flex and PHP using AMFPHP. Since I love CodeIgniter so much, and if time allows, I might show how you can integrate a Flex app in a PHP site based on CodeIgniter.
- ActionScript 3 Series
- The Basics
This may be a short preso but it will cover the basics of using AS3. I’ll discuss a few things specific to Flash CS3/CS4 and a few about Flex 3. This will also cover utilizing classes so don’t expect to see anything on a timeline, literally.
- “Patternization”
I’m a fan of design patterns and I’ll show how you can implement a few. There won’t be a laundry list of patterns discussed but I will cover a few of my fav’s.
These aren’t in any specific order. I’ll iron out a schedule here soon. For sure I’m doing 2 trainings a quarter but which two I’m not sure about yet.
More coming soon.
by John C. Bland II | Feb 13, 2009 | General
I’m going to start my “community service” by doing a series of presentations (via Adobe Connect). They will range from quick (15 minutes) to long (1 hour) and will cover a range of topics. I’m open to talk about a wide array of topics but I would like to know what you want to see.
Along with the above preso’s I’ll be doing a preso for AZCFUG one of these upcoming months. The talk will be over Flex+LCDS+CF. More info about that later.
BTW, all sessions will be recorded and I’ll add them to my Preso’s page once they are completed.
So, post a comment below and I’ll compile a list and pick/choose to create a schedule.
Thanks.
by John C. Bland II | Feb 11, 2009 | General
Yep, I’m accepted and STOKED! ๐ I won’t get long winded but…
4 score and 7 years…{hrmm, clears throat}…wrong speech. ๐
Seriously, I’m excited and happy to be accepted in such a great program. I look forward to learning more about it and continuing my “community service” as I did when I was a UG manager.
Special thanks to Rachel Luxemburg and Sarge.
by John C. Bland II | Feb 3, 2009 | Flash Platform
Let me start by saying the move to AIR 1.5 was NOT(!!!!) an easy task. For whatever reason my entire app acted different than it did in 1.0. I don’t know why but it did. Maybe it is more of a Flex 3.2 issue…not sure. Either way, I’m working through a ton of odd, post-upgrade bugs. One of them existed in an old version of the AIR Remote Updater classes. I almost scrapped it and wrote my own but figured I’d look into the source and see if it is an easy fix. Well, it was. It is a simple issue of a hard-coded namespace.
(more…)
by John C. Bland II | Jan 31, 2009 | Adobe AIR
Ok…this was boggling for a minute but thanks to my good buddies Google and the public Flex bug system I found the problem. It was a tough search so I figured I’d post here to help.
(more…)
by John C. Bland II | Jan 28, 2009 | Flash Platform
This really would work in any language, heck even on paper, but the code will be AS3 so figured I’d label it an AS3 post. Short and sweet though…here is how you can round to the nearest number in ActionScript.
(more…)
by John C. Bland II | Jan 26, 2009 | Flash Platform
In MXML you can easily set the itemRenderer to the string of your class, including dot syntax classpath, but in ActionScript it is different.
_list = new List();
_list.itemRenderer = new ClassFactory(IndexRenderer);
addChild(_list);
As you see the ClassFactory class is used because itemRenderer expects an IFactory implementation.
Just a quick tip.