Coded

February 27th, 2008

Running PaperVision3d 2.0 Example in Flex3

Posted by Ben Honda-Rottler in Actionscript, as3, flex, code, Papervision, example

I’ve been using Flash library clips in my Flex apps for a while now, using Embed in AS3. This is just an example of how to apply that approach to a pre-existing Flash Actionscript3 project (like the one in the PV3 2 repository, Mouse3D).

Really, it’s not that difficult (once you figure out the steps):

1) import the latest PV3D libraries

2) import the Mouse3D .fla

3) create a Canvas.as class file to hold the Canvas MC.

4) create a Main.as class file to hold the core code from the sample

5) create a .mxml container app to hold all the AS code

folder cap

Code samples:

// Canvas.as by Ben Honda Rottler
 
package
{
import flash.display.MovieClip;
[Embed(source="/Mouse3D.swf", symbol="Canvas")]
 
public class Canvas extends MovieClip
{
public var surface : MovieClip;
 
public function Canvas()
{
}
 
}
}

The Canvas Class is essentially a holder which pulls in the MC from the .swf library. You can extend this as well, which is very useful in practice. Next, the MXML container:

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" layout="absolute"
applicationComplete="init()" backgroundGradientColors="[#FFFFFF, #FFFFFF]" backgroundColor="#FFFFFF" frameRate="60">
<mx:Script>
 
 
public function init() : void {
var main : Main = new Main(this.holder);
}
 
 
</mx:Script>
<mx:Canvas width="640" height="480" id="holder" top="20" left="60"></mx:Canvas>
</mx:Application>

I won’t repost all of the Main.as code, as it’s mostly the same as what’s in the example, except for a few tweaks to add the object to the Display stack. Also note that Main itself needs to be changed from a MovieClip to a UIComponent. Enjoy.

public class Main extends UIComponent {
 
// ___________________________________________________________________ 3D vars
public var viewport  :Viewport3D;
public var scene     :Scene3D;
public var camera    :Camera3D;
public var ball	 	 :Sphere;
public var gismo	 :Cube;
public var renderer  :BasicRenderEngine;
public var mouse3D   :Mouse3D;
public var vMouse	 :VirtualMouse;
public var surface	 :Sprite;
public var ref : UIComponent;
 
public function Main(tref : UIComponent) {
ref = tref;
init();
}
 
public function init():void {
ref.addChild(this);
 
init3D();
 
addEventListener( Event.ENTER_FRAME, loop );
 
}
January 8th, 2008

No SDK error on Flex3 Beta3

Posted by Ben Honda-Rottler in as3, flex

Dropping a little note that might save someone some time. I was trying to transition my files over to Flex3 Beta3 and was getting a Root error and Flex complaining about not having any SDKs. We’ll it was a fresh install, and I visually verified that there indeed was a Flex3 Beta3 SDK in the SDKs folder. So what gives?

I don’t know if this is a byproduct of having installed all the previous Betas, but it turned out I needed to to go to Preferences > Flex > Installed Flex SDKs and choose Reset SDK List.

November 9th, 2007

Deleting svn / locked files off of OS X

Posted by Ben Honda-Rottler in unix, code, hint

Lately I’ve run into Flex barfing errors at me about privileges with various svn files. It was driving me mad, and I found this great post on some useful BSD commands:

http://www.braveworld.net/riva/Software/locked.html

chflags -R nouchg {folder name}

worked like a charm. I could now delete, move, etc. Wonderful! Also useful ways to list all items, (including hidden items) with

ls -lo

For those not used to using the Terminal app, you just open up Terminal, cd /Volumes/MyVolume/ and then type the above commands. Hopefully this post saves someone else some time. Cheers.

November 6th, 2007

hypemachine + songbird = joy

Posted by Ben Honda-Rottler in UI, desktop, beta, software, music, social, sharing, web2.0

Ok, non-Flash post. But I gotta give shouts to the developers of these two applications, one web and one browser.

Use hypem to find tracks, then Songbird to scape them off the web. Beautiful. It’s re-invigorating my music listening habits. I still use Last.fm and Pandora, but the immediacy of being able to find and download tracks just can’t be beat.

Really great interfaces on both, although songbird could be a bit snappier on the render speed. Still, not bad at all.

November 1st, 2007

Some random thoughts on AS3

Posted by Ben Honda-Rottler in Actionscript, as3, flex

I was poking around looking for some nice, clean, clear, z-order postings when I came across Jesse Warden’s post on AS3 evolution. It got me thinking. I have been dealing with many of the issues that he describes, and still am. AS3 has been a tremendous boon in many ways : the DisplayList, the debugging provided by Flex (love it), improved CSS support, etc.
I also, though, have been having some issues with speed — as a ‘rapid prototyper’, my design team could care less if my code is beautifully implemented. Bottom line, it needs to work, and work fast.

For the next rev of Actionscript, it would be great if the team focused on speed to implement, rather than making things more complex / powerful. Some of that may be simply in improving the docs, providing more examples. I am not a code system designer so I can’t say I have the answers. I can say that the ‘overhead’ of coding out a Flex / AS3 project has increased over my AS2 projects.

I also hope that Adobe realizes that there are a solid group of designer / developers out there that have no interest in developing Flex apps, but want to keep working in Flex in order to do Actionscript projects. I still get the feeling that the environment / platform is being targeted for someone other than the Flash Designer cum Developer, even though that’s what many of us are.

For instance, I want DOM-type control over Text Objects in Flash. I don’t want to navigate Text Formats and CSS Loader Objects to set a single piece of freakin text and change it’s color dynamically! Text manipulation in HTML is so much easier, why does it have to be this hard in Flash. Abstract it for me, please. I appreciate the level of control AS3 is giving me, but I want it faster, with less fuss.

So I guess that’s where I am with AS3 development. Give it to me faster, with less fuss. Things do seem to be rambling steadily towards the full-on Developer side of the world, and it would be nice if the ’scripting’, or coding side of Flash stayed accessible to the Designer. It would be too bad if Flash ended up with two types of people again - the WYSIWYG-only Flash designer and the back-end Code monkey.

For this reason, I could see the utility of a WYSIWYG-style editor that produced code, much in the way that WPF works (sort of) now. Give me something with basic interactive tools, that would allow me to make a text field, specify it’s font and color, and then spit out the code so I can plug it into a framework or Class I have stubbed out in Flex. Or something.

Again AS3 is a powerful step forward for Flash, but the tools for Designers need to keep up and provide comfortable tie-ins to the Developer world.

July 20th, 2007

AIR app: FLV player VEED update 0.2 (Drag and Drop enabled)

Posted by Ben Honda-Rottler in video, Apollo, beta, flex, AIR

Still a little over-loaded with the new job, but I did have time to update the player a little.

Added :

  • Ability to pause playback (wow!)
  • Updated for latest AIR build (cool!)
  • Added drag and drop functionality(ok, well that’s actually kinda useful)

That’s all for now, next up is resizability and audio controls. Oh, I’ve also done some stuff downloading Google feeds directly to the player, but I need mess with it more before actually including that functionality.

Here’s the link again.

July 17th, 2007

Adobe AIR for JS Developer Book posted

Posted by Ben Honda-Rottler in Actionscript, UI, flex, software, AIR

I’m sure this has been blogged, but I thought I’d make note of this great move by Adobe to provide a free download to the PDF version of the new book, Adobe Integrated Runtime (AIR) for JavaScript Developers Pocket Guide (Amazon).

Ajaxian is providing a download link here. It’s exciting to see what will become of the technology. There are plenty of options out there for developers with Google Gears, WPF, and Yahoo Widgets, but AIR has some distinct advantages and can pull from a vibrant community of Flash Developers and Designers. I think it’s this community of users / creators that can really power the success of the technology. Adobe again is doing the right thing with community outreach like the AIR bus tour.

Microsoft has realized just what sort of impact good design can have on a technology, and has moved to embrace the design + developer community, but no one has done it better than Adobe to date. Yahoo for a while now has aggressively sought out top tier designers and developers, with only Google is lagging in that area (especially designers). I just don’t see the focus on design in Google products that would draw me into building within their framework. Too much mind/body separation. You can’t argue the elegance of Google’s solutions and tools, but they still are more ‘infrastructure’ rather than front-end experience in my mind.

Anyway, great to see Adobe continueing to support the AIR development community.

June 1st, 2007

XML Loader Class

Posted by Ben Honda-Rottler in as3, flex, xml

Ok, back into the blogging fold after starting a new job and promptly sinking under water. (still am really)

I’m in the (sometimes painful) process of shifting my workflow from AS2 / Flash8 to AS3 / Flex. I’ve been finding that the debugger and code hinting in Flex are just too useful to ignore. I’ll be following up with posts on how to get your Flash files into Flex apps, as I have a few simple example that might be a bit more approachable than some of the current examples out there, but for the moment I thought I would provide a little class for loading and parsing XML.

My code is based on Sephiroth’s XML tutorial post, but there were some syntax errors I had to correct so I thought it might be worth posting and saving folks a minute or two. I also blew out his example into a proper Class, which might be useful for some to compare. Cheers.

Here’s the (very basic) class:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 
//
// LoadXML
//
//  Created by Ben Honda-Rottler on 2007-06-01. Based on original code by Alessandro Crugnola
//
package com.func
{
import flash.net.URLLoader
import flash.net.URLRequest
import flash.xml.XMLDocument;
import flash.errors.*
import flash.events.*
public class LoadXML
{
private var loader : URLLoader;
private var mainXML : XML;
public function LoadXML() {
loader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onComplete);
loader.load(new URLRequest("http://www.sephiroth.it/tutorials/flashPHP/E4X/files/test.xml"));
}
private function onComplete(evt:Event)
{
try
{
mainXML = new XML(loader.data)
trace(mainXML);
} catch(e:Error)
{
trace("Error: " + e.message)
return;
}
}
}
}
March 27th, 2007

VEED : Apollo app (Desktop Flash Video Player)

Posted by Ben Honda-Rottler in Flash, Actionscript, UI, Apollo, as3, flex, software

I thought I would share my 0.1 alpha .flv player. Original visual by Tim Wong, and tweeked by me as I built out the player.

Future releases, I plan to enable drag and drap (when Apollo supports it), screen resize, scrubbing, volume controls, and hopefully tie-ins to some of the video service api’s like Google and YouTube. (If I can get access to the actualy .flvs, and not the .html page or .swf that holds them)

Right now, it plays .flvs. That’s it. Enjoy.

UPDATE: It seems some are having trouble downloading the .air file, which doesn’t surprise me really. Here it is .zipped. Hopefully that works, please comment if not!

http://www.mediareason.com/VEED.zip


NOTE :
You need Adobe Apollo installed to run this .app.

March 19th, 2007

Apollo released - Web3.0 : the desktop

Posted by Ben Honda-Rottler in Flash, Apollo, Web3.0, desktop, beta

I’ve been intrigued by Apollo for a long time, and have looked at such programs as Zinc and mProjector as relatively easy ways to get Flash onto the desktop.

You can get the beta here. One of the things I like about Apollo is that Flash will finally have a full HTML renderer inside of it. This also will allow you to do things like bitmap effects to the HTML as it’s processed via the Flash stack.

Having played a fair amount with WPF, I can say that the promise of a truly cross-os desktop platform does have value. However, Apollo will require another download to support the .air file format, which makes it less appealling for a pure Windows environment. Any XP user with the .NET 3.0 package installed will be able to see WPF content, as well as all Vista users. Apollo is going to have to build up a user base over time, and for now purely through prompted download it seems. (Apollo won’t be pre-installed on Vista, for example, the way Flash is.) Adobe touts the high rate of adoption for Flash Player 8 (purported at 94% already) as a successful model for Apollo to follow. We shall see.

If Apollo can truly make it out to the majority of machines it could be a very, very attractive method for creating apps that can run just as happily when disconnected from the Internet as when connected; one of the biggest weaknesses of Web2.0 apps.

You can also imagine Web2.0 companies embracing Apollo for a desktop version of their app — just as Flickr and other have started to build desktop compenents to their overall experience. If Apollo hits it right, it could become the default choice for web apps when a desktop presence is required. Web3.0: the desktop.

Next Page »