SyntaxHighlighter was recently updated to 2.0 and with it there have been quite a few nice additions, but unfortunately it also kills all of the custom brushes. I realized this when I upgraded to the latest version and all of my AS3 syntax highlighting stopped working.
I decided to go ahead and update my AS3 brush to be compatible (and make my blog’s highlighting work again).
One of SyntaxHighlighter 2.0’s new features is support for multiple styles. I’ve included a Flex Builder style that you can use to have the AS3 syntax look the way Flex Builder styles it by default.
For quite a while I’ve been a bit bored with digitalflipbook.
Not so much the content of the site, but the look and the name.
I put up my first iteration of the site in early 2000 when I was graduating from college and looking to create a portfolio website to land my first job. At the time I really liked the name. It literally was a digital version of my portfolio of 3D animation and artwork (which I associated with one of those little books that when flipped would show an animation).
As of late though, I’ve felt like “digital” has a bit of a dated connotation and the site has moved on from a designer’s portfolio site to a developer’s technical blog.
So without further ado I welcome you to yourpalmark.
Now you might be saying, “but the name ‘yourpalmark’ doesn’t connotate a technical blog”… and you’d be right.
Who knows what tomorrow will bring so I’ve decided on a name that just represents me.
This allows me to keep the blog going in its current form as a technical resource for Flash and Flex but also keep it open-ended in case I ever decide to become a game show host.
I’ve updated my Language References post for the release of Flash 10.
I’ve also added a subheading for beta language references and added Flex Gumbo to the list.
I’ll continue to try and update the post.
When you create a new Flex or ActionScript project in Flex Builder you are immediately able to access local files (config XML, etc) and internet resources at the same time.
But if you decide to import a project, or move or rename your current project suddenly you’re prompted with the dreaded Security Sandbox Violation: Security Error: Error #2148.
I’ve had this happen in the past, but often I was just loading a local XML file and I would just add -use-network=false as a compiler argument and all would be happy.
This however will then prevent you from accessing resources from the internet presenting you with yet another Security Sandbox Violation: Security Error: Error #2028. Not a great solution.
Lo and behold, Jesse Warden has the fix.
But to quickly recap, when Flex Builder creates a new project, it adds a new line item to two files giving permission to the new project’s bin directory to access both local and internet resources.
Here is the location of the two files (flexbuilder.cfg and flexbuilder.fbr):
PC:
C:\Documents and Settings\[username]\Application Data\Macromedia\Flash Player\#Security\FlashPlayerTrust
Mac:
[user]:Library:Preferences:Macromedia:Flash Player:#Security:FlashPlayerTrust
Now just add a new line item to each file (copying the one above if necessary) and change the paths to match your project’s bin or bin-debug directory.
Done.
- Renamed class from Color to ColorName
- Changed package to yourpalmark
- hexValue property has been renamed to color
- Added a toString method to trace out the properties of the ColorName object
- Changed license from New BSD to MIT
One small thing I’ve always found a bit handy with CSS in XHTML is the ability to type familiar names for colors rather than the hex value.
Unfortunately, Flash’s StyleSheet does not support color names at all and Flex’s StyleManager only supports the 16 basic VGA color names.
I decided to write a class that adds static properties for all of the color names defined by SVG 1.0 (The colors in SVG 1.0 include the X11 colors with the addition of gray/grey variants. X11 includes the 16 basic VGA, or HTML4, colors as well). This class also adds two static convenience methods for returning a ColorName object by passing in the color name or hexadecimal color value.
While this class does not extend the CSS parsing capabilities of Flash, it could be used by an advanced StyleSheet class that overwrites the parseCSS method using this class as a lookup.
This class could also be extended to add (or overwrite) color values specific to a project you are working on. By setting up static properties for a project color set, the project team could be assured that the colors being used are consistent between team members.
Description:
The ColorName class defines the names and hexadecimal values of the colors defined in SVG 1.0.
Documentation:
ColorName Class Documentation
The latest issue of Adobe Edge, with my article on using Flex and Papervision3D to geocode, just went live.
What a great app!
Woopra is a real-time web tracking application that’s currently in beta.
I’ve only been playing with it for a few minutes (since I received my confirmation) and am already loving it.
Its basically Google Analytics except with the incredible addition of being live. On top of all of this, it has a great design and is extremely user friendly.
Woopra allows you to sit and watch people log on and off of your site. Track them in real-time as they switch pages and interact with your site. What’s even crazier is you can even initiate a conversation with any visitor. For all you know, I’m watching you right now. Rockwell was right in being paranoid.
Like I said, I’m just getting into it, but so far I’m leaning towards this being my web analysis app of choice.
I remember trying this a while back with Flex Builder 2 after reading Stefan Richter’s article and never being able to get it working properly. You couldn’t use the FLVPlayback swc directly, you had to compile out of Flash first with a wrapper MovieClip and you still had issues with the skin scaling properly.
I decided to try it again a couple of weeks ago with Flex Builder 3 and having complete success. You can use the FLVPlayback swc directly in Flex Builder now. I’m not sure if Flex Builder 3 or an update to the FLVPlayback component made a difference or if I’ve just gotten better at Flex. Either way, I wanted to document it for everyone.
Its actually rather simple and requires just a few steps:
- Create a new Flex project.
- Copy the FLVPlaybackAS3.swc from your Flash CS3 directory (under Configuration/Components/Video) and add it to your libs directory in your Flex project.
- In your main application mxml file, create a UIComponent and give it an id of “container”. This id can be anything you want, just remember it for below.
-
Add a Script tag and listen for the creationComplete event on the application. Within the Script tag, add the following:
import fl.video.VideoScaleMode; import fl.video.FLVPlayback; private function creationCompleteHandler():void { var playback:FLVPlayback = new FLVPlayback(); playback.width = 320; playback.height = 240; container.addChild( playback ); playback.play( "assets/video/video.flv" ); playback.scaleMode = VideoScaleMode.MAINTAIN_ASPECT_RATIO; playback.skin = "assets/skin/SkinOverAllNoCaption.swf"; playback.skinAutoHide = true; }Make sure you change the references to the video and skin to the correct directories and files in your project.
That’s it!
Yep… it really is easy now. This is great. Especially since there still isn’t a good video component in Flex.
You can use the FLVPlayback swc directly, you don’t need to create a wrapper in Flash first, and no skinning issues when resizing. I’ve also tested and fullscreen works perfectly too.
As a note, you can also use the source code for the FLVPlayback directly as well. You just have to make a few tweaks to the code directly to handle references to Flash’s live preview for the component. Because of the tweaks, I would highly suggest copying the files into your project and editing them there rather than editing the originals in your Flash application directory.
Follow the steps above, but replace step 2 with the following.
- Copy the fl package from your Flash CS3 directory (under Configuration/Component Source/ActionScript 3.0/FLVPlayback) and add it to your src directory in your Flex project.
- Create a new class in the fl.video directory called Icon. The class is fine with an empty constructor, its just used to stop a compile error.
-
Open fl.video.FLVPlayback and add an if statement around lines 874 – 876:
if( boundingBox_mc ) { boundingBox_mc.visible = false; removeChild(boundingBox_mc); boundingBox_mc = null; } - For good measure, add a void return to the set skinScaleMaximum method. This will stop a compiler warning.
There you have it. You are now able to compile and use the FLVPlayback component from Flex Builder directly with either the swc or the component source.
Click image to view demo (Right-click demo to view source)
I’ve been working on building a chat room using XMPP (Jabber) and the XIFF AS3 API.
As Mike Chambers mentioned back in August, unfortunately there’s not a lot of documentation or tutorials out there for getting up and running with this library.
If you do want to get started, hopefully this will help you out.
First things first, you’ll need an XMPP server running. I’ve setup Openfire which is an open source, cross-platform, easy to setup XMPP server.
Next you’ll need the actual XIFF library.
Once you have the server installed and setup and the library downloaded, you can follow along with Mike Chambers tutorial up above for establishing an initial connection using the XIFF library.
Now at this point, you’ve managed to connect to an XMPP / Jabber server, join a room, and send a message to the room. This was great when I was jumping in and just trying to figure out how to get started. After you get your head wrapped around this, you’ll probably ask yourself the same thing I asked myself… “sweet… but now what?”
At this point you’re kind of on your own… or at least I was. I searched and searched but couldn’t find much more than a couple of simple tutorials very similar to Mike’s.
The one exception to this was a demo that I found from Nick Velloff that included source.
The demo shows examples of connecting to an XMPP server, logging in, registering, adding buddies, removing buddies, displaying the logged in user’s roster (list of buddies), changing a buddy’s group, changing the logged in user’s presence, messaging your buddies, and creating a multi user chat room. Shew… what a God-send right?
Well, once you download the source code and try to get it running locally you’ll soon realize that its not the immediate help you were hoping for. This demo was released back in October of 2007 and since then the XIFF library has been overhauled quite significantly.
Trying to alter the demo’s source to fit the new code was not an immediately simple fix either.
So anyway, I decided to sit down last week and go through every line of the demo code and update it to work with the latest XIFF library.
I also groomed the code a bit to make it take advantage of the Flex layout engine, separate the connection logic from the view, and fix some things that weren’t completely working in Nick’s original.
One other important thing to note is that the source code of my demo includes the current XIFF library for two reasons: 1) In case the library changes again and I haven’t updated the demo, you’ll still be able to download a completely functioning sample, and 2) I had to make some minor tweaks to the library to remove the voids from the constructors and add clone and toString methods to all of the events. I have submitted bug reports for both of those issues and hopefully they will be fixed soon, but until then I made the tweaks myself.
If the team over at Jive Software does not want me to include the source I will remove it and then explain what needs to be tweaked.
Hopefully this demo will help you as much as it helped me, although I have to say rewriting it probably helped me learn XIFF a lot more than just downloading a completely working sample, so definitely take your time with it, there’s quite a lot under the hood.
To download the source, click on the image above to view the demo and then right-click on the demo to view and download the source.
Please note that my host is not setup with a working XMPP server so the demo is not functional above, you must download it and connect it to your own XMPP server to see it fully functioning.
As the XIFF library changes, I will try and keep this demo updated.