SizzlaBlog

Flash, Mac and iPhone stuff

Archive for the ‘Apps’ Category

Facebook style Flash interface

Here is my latest offering of notification alerts to Flash - a Facebook style pop up window that supports basic html formatting.

It seems that the power of Facebook is everywhere (just take a look at flCodr [try clicking on the download link]- its using the Facebox javascript code to create modal dialoge boxes).

I couldn’t resist creating my own version just for Flash. This one is a simple AS2.0 version that uses the tween and easing classes to add a bit of animation aswell.

Take a look at it here and come back for some info about how it works.

Setting it all up

When you open up the .fla you will see the following code on the actions layer:

stop();

#include “copyright.as”
#include “fb_actions.as”

createFeedbackPopUpBox(”Facebook style pop up winodw”,65,82,”This is a nifty little Facebook style pop up window for your Flash applications that is really simple to implement!!<br><br>It even supports basic HTML such as <b>bold</b> and <ul><li>Unordered lists</li></ul>”)

The first include is the copyright notice and must be kept intact. If I see anyone using it online without the notice I will hunt you down and kill you (not literally, but I will be really pissed off!!). This script basically replaces the right click context menu and replaces it with a link back to this site. You can find more scripts for protecting your swf’s over at flCodr.

The second include contains the function’s that allow the thing to work. I could go through everyline but its pretty straighforward. The box is positioned according to the values passed into the function, the box is faded from 0 to 100% alpha, once the fade is completed the text is added.

To remove the opposite process is followed and the box is placed off the screen.

Arguably I could have used the attachMovieClip  and removeMovieClip functions, but this is much simpler, quicker and eaiser.

Making it happen

To make the popup box just call the following function:

createFeedbackPopUpBox(title,xposition,yposition,bodyText)

title - This is the title that gets displayed, contained within quotes. it could easily be a variable name - just loose the quotes.

xposition - The X position of the window on the screen

yposition - The Y position of the window on the screen

bodyText - The string (requires quotes) or variable name that should be displayed as the body text, It can contain basic HTML such as bold, un-ordered lists and hyperlinks.

Thats it - nice and simple.

Grab the files here!

  • 0 Comments
  • Filed under: Apps, Flash
  • Sorted!!

    After many hours of hard work by the team here at the SizzlaMedia offices (ok just me, in the study) the problem with the GMap powered apps has been fixed. Turns out a Google Analytics script was somehow appearing in the Flash apps.

    Once I removed the script everything seemed to work just fine!

    Hopefully we won’t see any more errors popping up!!

  • 0 Comments
  • Filed under: Apps, Flash
  • Testing from iphone app

    Just testing to see how well the native iPhone app works. Its breeze to set up and use. I’ve been waiting for this one, so far, so good!!

    photo

  • 0 Comments
  • Filed under: Apps, iPhone
  • Creating Cross Platform CD-Roms

    Back in my University days having a Mac was not always fun in a Windows dominated campus. I always had to ensure that my disc’s were able to be read in a Windows machine, even though they were burned on a Mac. After looking over some of my files I decided to share with the world some of the code snippets I found along the way. This posts concerns creating cross plaform Flash CD-Roms, inparticular opening folders from projectors.

    Auto Run

    Due to a security vulnerability in OS X 8 (i think!) the auto run feature was disabled on a Mac, however there was an option to open the root folder by default (a really easy option using Toast Titanium).

    In Windows an autorun.inf file should be created. This can display an icon and launch an .exe or .bat file as well as set the label for the disc.

    [autorun]
    open=myApp.exe
    label=My App
    icon=myApp.ico

    As previously mentioned by using Toast Titanium on the Mac it is very easy to open up a folder containing the .app file to launch. You can also specify which folders and files should be seen by each operating system.

    Opening Folders from Flash

    Opening folders or files from Flash is a bit of a work around these days. Before Flash MX 2004 it was relatively easy to do, but after a security vulnerability this freedom was closed down. You now need to place your .exe or .app files in a folder called fscommand. It has to be this AND ONLY this. This fscommand folder must be at the same level as the Flash projector. i.e

    My Folder >

    myProjector.exe

    myProjector.app

    fscommand

    You may be thinking “how do I open up an application from here then?”

    The answer is to use a helper file; in Windows an .exe and in Mac an AppleScript file saved as an .app. I will show you how to open a folder from a Flash projector as this was an issue I had problems with as a student when trying to create an interactive CV. There are various ways, but these methods seem the most robust. Both methods use the exec parameter from the fscommand:

    fscommand(”exec”,”AppName”)

    Windows

    In Windows the process is a bit of a bitch. You can thank the creators of the first Flash virus (SWF/LFM-926) for the fact that every version of the stand-alone Flash player since Flash MX has restricted the use of the EXEC command. This change made it impossible for anyone to create any new Flash based viruses, but it also crippled the Flash projector as a tool for legitimate users by instantly rendering many free projector extension tools useless.

    There are four key restrictions that you have to keep in mind when working with the EXEC fscommand and standalone Flash projectors. (i) Executables you want to run via the EXEC fscommand have to be in a special sandboxed folder called fscommand in the same directory as the projector. (ii) You can’t specify a path in the EXEC command, just a filename. If the specified file is not found in the fscommand folder, it won’t run. (iii) The only argument allowed by the EXEC fscommand is a filename, there is no way to pass arguments to the executables that you want to run. (iv) You can’t use EXEC from an SWF file, it will only work from a projector (EXE). The last restriction doesn’t really concern us, but if you’re trying to test your EXEC calls, being aware of it will save you some frustration.

    One solution to get around the limitations of the EXEC fscommand is to create one exectuable file for each file that you want to open, but what can you do if you don’t know how to make EXE files? Windows and Flash both consider a BAT file as an executable file so the easy solution is to create a BAT file for each file you want to open and EXEC the BAT file from Flash. You don’t need to be a BAT file wizard to do this, the simple one-liner below (let’s call it mydoc.bat) will do the trick:

    start mydoc.pdf

    That example assumes that both mydoc.bat and mydoc.pdf are in the fscommand folder. You can change the BAT file to launch the PDF file from anywhere you like, as long as you can create a valid path to the file. Now all you have to do is create a BAT file for every file you want to open and call it from Flash like this:

    fscommand(”exec”, “mydoc.bat”);

    The only problem with this approach is that your user is going to see the ugly black DOS box appear every time they open a file. That’s where the proxy utility can help you create a more professional looking end product for your users. Proxy is able to launch BAT files and suppress the ugly DOS box.

    The proxy file will launch a .bat file with the same name. Inside the .bat file the following code should be placed. This will simply open up an Explorer (not Internet Explorer) Window for the specified folder. The path is relative to the .bat file.

    %SystemRoot%\explorer.exe “FolderName

    The proxy.exe file needed can be found in the zip below. The only rule is that the .exe and .bat file must have the same name. To open up multiple folders, simply create new .bat files and copy/rename the .exe to suit.

    Mac

    Doing the same thing in Mac is a bit easier. You simply need to use an AppleScript file. The code below will open a new Finder window displaying the contents of the specified folder on the specified disk. Replace DiskName with the name of the disk. This is better than Windows as the name of the disc will never change, where you can never be certain of the drive letter.

    tell application “Finder”

    activate

    make new Finder window to disk DiskName

    set target of Finder window 1 to folder FolderName of folder “fscommand” of disk DiskName

    end tell

    If you don’t know how to write AppleScript, don’t fear - just follow these steps (you will need a Mac, or know somebody that has one!):

    1. Open Applications > AppleScript.
    2. Open the Script editor.
    3. You can cheat by hitting the record button and opening the folder/file you wish.
    4. Click Stop and look at the code.
    5. Substitute and system specific folders (such as your username).
    6. Save the file as an Application.

    So now we have the command for Flash and the Windows and Mac helper files to launch our folders. The next step would be to create some actionscript that will handle launching our folders. Lets assume that on our disc we want to open five folders. For ease of use, name these folders - folder0, folder1, folder2, folder3, folder4.

    We can then set up a loop and attach to buttons to launch a file.

    Telling the difference

    Use this script below to call either the Windows .exe or the Mac .app helper file:

    if (platform==”WIN”){
    fscommand(”exec”, which + “.exe”);
    }else{
    fscommand(”exec”, which);
    }

    That’s it, you should now be set to get creating cross platform CD’s. The zip file below contains a sample .exe, .bat and Applesctipt file.

    Download source files crossplatformfiles

    Creating search plug-ins

    This post is for any web site owner who wants to add a search plugin for their site.

    If your not too sure what I mean, then take a look in the top right corner of your browser next to the address bar, and you will see another input box. This allows you to search directly from the browser. If your using Firefox your default search in normally Google and for IE user its Live Search. There is a method to add your site so that users can find content without first having to go to your site. (take a look at flCodr.com to see this - simply click on the drop down box arrow and click ‘Add flCodr’).

    The plugin takes the form of an XML file which holds some configuration settings such is icon, description and search parameters.

    The XML file describing a search engine is actually quite simple, following the basic template below. Sections in bold need to be customized based on the needs of the specific search engine plugin you’re writing. Take a look below for more info. You can also find out more here.

    <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
    xmlns:moz="http://www.mozilla.org/2006/browser/search/">
    <ShortName>engineName</ShortName>
    <Description>engineDescription</Description>
    <InputEncoding>inputEncoding</InputEncoding>
    <Image width="16" height="16">data:image/x-icon;base64,imageData</Image>
    <Url type="text/html" method="method" template="searchURL">
    <Param name="paramName1" value="paramValue1"/>
    ...
    <Param name="paramNameN" value="paramValueN"/>
    </Url>
    <Url type="application/x-suggestions+json" template="suggestionURL"/>
    <moz:SearchForm>searchFormURL</moz:SearchForm>
    </OpenSearchDescription>
    ShortName
    A short name for the search engine.
    Description
    A brief description of the search engine.
    InputEncoding
    The encoding to use for the data input to the search engine.
    Image
    Base-64 encoded 16×16 icon representative of the search engine. One useful tool that you can use to construct the data to place here can be found here: The data: URI kitchen.
    Url
    Describes the URL or URLs to use for the search. The method attribute indicates whether to use a GET or POST request to fetch the result. The template attribute indicates the base URL for the search query.
    Note: Internet Explorer 7 does not support POST requests.
    There are two URL types Firefox supports:
    • type="text/html" is used to specify the URL for the actual search query itself.
    • type="application/x-suggestions+json" is used to specify the URL to use for fetching search suggestions.
    For either type of URL, you can use {searchTerms} to substitute the search terms entered by the user in the search bar. Other supported dynamic search parameters are described in OpenSearch 1.1 parameters.
    For search suggestion queries, the specified URL template is used to fetch a suggestion list in JavaScript Object Notation (JSON) format. For details on how to implement search suggestion support on a server, see Supporting search suggestions in search plugins.

    Image:SearchSuggestionSample.png

    Param
    The parameters that need to be passed in along with the search query, as key/value pairs. When specifying values, you can use {searchTerms} to insert the search terms entered by the user in the search bar.
    Note: Internet Explorer 7 does not support this element.
    SearchForm
    The URL to go to to open up the search page at the site for which the plugin is designed to search. This provides a way for Firefox to let the user visit the web site directly.
    Note: Since this element is Firefox-specific, and not part of the OpenSearch specification, we use the “moz:” XML namespace prefix in the example above to ensure that other user agents that don’t support this element can safely ignore it.


    A web site that offers a search plugin can advertise it so that Firefox users can easily download and install the plugin.

    To support autodiscovery, you simply need to add one line to the <head> section of your web page:

    <link rel="search" type="application/opensearchdescription+xml" title="searchTitle" href="pluginURL">

    Replace the italicized items as explained below:

    searchTitle
    The name of the search to perform, such as “Search MDC” or “Yahoo! Search”. This value should match your plugin file’s ShortName.
    pluginURL
    The URL to the XML search plugin, from which the browser can download it.
  • 0 Comments
  • Filed under: Apps, flcodr
  • flcodr.com - a Flash of genius?

    Inspired my Lee Brimelow’s Snippet extension Panel for Flash I am setting up a new code repository for Flash Developers. If you don’t know what Snippet’s is, its an extension for Flash that displays a list of code snippets that allows you to easily add code to your projects. The snippets are held in an XML file which makes the app dynamic and updateable. (I recently created my own hard coded version of a Code Helper, which dynamically produced scripts for various custom functions based on an input into a text field).

    The fact that Snippets runs from an XML file means that new code can constantly be added. Lee does this by placing the relevant code on his blog. This got me thinking. Why not have the XML file located on a server, rather than on the client machine. Infact why not extend the extension so that the user could enter a few keywords into a seach field and get code snippets that match the criteria, right within Flash. You wouldn’t even need to open up your browser.

    So after a few hours of hard thinking I came up with the idea of having an online repository (that is generated by users and fellow developers) that is linked to a Snippet’s style app within Flash. There would be an option to select between AS2 and AS3 code aswell as search functions.

    I believe that this could be a really huge project with great opportunities.

    For now though it’s just an idea. I need to get my Flash, PHP and MySQL hats on, but in the meantime this is a road map of the developments I wish to make. This will be an open source project so anybody can contribute in what ever way they can.

    Stage 1 : Website Design

    Stage 2 : Website Development

    Stage 3: Flash Extension Development (inc Beta testing)

    Stage 4: Product Launch

    Stage 5 : On-going development and improvements

    There are other similar projects running for other languages but as far as I am aware there are no others that integrate into Flash as perfectly as this will. The user will have the power to find and contribute to the snippet library.

    As for a name, get ready to bookmark www.flcodr.com some time in the not too distant future

  • 0 Comments
  • Filed under: Apps, flash, flcodr
  • Firefox Backups

    Cleo

    Do you use Firefox on multiple platforms and machines? Yes? Than this post if for you.

    I’ve already written about Foxmarks the great Firefox add-on that allows you to sync your bookmarks between multiple instances on Firefox (even works across platforms - I use it to sync my Mac and XP versions).

    There are two add-ons (FEBE and Cleo) that will allow you to backup your Firefox install and then package your add-ons into a single xpi file. This is great if you want to copy your addons between machines.

    To prove it works, i’ve packaged my previous post on a set of Web Developer Add-ons into a single xpi file. It can be installed here.

    To set up follow these steps:

    1. Install FEBE (Firefox Environment Extension Backup) first. FEBE allows you to quickly and easily backup your Firefox extensions. In fact, it goes beyond just backing up — It will actually rebuild your extensions individually into installable .xpi files. Now you can easily synchronize your office and home browsers. FEBE backs up and restores your extensions, themes, and (optionally) your bookmarks, preferences, cookies. and much more.
    2. Install CLEO. CLEO is a Firefox extension that works with FEBE to package any number of extensions/themes into a single, installable .xpi file.Why? Consider this: I, as an extension developer, have several different Firefox profiles. Whenever I start a new extension, I create a new profile for testing, debugging, etc. In this profile, I like to have a dozen or so developer related extensions installed. With CLEO, I can packaged all these extensions together into a single, installable xpi.

      You may have a list of your favorite extensions/themes that you would like to share with others. With CLEO, you can gather them all together into a single file (called, perhaps, “My favorite extensions.xpi”) and post them on a webpage. Others can install the whole batch with a just a couple of clicks!

    3. Restart Firefox.
    4. Click Tools > FEBE > FEBE Options. Under the ‘Options’ tab choose ‘Selective’ backup and then check the elements that you want to backup.
    5. Under the ‘Directory’ tab, choose a destination to back-up to.
    6. You can optionally choose a back up period or leave this blank. Once you have completed the options then continue.
    7. Click Tools > FEBE > Perform Backup. This will create a backup in the directory which you selected in step 5. Your backup is now complete. You can then continue to package the backup using CLEO.
    8. Click Tools > FEBE > CLEO > CLEO options. From here you can select how CLEO will save the xpi file and also the output directory. (you can put this in the same folder as the FEBE backup)
    9. Click Tools > FEBE > CLEO > Create cleopack. Give the pack a name.
    10. Click ‘Select Items To Package’. By default this will open the last FEBE backup performed.
    11. Select the items to package and click Create Cleopack.
    12. Thats it, your Cleopack is created.
  • 0 Comments
  • Filed under: Apps
  • Not for me thanks

    office 2008

    With the release of Microsoft Office 2008, its seems the blogosphere has been sent into a frenzy with reports of excited customers - why??

    As you may already no, i’m not Mr Gate’s biggest fan, however I do have to applaud his Office suite - its simple and easy to use. That is Office 2003 and not the 2007 version. Like Vista the new release of Office didn’t get the approval that Bill thought it should receive. The reason (this stands for Vista aswell) is that they tried to simplify something by over complicating an issue. Case and point - the ribbon interface!

    The second reason why Microsoft seem to fail with new product launches is the need to have multiple versions of the product (Adobe are also guilty with their CS3 suite) - why not do what Apple have in the past (Leopord) and release a reasonably priced version that does everything. The new Office suite ranges from £99 (Student & Home) to a whopping £499 for the full edition. You could buy a Mac Mini for that price and get a 60 day trial of iWork. Is there any wonder why there is so much piracy for Windows software on Torrents and News Groups.

    product-shot-office-2008-media.jpgThe third reason why I won’t buy a new version of Office for Mac is Boot Camp. I use iWork while on my Mac and have the ability to save to Office formats, and if for any reason I wish to use an Office specific function then i’ll simply switch to my Windows partition and use Office 2003 there.

    The fourth reason why I won’t upgrade is the issue of formats. Try opening an Office 2007 file with Office 2003 - enough said. However, my stubborness will be my own downfall as institutions will be forced into upgrading as they have so much invested in the Microsoft platform. My choice to not upgrade will only leave me unable to open documents in the future. A fact that we should all take seriously. Imagine in as little as 5 years time not being able to open your Univeristy dissertation because your OS no longer supports the format it was created in. For this reason, I always save work in multiple formats in order to keep all bases covered.

    I feel the future is bleak for desktop only apps such as the Office suite. The efforts of Google, Adobe and Yahoo et al, have paved away for rich internet applications that mean we are no longer tied into a single platform, application or format as well as the ability to view and edit files from any machine with a browser and internet connection. It also aids collaboration between co-workers.

  • 1 Comment
  • Filed under: Apps, Mac Info
  • Air desktop RSS reader

    air logo

    I have recently updated my Flash based desktop RSS reader to an Air application. Air is Adobe’s answer to a cross browser runtime that allows developers to further blur the divide between web and desktop.

    For this example the user can select an RSS feed and view the contents away from the browser. There are two feed’s; news and downloads. Students on my asp.net course can now use the application to quickly and easily check for new tutorials or news on the site without having to launch the browser. As Air has the advantage over the Flash Player of being able to read and write to the clients machine means that as a developer I have far greater scope for the app. In theory I could initiate a download to a specified folder as soon as the app is launched, meaning that the user automatically has the lastest tutorial resources (at present the user can click a link to get the resource).

    I am still very new with the whole Air thing, but so far I like it a lot.

    There is a built in installer, which makes the process of getting the app a lot easier.

    To check my app out for yourself download it from here. (you will need Air aswell)

  • 0 Comments
  • Filed under: Apps, flash
  • Mac & Prism

    Prism Logo

    Following my implementation of a Flash based desktop widget for viewing RSS feeds, I decided to experiment with Mozilla Prism.

     

    This idea is simple; rather than having to load up a web browser and type the url to a web app, you can instead create a mini app of it on your desktop. So for example, clicking on the icon for Facebook, will load that and only that into a stripped down web browser. No buttons, menu bars or tabs getting in the way, just simply the page you want.

     

    To get more info, check out the Mozilla Labs blog, where you can also download a beta version for Mac (there are Linux and Windows flavours aswell, however the Windows version I tested doesn’t yet support Flash).

     

    I have set this up to work with my main site, and in conjunction with cookies, allows you to go straight to your mySizzla account, where you can have access to your documents and calendar.

     

    This is great, for when you want to get to your favourite web2.0 app, quickly and easily. The added advantage of the dock means that you can launch a web based app, just as you would a desktop based one. The line between web and desktop is starting to blur and merge. In my opinion this is great, as we will no longer be tied down by a platform or specific format - a.k.a the .doc format and the issues between the new 2007 version and now old 2003 versions (typical Microsoft)

     

  • 0 Comments
  • Filed under: Apps