SWFObject 2.2 and Safari Gotcha

Posted by Kristofer Joseph Fri, 22 Jan 2010 18:32:39 GMT

When setting the style class attribute using dynamic embedding with SWFObject, Safari will throw a parse error and not embed your Flash file. You need to use object bracket notation instead of dot notation.

Example: foo["pantyhose"] instead of foo.pantyhose

<head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <script type="text/javascript" src="assets/js/swfobject.js"></script>
    <script type="text/javascript">
        var flashvars = {};
        flashvars.event = "%2fevent_guid_1%2f";
        var params = {};
        var attributes = {};
        attributes["class"] = "flashcontent";
        attributes.id = "FlashContent";
        swfobject.embedSWF("yourHappySWF.swf", "alternativeContent", "100%", "100%", "9.0.0", false, flashvars, params, attributes);
    </script>
    <style type="text/css" media="screen"> 
        html, body  { height:100%; }
        body { margin:0; padding:0; overflow:auto; text-align:center; }   
        #flashcontent { display:none; }
    </style>
</head>

no comments |

Flex & Rails: REST Fix

Posted by Kristofer Joseph Sun, 10 Jan 2010 08:34:01 GMT

Before Rails 2.3.1 you could send a PUT request with application/xml contentType by appending ?_method=put to your HTTPServices url parameter. Unfortunately this stopped working. You can accomplish the same thing by sending a custom header of #X-Http-Method-Override# and setting it to PUT, or DELETE.

Example

If you have an update HTTPService like so:

<mx:HTTPService id="updateThing"
                resultFormat="e4x"
                url="http://localhost:3000/thing/{dataGrid.selectedItem.id}.xml"
                contentType="application/xml"
                method="POST"
                result="index.send()" />

You would add your custom header like this:

    /**
    * @private
    */
   protected function update_thing():void
   {
        var thing:XML = new XML(_thingXMLTemplate);
        thing['first-name'] = firstNameInput.text;
        thing['last-name'] = lastNameInput.text;
        var headers:Object = new Object();
        headers['X-Http-Method-Override'] = "PUT";
        updatePerson.headers = headers;
        updatePerson.send(thing);
   }

*Note the headers['X-Http-Method-Override']

Same goes for sending a DELETE. Hope this helps.

no comments |

Arduino and Flash on Snow Leopard

Posted by Kristofer Joseph Mon, 26 Oct 2009 09:22:38 GMT

I was recently inspired ( once again ) by Kevin Hoyt at the Adobe MAX unconference which was put on by FITC and Influxus. Kevin gave a talk about physical computing which showed off a few examples of real world programming. This is where you use your developer know-how to interact with the world outside of the computer for a change. We had recently been talking at work about how we needed to build a robot, so the timing couldn’t have been better.

After recently upgrading to Snow Leopard I found that most of the getting started information was outdated for getting Flash to talk to the Arduino. I’ll show you what I did so I can hopefully save you some time. Less Googleing (is that a word?) and more tinkering.

What you need to get started

  • Arduino micro controller board
    • Ebay
    • Maker Shed this is what I picked up
    • I also use the Adafruit Proto Sheild which basically extends the power outs and grounds of your Arduino (among other useful things) which makes wiring up ideas much easier. I highly recommend getting one.
  • Arduino IDE You will need this for uploading your initial firmware to the board. It also has the USB drivers needed for communication over a socket packaged with it on the disk image.
  • Actionscript 3 development environment of some sort
  • AS3 Glue The library for interfacing between Flash and Arduino
  • Firmata This is all that needs to be uploaded to your Arduino in order for AS3 Glue to do it’s magic
  • TinkerProxy 2 OSX Download link the updated proxy for talking to your Arduino over a serial port connection

*I saved all of these into a new Arduino directory under Documents. I like having all of my related assets in the same directory.

2 comments |

Monokai theme for eclipse

Posted by Kristofer Joseph Tue, 29 Sep 2009 05:05:00 GMT

UPDATE

  • I was able to fix my TextMate install. Turns out it was due to updating the default ruby installed in Snow Leopard to 1.9.1 ( So I could use MacRuby ). In order to fix this I followed Hivelogic’s tutorial on installing rails on Snow Leopard and then sym-linked usr/local/bin/ruby to the default. I know bandaid, but it works until I have the faith to try the dual ruby install method from jurisgalang .
  • I also have updated this Style to include MXML and Actionscript for Flash Builder. ( It is missing css though since I couldn’t decide ).

Monkai Flash Builder Theme

After Snow Leopard hosed my TextMate I had to go back to using Eclipse for my daily development. One thing that I did to make the transition more bearable was to port the Monokai theme I use religiously to Eclipse. Now granted it isn’t exact, but it is pretty close… close enough for me to pretend. It’s like hugging the unwashed pillow of your ex-girlfriend after she moves out, pitiful. I can’t wait until Macromates releases a fix or at least tells me how I can fix the bundles I use ( ant, actionscript, flex, cough)

no comments |

How to embed fonts from a library SWC in Flex 3

Posted by Kristofer Joseph Tue, 30 Jun 2009 18:27:48 GMT

The problem:

You have two or more Flex projects that you want to share fonts between.

Solution:

Add the fonts to a shared library project then reference them in your css… right?

  • create a new library project
  • create an assets folder?This won’t work!
  • you have to add your fonts directly under the src folder
  • Add the fonts to the swc’s build path:

    go to Project Properties > Flex Library Build Path > Assets and check the checkbox next to the font files.

  • in your project you want to use the font in link to the library project:

    go to project properties > Flex Build Path > Library Path > Add Project

The rub:

For some reason Flex Builder can’t seem to find the fonts in the library project if they are in any directory BUT src?!

Usage:

You will then be able to reference your fonts in the linked projects css like so:

@font-face {
src:url("MyriadPro.ttf");
fontFamily: MyriadPro;  
}

Hopefully this saves someone some time.

3 comments |

Multi Bitrate Live Streaming with FMLE ( Adobe Flash Media Live Encoder )

Posted by Kristofer Joseph Thu, 28 May 2009 22:02:53 GMT

How to connect to a multi bitrate encoded live stream from Adobe Flash Media Live Encoder. What follows is the easiest way to connect to a multi bitrate live stream produced from FMLE 3.0 and played back through the FLVPlayback 2.50015 component along with some tips I picked up while trouble shooting.

What you will need:

This post assumes you have all of these installed properly and you are able to connect to a single stream without issue. For information on getting started with any of these refer to their accompanying documentation. More info can be found at the Adobe Developer Connection FMS resources page including some tutorials to get you started. Any issues you find that are not covered in this post should be referred to the forums.

*Disclaimer: I am using Edgecast as my CDN. They make it very easy to find all of the info needed. Different CDN’s may vary. Things you will need to know that will be specific to your CDN are:

  • how to enable an authentication token
  • how to add your authentication token to your stream name in FMLE
  • What version of FMS they are running ( You will need 3.5 )

2 comments |

Sandboxing in Actionscript 3.0

Posted by Kristofer Joseph Fri, 22 May 2009 20:17:20 GMT

I wanted to take a minute and share a development approach I find is very useful. I call it Sandboxing. All it really is is a separate project that you do all of your figuring out in. It might seem obvious to a lot of people, but to those who don’t use this approach, it is amazing how much more productive you are once you set it up.

How to set up a Sandbox

  • Create a new project ( I use a plain old vanilla Actionscript project )
  • Create a new class for whatever you are figuring out
  • In your Sandbox class constructor add a new WhateverTheTestClassIs()
  • Comment it our once you are done ( just in case you want to reference it later )
  • Rinse Repeat

Seems dead simple I know but t keeps you focused on the problem at hand instead of mucking around with whatever larger project you are working on. I don’t even deal with packages, just throw them in the root. Fast, easy, done.

Demo Sandbox Project

1 comment |

Flex For Flash Designers

Posted by Kristofer Joseph Wed, 20 May 2009 20:43:48 GMT

As promised here are links to my slides and demo application from my talks on May 12th and 14th for SILVAFUG. The focus of this talk was creating a common language between designers ( or anyone not familiar with Flex ) and the Flex Framework. This was an introduction level talk to get people ready for Flash Builder 4 ( I love the new name ) and Flash Catalyst concepts since they will both be building on current Flex patterns.

Thanks for everyone who attended. A special thanks to all the San Jose users group members who got involved in the discussion.

Links

Resources

no comments |

iPhone inspired Flex Toggle Button Component

Posted by Kristofer Joseph Sun, 29 Mar 2009 07:16:08 GMT

Made a simple MXML based toggle button component similar to the one on the iPhone. It is pretty easy to use with full skinning support. I was wondering why no one had made this component before, since it seems like a pretty simple yet useful component. Play with it and let me know what you think. I’ll add a Degrafa skinned example soon.

To view this page ensure that Adobe Flash Player version 10.0.0 or greater is installed.

Get Adobe Flash Player

Download the demo project Here

Update I found an iPhone skin here Pretty good job of skinning.

4 comments |

AFCS ( previously Cocomo ) first impressions

Posted by Kristofer Joseph Sat, 21 Mar 2009 00:55:00 GMT

Recently I was charged with the task to delve into Adobe Flash Collaboration Service or AFCS for short. Ever since I started hearing the buzz about Cocomo ( AFCS’s previous code name ) I have been itching to give it a try. I have worked on a few collaborative applications in the past and was curious to see how they solved some of the age old problems that inevitably come up. Before I go any farther though I want to be clear that AFCS is still in BETA ( hence the labs url ) so I nor you should by any means be expecting it to be perfect. Adobe and the AFCS team have given us the treat of getting to play with some cutting edge technology, so in a lot of respects we are able to help out by giving feedback before things get set in stone. OK Enough throat clearing, let me get to it.

First impressions:

The Good

Honestly my first reaction was amazement. I was able to create a very sophisticated application which combined audio, video, chat, and a shared whiteboard in a matter of minutes.

1 comment |

Older posts: 1 2