Font Styles in AS2 on Flash CS5

While working on updating a legacy project developed in Flash Professional using Action Script 2 I ran into some issues with HTML text and formatting.  Certain portions of the HTML text (which was being loaded from an XML file) where supposed to be displayed as either bold or italics (or both), but instead the text within the <i> or <b> tags was not displaying at all.

I tried a whole bunch of stuff to get it working.  Ultimately what we found was that for some reason Adobe seems to have changed the way fonts are embedded when you publish a flash project.  So while we were embedding Arial (probably not necessary given our audience) it was only embedding one style of the font (ie. regular, bold, italic).  So when we switched the embedded font from ‘regular’ to ‘italic’ the reverse issue was occurring, all of the text within the <i> tags was showing up while everything disappeared.

The solution was to change the font for the one we were embedding to the ‘device’ font ‘sans serif’ this allowed flash to decide which style to use on the fly.  I am sure this is not an issue in AS3, unfortunately re-writing the code was not an option in the time-frame I had.

Note: We tried embedding all of the styles we needed for the font but Flash still seems incapable of applying the correct style when appropriate.

Thanks goes to John for helping me resolve this issue.

Retweet

Launching Websites in Non-Default Browser

Unfortunately there are some websites out there that have decided they are going to favor a specific web browser.  For example most sites created by Microsoft are optimized to work with IE.  This is great for Microsoft but not so much for people who know enough to recognize that IE is not at all the best web browser out there (a rant for another time).  A more specific example would be Microsoft’s SharePoint.  For SharePoint they take advantage of ActiveX controls that are not available in other browsers to do things like integrate with Single Sign-On and Office Communicator, and their WYSIWYG editor seems to only work in IE for probably a similar reason.  This often causes people to switch between using the browser the prefer and the browser that gives them the best experience on the site they need to use.  This post discusses several options for dealing with the management of these ‘bookmarks’.

List of Culprit Websites

  • Netfix (Silverlight Player)
  • Informz
  • Microsoft Share Point
  • Microsoft Live

IE Tab Extensions

Google Chrome (my current preference) and Firefox both have extensions called “IE Tab” (Chrome ExtensionFirefox Extension) these effectively create an instance of Internet Explorer inside of a tab within each browser.  This allows you to get most of the “benefits” of using IE for a particular site without needed to open a separate browser and not interrupting your web experience.  They also provide options that allow you to do things like specify sites that you always want opened in an IE Tab.

NOTE: Using these extensions however, is not a 100% affective replacement of the actual IE browser.  You will inevitably run into situations where a website’s functionality will be hindered by the nature of the extension versus the native browser.

Browser Shortcuts

If the extension IE Tab Extension approach is not an option either because you are not using a browser with extensions or you are not trying to open a website in IE but rather a different browser, you can create windows shortcuts for the browser that include extra parameters that will cause the shortcut to open the browser than immediately launch the URL of our choosing.

Browse to the install directory for the browser you ‘need’ to use on your computer ( IE will most likely be C:\Program Files\Internet Explorer), right click on the execuatble file for the browser (iexplore.exe for IE) and select “Create Shortcut”.  You can now move this shortcut to whatever location you want.  I created a folder under “My Documents” for “Start Menu Shortcuts”.  Once you have the shortcut in the location you want it you can rename the file to whatever you prefer.  Then right click on the shortcut and select “Properties”.  In the field labeled “Target” at the end of the existing text add the URL you want to open. (ex. “C:\Program Files\Internet Explorer\iexplore.exe” http://www.google.com), then click OK.  Now when you click on the shortcut and it will open Internet Explorer and launch the web address you specified.

The process should be the same for most browsers in Windows.

NOTE: I have run into issues with this method in that specifically Windows 7 doesn’t like you having more than one shortcut in your start menu or taskbar that run the same application.  When it notices that you are placing a shortcut to a application that already has a shortcut windows will replace the existing shortcut with the new one.

Batch File Shortcuts

To counter the Windows 7 shortcut issue I started playing with the idea of running command line code to accomplish my goal.  You can do this in Windows by creating batch files (.bat).  For those who are unfamiliar, these are essentially text files that contain command line code that automatically gets executed when the file is run.  To create the batch file all you need to do is open Notepad (or your text editor of choice, not a word processor), insert the following code, and save the file as a .bat file.

START iexplore.exe http://google.com

The file that you end up with will now execute the command you specified.  In the case of the example I have above it will run Internet Explorer and launch Google.com.

As with the shortcuts example you can put this file where ever you want on your computer.  You can even create a shortcut to this file that can be placed on the start menu or task bar and you will not run into the issue previously mentioned because you will have a separate batch file for each website you want to open.

If anyone has any other tips or issues with the tips I have described above please comment.  I should point out that if you haven’t noticed all of the previously mentioned examples are for use on a Windows PC and will most likely not work on a Mac, I honestly have no idea.

Retweet

Office 2010

I have been a big fan of Google Apps (Docs, Calendar, Gmail) for at least the last several years. They provide a lot of the features you need for an office suite and they do so in an open and accessible way. I found myself at a point where I was using Google Docs to manage most of my business and personal documents and notes. Then I started writing documentation at work using MS Word 2007 (MS Office being the tool of choice at the AAN), this opened my eyes a bit.

My love affair with Google Docs is coming to a close and my relationship with MS Office is finding new passion. After writing several user manuals and other documents with Word 2007 I started to find that the experience was so much more fulfilling than what I was getting from Google Docs.

Word

Google Docs doesn’t come close to the ease with which Word 2010 allows you to create well formated and good looking documents.  Yes you can create a CSS based style sheet for your Google doc word processing file, which is great if you love spending hours writing and tweaking CSS.  Word comes packed with a load of pre-configured styles for you to choose from.  If you can’t find one that looks the way you want, no problem, there is a tool for modifying your style and you can even save it out for use in a different document.  Aside from the cosmetic features word is rich with all of the old features you know and love.

Excel

I have yet to find much that has changed in Excel for 2010 but I am sure they have made similar improvements as in Word.  All of the powerful features from previous versions carry over of course, including the powerful dynamic and pivot tables.

Power Point

It has never been easier to create fast and stunning presentations.  This is not something I have done very much of and frankly I feel slide show presentations are used completely inappropriately in most presentations.  Come on people, it isn’t a place to write all of your lines, give me the key points.

OneNote

This is really the focus of this post.  OneNote is a backwater piece of software that I don’t think Microsoft was ever too serious about.  Well, the times they are ah’changin.  OneNote has transformed my personal organization, not to mention several areas of cooperative organization at work.  If you are unfamiliar, OneNote as the name may suggest is a software designed for taking and organizing notes.  I have tried several methods of note taking in my time, but I have always strived for a paperless solution.  For me OneNote is an excellent solution.  Content is organized by “Notebook”, “Section”, “Page” and “Sub-Pages”.  All have direct correlation to real world objects.  This makes it very easy for even a complete stranger to the software to open up a notebook and understand what they are looking at.

The content that you can put into OneNote is extremely open.  You can put text and images anywhere you want just like on a real piece of paper.  Unlike a piece of paper you can also include hyperlinks, files and links to files.  You can even integrate content with other MS productions such as Outlook.  For example, defining a piece of content as a “Task” will automatically create a task in Outlook for you.

To top it all off the biggest advantage digital note taking in OneNote provides is searchability.  Try as you may to create a short hand system for yourself to emphasize hand written content, making it easier to find later, you can’t match the power of really good search functionality.  OneNote will even index written content it finds in images using OCR.

I decided I liked MS Office 2010 I decided to bite the bullet and purchase it for my personal computers at home.  It has been a very welcome addition to my software collection.

Retweet

Video Capture Tools

Here are some tools I have found useful in capturing video, specifically from the web.

Download Helper (Extension for Firefox)

This is by far the best tool I have found for capturing FLV and MP4 videos from the web.  All you have to do is visit the web page with the video you want to grab.  Once the page is done loading (and the video has started to stream) the extension icon will activate indicating that it has found a video to download.  Click on the icon and select the file you want to download.  This works especially well with YouTube.  When you click the icon it will let you select from what ever size you want to download whether it be 480p, 720p, 1080, etc.

CamStudio

CamStudio is a open source project used for capturing video directly from your screen.  This means if you see it on your screen you will capture it.  The software has a few settings for video and audio quality.  The Biggest issue I had with this CamStudio was that to get the audio to capture as well you need to use the ‘Stereo Mixer’ audio input (esentially loops your current audio output back to your PC).  When doing this I was unable to eliminate a minor feedback I was getting, I think probably from the poor quality audio hardware I have in my work computer.

AviScreen

AviScreen is very similar to CamStudio.  Both are good tools for creating screencasts.

It is also worth pointing out that neither CamStudio or AviScreen are incredibly user friendly and are definately lacking in UI quality, but hey what else can you expect from a piece of software that probably doesn’t make any money for it’s developer.

Retweet

All I see is Blond, Brunette, Redhead…

QR Code

http://createqrcode.appspot.com/

Retweet

cf.Objective() 2010 – Day 3

Part three of my cf.Objective 2010 series.  Again I arrived a little late today.  Just over tired.  I got to Terry Ryan’s ORM talk about half way through.  When I walked in he was talking about lazy loading, extra lazy, and eager.  He mentioned how you can actually do a eager join when you load an object which instead of running separate queries two get all of the data you need it Hibernate will create a ‘large’ join statement that will pull all of the data in one query.  This was something I hadn’t previously heard of and sounded like it might have some good uses.  He went on to talk about Caching, Event Handling and Table Generation.

Read the rest of this entry »

Retweet

cf.Objective() 2010 – Day 2

Part two of my cf.Objective 2010 series.  I was a bit worried this day was going to be rough as I had been at the office until almost 10pm the night before.  I was a little late the first session and missed breakfast but for the most part I was more awake than I expected.  It helped that the first couple sessions weren’t entirely boring.  Actually the session on Flex 4 was pretty interesting, but still wasn’t earth shattering information.

Read the rest of this entry »

Retweet

Apple < Microsoft

Short rant about how pissed I am with Apple.  People who think that Apple is less ‘evil’ than Microsoft are ignorant.rottenapple2

I own an iPhone and for the most part I really like it.  I have few complaints, and most of them are a result of greedy mobile carriers.  iPad comes out and now I am really interested in developing apps for the iPhone and iPad.  I think it would be fun as well as a way for me to branch out from web development.  So I go to the Apple website and register as an Apple Developer.  It wasn’t until after I registered that I found Apple has made it virtually impossible for you to develop apps for the app store if you do not have a computer running OSX.  On top of that it has to be running on an Intel platform, so one of their newer model machines.

Screw you Apple.

OSX blows you elitist bastards.  You develop a great mobile platform, the iPhone OS, and then you tell me because I prefer *insert favorite not apple OS here* I am not worthy of developing applications for your platform.

As if that wasn’t enough they updated there App store terms of use to eliminate Adobes efforts of circumventing this proprietary BS.

I guess it is time for me to start looking at Android or the Win Mobile 7 OS.  I definitely wont be buying an iPad anytime soon.

Retweet

cf.Objective() 2010 – Day 1

Through work I received the opportunity again to attend the annual cf.Objective Conference held in the Twin Cities.  I have attended the conference for the last four years since its inception in 2007.  To summarize it is a conference for advanced ColdFusion developers.  If you are brand new to ColdFusion you would be better off attending CFUnited. Some session you might see at cf.Objective would be about Frameworks, ORM, CF integration with Flex, etc.

In this post I am summarizing the sessions I attended on the first day.

Read the rest of this entry »

Retweet

Dependency Injection with PHP

Found this article while looking for an open source Dependency Injection engine for PHP.  The grammar needs a little work but otherwise it is a really good summary of what Dependency Injection is and why programmers should use it.

In ColdFusion we use ColdSpring which is based on the Spring Framework for Java.  It actually does a lot more than just DI but I am not concerned about that.  What I really want is something that can handle the same kind of DI situations that ColdSpring does for PHP.  I am currently working on a WordPress plugin for a freelance client which has turned out to be the most heavily object oriented PHP project I have done so far.  I have been trying to translate a lot the best practices I have learned while working with ColdFusion over to PHP and came across a need for DI.  What I ended up doing is creating a Factory that handles all of my object creation just like what is mentioned in the article by Ryan on PotStuck.  I pass an array with all of my classes, their paths, and their dependencies, like so:

$classes = array (
	'EventBean' => array (
		'path' => 'model/Event.php',
		'dependency' => array (
			'Venue' => 'VenueBean'
		)
	),
	'VenueBean' => array (
		'path' => 'model/Venue.php'
	)
);

So far it is working pretty well but I am thinking about making a more substantial DI framework that I can use on many projects to come.

Retweet