Archive for April, 2010

alaint

Open Source Media Framework (OSMF) Helloworld example in Flex 4

Wednesday, April 21st, 2010

By Alain Thibodeau – Consultant

If you have ever built a video player from scratch you know the hard work that is involved. The Open Source Media Framework helps developers to create video players using best practices and avoid solving the same problems over and over, saving time and money. You can learn more about OSMF at this website.

OSMF ships with Flex 4

OSMF comes with Flex 4.  This is great, but the included version is an earlier version of OSMF. At this writing, the version of OSMF is v0.93 sprint 10. This version includes several changes since the version that ships with Flex 4. You’ll need to remove the osmf.swc from the Flex 4 SDK and add the proper osmf.swc in your project libs folder. Download the latest OSMF files here.

Making the example work in Flex 4:

1. Make the HelloWorld.as extend UIComponent instead of Sprite.
2. Create a project MXML file and create an instance of the HelloWorld class in either AS3 or in MXML. I show both ways below, but I’ve commented out the MXML way of doing it.

Example code: main.mxml

<?xml version="1.0" encoding="utf-8"?>
<s:Application
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:local="*"
    minWidth="955"
    minHeight="600"
    creationComplete="init(event)"
    >
    <fx:Script>
        <![CDATA[
            import mx.events.FlexEvent;
            public var helloWorld:HelloWorld

            protected function init( event:FlexEvent ):void {
                helloWorld = new HelloWorld();
                addElement( helloWorld );
            }
        ]]>
    </fx:Script>
    <!--<local:HelloWorld />-->
</s:Application>

Example code: HelloWorld.as

/*****************************************************
 *
 *  Copyright 2009 Adobe Systems Incorporated.  All Rights Reserved.
 *
 *****************************************************
 *  The contents of this file are subject to the Mozilla Public License
 *  Version 1.1 (the "License"); you may not use this file except in
 *  compliance with the License. You may obtain a copy of the License at
 *  http://www.mozilla.org/MPL/
 *
 *  Software distributed under the License is distributed on an "AS IS"
 *  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 *  License for the specific language governing rights and limitations
 *  under the License.
 *
 *
 *  The Initial Developer of the Original Code is Adobe Systems Incorporated.
 *  Portions created by Adobe Systems Incorporated are Copyright (C) 2009 Adobe Systems
 *  Incorporated. All Rights Reserved.
 *
 *****************************************************/
package {
    import flash.display.Sprite;

    import mx.core.UIComponent;

    import org.osmf.containers.MediaContainer;
    import org.osmf.elements.VideoElement;
    import org.osmf.media.MediaPlayer;
    import org.osmf.media.URLResource;
    /**
     * The simplest OSMF application possible.
     *
     * The metadata sets the SWF size to match that of the video.
     **/
    [SWF( width="640", height="352" )]
    public class HelloWorld extends UIComponent {
        public function HelloWorld() {
            // Create the container class that displays the media.
            var container:MediaContainer = new MediaContainer();
            addChild( container );

            // Create the resource to play.
            var resource:URLResource = new URLResource( "http://mediapm.edgesuite.net/strobe/content/test/AFaerysTale_sylviaApostol_640_500_short.flv" );

            // Create the MediaElement and add it to our container class.
            var videoElement:VideoElement = new VideoElement( resource );
            container.addMediaElement( videoElement );

            // Set the MediaElement on a MediaPlayer.  Because autoPlay
            // defaults to true, playback begins immediately.
            var mediaPlayer:MediaPlayer = new MediaPlayer();
            mediaPlayer.media = videoElement;
        }
    }
}
alaint

Let’s not forget about the projector!

Friday, April 16th, 2010

By Alain Thibodeau – Consultant

No, I am not talking about the projector for your next meeting, but the Flash projector. A Flash projector allows a user to view the flash content on their local computer instead of in a browser. It seems that with the coming of Flex and Air, the Flash projector has taken the back seat. But, there are some times when creating a projector is a good option. Projectors are platform dependent and can be published from the Flash IDE for PC or MAC.

In the Flash IDE you specify to export a projector in the publish settings and click publish.

export

If you don’t have the Flash IDE and work in Flex, you can also create a projector. Assuming you have the flash player installed on your computer, double click on your SWF file then select the file menu and Create Projector. Give your projector a filename and click the save button.

export2

Projector options are set using fscommand and allow you to create full screen projectors and adjust scaling for example. You can use fscommands in your Flex or Flash code. For more information about fscommand and what it can do, read up on the docs here.

Derek Santos

Quality Assurance & Testing with Flex 4

Thursday, April 15th, 2010

By Derek Santos – Consultant

Quality is becoming more and more of a concern for Rich Internet Applications. As these applications become more popular and equally more complex, it is important to take quality concerns just as seriously. With Flex 4, it has become easier to adopt a workflow that can produce applications at a level of quality that end users and stakeholders can expect. In particular, FlexUnit 4 is great tool that is well suited to Test Driven Development.

The slides available below are from a presentation I have delivered at the Toronto Flex User Group. The slides cover Quality Assurance in general, but also which tools are suited to the job. FlexUnit 4, Ant, CruiseControl, FlexCover and FlexPMD make a great combination and when integrated together can result in a highly productive and quality driven workflow.

You can download the slides and source code below.

QA & Testing Slides
Source Code

edv

SharePoint 2010: Get Informed, Get Ready – Apr 27, 2010

Monday, April 12th, 2010

New Toronto Group and Microsoft are pleased to announce a new seminar showcasing SharePoint 2010, the latest version of Microsoft’s Business Collaboration Platform for the Enterprise and Web.

This seminar will introduce the new features of SharePoint 2010 and discuss how it helps organizations to collaborate internally and to more effectively work with partners and customers.

SharePoint addresses many collaboration and communication challenges that can restrict business productivity. During this seminar you will learn about – and see a live demo of:

  • The many benefits and capabilities of SharePoint 2010
  • Ways to customize your SharePoint deployment
  • Silverlight and how it can further enhance the SharePoint user experience

Mississauga: April 27, 2010: 8:30pm – 12:00pm – Microsoft Mississauga office, 1950 Meadowvale Blvd.

To register: http://ntg.mmalliance.acrobat.com/spapril27/event/registration.html
For more details, please call 866-464-7790 x.4041