DIGG IT!
Published
Friday, September 26, 2003
at
8:49 AM
.
I found a solution to a longstanding problem in Flash. In all players, flash does not recalculate the value of _droptarget unless the mouse is moved. The only exception to this rule is when startDrag() is called initally!
In PowerSDK, startDrag() is called via a setInterval, thus _dropTarget is always dead accurate. This is especially true given that PowerSDK is loaded into a high layer _level10000.
Now the problem has changed, startDrag() and stopDrag() no longer work! But wait, there is a fix for that too!
To provide dragging functionality, I rewrote a mirror drag method that supports dragging many items at once.
mymc.drag(0) // no snap to cursor
yourmc.drag(1) //snap to cursor
Let me repeat that: Dragging N movieclips at once with constraints on each clip! Wow, that was easy!
Here is a great example:
http://www.powersdk.com/sample/v16/drag.html
Why would PowerSDK want to know the correct _droptarget?
In order to send contextual onTarget events, I needed to know the _droptarget. Watching changes in _droptarget value, then becomes a great source of events allowing the detection of onTargetRollOver and the mirror onTargetRollOut. Here are the supported events:
MovieClip.onTargetDouble (timer)
MovieClip.onTargetDragDrop (dropee)
MovieClip.onTargetDragOut (dragee,to)
MovieClip.onTargetDragOver (dragee,from)
MovieClip.onTargetEnterFrame (timer)
MovieClip.onTargetKeyDown (code, ascii)
MovieClip.onTargetKeyUp (code, ascii)
MovieClip.onTargetMouseDown ()
MovieClip.onTargetMouseUp ()
MovieClip.onTargetMouseMove (timer)
MovieClip.onTargetPress ()
MovieClip.onTargetRelease ()
MovieClip.onTargetReleaseOutside ()
MovieClip.onTargetRightMouseUp ()
MovieClip.onTargetRightMouseDown ()
MovieClip.onTargetRightMousePress ()
MovieClip.onTargetRightMouseRelease ()
MovieClip.onTargetRightMouseReleaseOutside ()
MovieClip.onTargetRollOut (to)
MovieClip.onTargetRollOver (from)
http://www.powersdk.com/sample/v16/dragdrop.html
The events pass data too. These arguments make it easy to do great things with very little code. They are especially handy in components as they reduce the volume of event handling code and allow movieclips to detect subtle changes in focus without adding anything to a class.
Much more to come!
Ted ;)
DIGG IT!
Published
Thursday, September 25, 2003
at
11:42 AM
.
PowerSDK version 16 is released and resolves issues with F7 Player compatibility. I strongly recommend you upgrade to this release as it resolves some longstanding errors and introduces a bunch of new functionality. V16 is a ground up rewrite of the powerSDK framework and incorporates many changes since last release.
Look before you leap >> Online Examples
Download PowerSDK Version 16 + Examples
Download PowerSDK Cummulative Releases 14, 15, 16 + Examples
Open Source Software License
Development Listserv
Documentation
Changes:
Version 16 changes player internals big time! Actually the entire MovieClips.prototype has been rewritten and supports some great high level functionality on top of the inner player methods. The changes are backward compatible with the old methods with some new functionality mixed in. These changes simplify the process of handling MovieClipDatatypes within Actionscript. Here is a sample of the new attach method:
_level0.attach({_name:'ted', _class:'window'})
//attach a window from the library
_level0.attach({_name:'dog', _depth:'bottom'})
//attach an empty movieClip
//delete the movieClipdatatypes
delete _level0.ted
_level0.dog = 'No More Dog MovieClip'
In the above example, MovieClipDataTypes are now just like any other data object and can be overwritten without special handling methods, even by strings or delete. Depth management is also automatic allowing you avoid depth overwriting errors. It takes some getting used to and is specifically intended to make applications easier to author. V16 also has a new set of contextual events allowing you to use onTarget Events. These events combine standard events with the context of the cursor target. These events tend to simplify components and reduce the volume of code thus allowing for easier authoring. Plus they are easy to interactively overwrite by reference. Here is a sample:
_level0.onTargetRollOver = function(id) {trace('I took the focus from '+id)}
_level0.onTargetRollOut = function(id){trace('I lost focus to '+id)}
_level0.onTargetDragDrop = function(id){trace('You dropped '+ id +' on me!')}
_level0.myMC.onTargetRollOver = function(id) {trace('I took the focus from '+id)}
_level0.myMC.onTargetRollOut = function(id){trace('I lost focus to '+id)}
_level0.myMC.onTargetDragDrop = function(id){trace('You dropped '+ id +' on me!')}
When events are easier to detect and are in context with the target, it makes for allot less code. It takes some getting used to.
Special thanks in no particular order: Robert Penner (com.penner.math, com.penner.color), Branden Hall(string, XMLNitro), Elvis Mehmedovic(com.powersdk.ras), Erik Westra(com.powersdk.ras functions!), Alex Bradley, Timothee Groleau(cExtends), Owen Van Dijk, Jos Yule, Jim Cipriani, Ryan Eatmon (Jabber Pro!), Mark Wing, Brenda Long-Brown, Weberize Team, Nashville TMUG, Sunny Hong, Alain Moran, Ivan Dembicki(com.powersdk.xmlpath patch), Axexo Team, Pepsi Team, Warner Team, PSDK List members, and countless others for your emails, thoughts and ideas. You helped, Thanks!
We are about 1 month from the release of Version 17 of the framework paving the way for an alpha release of PowerSDK:FLOW. My current consulting gig ends on Tuesday and I will be working 110% on PowerSDK:FLOW and PowerSDK:VIEW. Hopefully both of them will fundamentally change the way you develop.
PowerSDK:FLOW >> Runtime XML Applications in the Flash Player
PowerSDK:VIEW >> A server for team software development
I guess you could say I finally have my priorities in order.
Onward through the fog!
Ted ;)
DIGG IT!
Published
at
5:59 AM
.
Visustin takes code and generates a procedural flow chart of code. It works with many languages (JavaScript, Jscript.Net, VB, Java) and is essentially compatible with Actionscript. Here is a snapshot of the software digesting a PowerSDK method.
Trial Download
Enjoy,
Ted ;)
DIGG IT!
Published
Wednesday, September 24, 2003
at
9:39 AM
.
One of the features of python is the ability to treat strings as an array. As this would be useful in AS so I wrote an addition to the string class to handle this functionality via __resolve.
Here is some sample usage:
//Test Cases
myString = "Hello World"
trace(myString) //Hello World
trace(myString[0]) //H
trace(myString[1]) //e
trace(myString[-1]) //d
trace(myString[-4]) //o
trace(myString['0:7']) //Hello W
trace(myString['1:8']) //ello Wo
trace(myString['2:9']) //llo Wor
trace(myString['6:']) //World
trace(myString[':5']) //Hello
**WARNING - This distorts inheritance, use with caution.
**Any patches to address this issue would be most welcome.
Download the Sample
Cheers,
Ted
DIGG IT!
Published
Monday, September 22, 2003
at
4:20 PM
.
I've been dreading installing an HTTP Server on 15 XMLSocket servers just to serve the crossdomain.xml file to support changes in Flash 7. After getting frustrated at Macromedia, I focused on finding a solution that was simple and cost effective. Left with very few cost effective options given time & money, I rolled my own HTTP Server. ;)
http://www.powersdk.com/download/FCHS.py
The server is written in Python in 20 lines of code and runs on Windows, Unix, and OSX. The server only serves the embedded crossdomain.xml file, regardless of the url you enter. You start the server as follows:
//Path_to Python Server_File Server_Port
Python FCHS.py 80
Open the file into a text editor, edit the crossdomain file, and fire it up from the command line. It works great and will save you a world of time configuring apache.
Enjoy,
Ted ;)
DIGG IT!
Published
Saturday, September 20, 2003
at
8:05 AM
.
I have fielded so many questions about FLOW and PowerSDK that it is time to show a bit more of what we have been working on.
FLOW is a runtime execution framework for XML based component applications within the Macromedia Flash Player. FLOW allows you to author component applications quickly and integrate them into existing Flash applications or vice versa. FLOW executes within the existing F6 and F7 players allowing wide deployment. FLOW is scheduled to be released next year.
FLOW consists of several parts:
1. FLOW Runtime - The core files that make FLOW work including : Component Loader, Actionscript Interpreter, and XML Rendering Engine
2. FLOW Components - A collection of FLOW runtime components and classes that can be imported as needed by an application
3. FLOW Builder - IDE for building FLOW based applications. The FLOW IDE is a FLOW application.
Here is how you integrate FLOW into an application:
1. Within a SWF, import the FLOW runtime(swf) into a high layer
2. At a movieClip, render a FLOW XML application:
_level0.myMoviClip.render(FlowXML)
3. The FLOW application is now executing.
FLOW XML is a combination of ZUL(Mozilla) and Actionscript that work together to create an application or application interfaces within a movieClipDatatype at runtime. FLOW contains an interpreter and can execute code blocks within XML without compiling to swf bytecode. FLOW uses a form based paradigm similar to Visual Basic and Delphi. A developer designs application forms and scripts forms and components into a working application. FLOW components and forms provide persistence by default, so making complex applications is as easy as putting a component on a form. Regardless of how many times you render the form, the data will persist between rendering, unless you don't want it to. The FLOW rendering engine is extensible as you can add components into your FLOW runtime and render them into a custom application. Unlike other authoring approaches, FLOW executes on the client side and doesn't require a server like Laszlo or Royale yet allows you to easily share runtime components across applications. All in all, FLOW is simply another way to author RIA applications that execute within the Macromedia Flash Player.
I will be showing FLOW at Macromedia MAX in November during my session on components. I hope you can make it.
Much more to come.
Cheers,
ted ;)
DIGG IT!
Published
Wednesday, September 17, 2003
at
8:03 AM
.
One of the more difficult tasks in making a good runtime model for Flash is deciding how to package code for reuse. This is especially true considering the many dependent classes and managers needed when using MX 2004 components.
Ideally adding a runtime framework to the Flash player should be easy and require as few calls as possible. Here is how this is done in PowerSDK.
1. Load PowerSDK version 18 into _level1000
loadMovieNum ("/PSDK/18/core.swf", 1000)
PowerSDK uses the file system or URL to allow the framework to be reused across applications. The URL above allows you to specify a framework version to use in your application and to specify where the folder is located. Once 'core.swf' loads, it will proceed to load other components based on the URL path to itself. So long as the framework remains in the organized structure, you don't have to worry about a thing. In this case, the call is loading version 18 of PowerSDK to an arbitrary layer 1000 of the player. This is typically the first call in every one of my applications.
The core.swf also sorts code based on player version allowing you to support the current player version and the one prior. In this case, F6 and F7 are supported by PSDK. So if you loaded a component at a path 'com.macromedia.mx.core.view' it would be located at these 2 locations:
/PSDK/18/6/com/macromedia/mx/core/view.swf
/PSDK/18/7/com/macromedia/mx/core/view.swf
Although these 2 swfs have the same name, they are compiled for optimized use with a particular player version. When core.swf (f6) loads it uses the player version to load components from the correct file system. This allows you to develop to a common model, but deploy to an optimized player. This is very different to developing to the weaker player model as it allows performance to be optimized where it can be yet maintain backward compatibility to a feasible extent. Mostly it helps combat the development problems associated with legacy support.
2. What to import and how to import it
PSDKImport = new XML('')
The new PowerSDK framework supports 2 loading properties, pre and post defined in an XML Object. PRE allows you to load components in advance of the init() execution. POST are loaded as soon as init has executed in the order within the XML object. There is also some other functionality, but I will get into that later on!
Another important consideration is dependencies. When you load a component, the component should inform the framework about its dependencies prior to instantiation. Instantiating a class without a superclass causes all sorts of problems at runtime. Ideally the framework should handle the leg work needed to make this happen without user intervention. In PowerSDK, I use callbacks to denote a dependency in a recursive manner:
// within the component 'com.macromedia.mx.core.view' we denote the following dependencies
// 'com.macromedia.mx.core.UIComponent' and 'com.macromedia.mx.core.UIObject'
PSDK.import('com.macromedia.mx.core.UIComponent')
PSDK.import('com.macromedia.mx.core.UIObject')
After all of the dependent components are loaded, the _global/_level0 instances are created in reverse dependency order via the framework. Inside each component SWF the class is declared within a wrapper init() method that places the instance into _global or _level0. This organized preloading and instantiation allows the application to load as little as possible via a simple developer interface. It also makes your components smaller as they can depend on other components for services and functionality. This sort of breaks some rules for componets (encapsulation) but it is very effective.
3. Initialize the application with an INIT method
init = function(){}
Once this is complete, the player is conditioned for runtime reuse. All in all I have found the PowerSDK framework invaluable as it allows you to reuse solutions via the Player not by the Authoring IDE. Most importantly, it make reusing code across applications easy and keeps your applications small and tight.
On Components - I have a distorted view of what a component it. I view a component as "a reusable unit of deployment". This means that anything that can be deployed into a swf is eligible. How it is organized internally is up to the developer, externally it must be able to be reused in an organized manner. Although this may rub some people the wrong way, this view has helped me surmount many problems that a purist OOP outlook would not have permitted. There are many ways to write software, none of them are wrong. Each has advantages and disadvantages in certain situations and each is just another option along the road to a completed project.
Cheers,
ted ;)
DIGG IT!
Published
Friday, September 12, 2003
at
9:54 AM
.
Here is a fun test with the new component model. This shows how to handle direct events. I break events into 2 types, those that happen when something occurs directly (direct) and those that are received through an event broker(indirect). The two models are different yet both are handy in certain cases.
Here is a sample for Direct Events with the new Components
1. Add 2 button components to the stage named 'but1' and 'but2'
2. Add the following actionscript to the keyframe
but1.label = "Button 1"
but1.clickHandler = function(){trace('Click But1')}
but1.keyDownHandler = function(){trace('keydown But1')}
but2.label = "Button 2"
but2.clickHandler = function(){trace('Click But2')}
but2.keyDownHandler = function(){trace('keydown But2')}
3. Compile
You should receive traces from the 2 buttons. You should also note that keyboard events are active when a component has focus, otherwise you do not receive them. Unfortunately clicking on the stage doesn't clear focus, but that is easy to change via _level0's inheritance by making it a component too. ;)
You can use this syntax to get direct events from the components.
{event name}Handler = function(){}
unloadHandler = function(){}
moveHandler = function(){}
resizeHandler = function(){}
You can also add direct events directly to the component:
1. Click the component
2. Actions Panel
on(click){
trace('clicked')
}
These components sure look great! More options, cleaner programming syntax and better events.
Also watch out, there is a potential gotcha in subscribing to events. The events are fired as listed and need not have the 'on' prefix FUI events. When the docs say click, click is the event name. Here is a sample:
1. Add a button named 'but1'
2. Timeline Actions
ml = {}
ml.click = function(){trace('Listener Click')}
but1.addEventListener('click', ml)
or (new)
click = function(event){trace('Listener' + event)}
but1.addEventListener('click', click)
You no longer need to nest events is a fixed object structure. That has to be one of my favorites.
Fun, Fun...
Cheers,
ted ;)
DIGG IT!
Published
at
7:03 AM
.
We all know the basis of money is time. It would be nice to be truly self-sufficient but in this modern era, that is difficult to do. I certainly have no means to create the power, water, or the coffee that I consume. The only thing I can do is focus on using my time efficiently and being fairly compensated for my time. I exchange my time for money in order to purchase time spend by countless others making the products I depend on.
So what is software? I view software as time. In most cases, software's primary intent is to automate and process data to save people time. The more time software saves, the more valuable it is. Take a spreadsheet, can you imagine performing calculations by hand? Take Blogger (the software I am using now), I write into this little text box via keyboard and it publishes a site for me at the push of a button. Attempting to do this on my own would take time, time to write, time to spellcheck, time to format, time to archive, time to make an RDF file to syndicate to you, and time to FTP everything into place. Blogger allows me to enjoy writing daily without taking much time.
Next time you sit down to write software, focus on saving the end user time. You will find the software you write is infinitely more valuable. Your customer/employer will wonder why it is so great and you will find your time is more valuable to others. I guess if software is time, then I save people time for a living.
Cheers,
ted ;)
DIGG IT!
Published
at
6:09 AM
.
"Love Is A Burning Thing, And It Makes A Fiery Ring, Bound By Wild Desire, I Fell Into A Ring Of Fire" - Johnny Cash.
I vividly remember sitting in front of my fathers Vietnam Era Sony Reel to Reel and listening to recordings of Johnny Cash. My childhood was filled with his music and I continue to enjoy his artistry even today.
Johnny Cash passed this morning in Nashville, Tennessee at age 71.
DIGG IT!
Published
Thursday, September 11, 2003
at
9:50 AM
.
Aren't components great. Unfortunately the Flash community is only seeing 1/2 the picture. Maybe that should change...
In MX2004 and MX components are authortime in that they focus on assisting the developer before a project has been compiled. This form of reuse is beneficial to most projects but runtime components have some distinct advantages and have a proven history in other software markets.
Advantages:
1. Units of Deployment - Runtime components sit in an organized manner on a file system or web server ready to be imported into the Flash player at runtime. When a component is needed, it is imported, configured, instantiated, and later destroyed.
2. Late Binding - The later you bind a component into a runtime environment (flash Player) the more flexible the implementation. A runtime model allows importing a wide selection of components at runtime. Actually one could argue that the current authortime model is fully bound at compile time and thus limited at best.
3. Application Size - Since runtime components are imported externally, they need not contribute to the base applications size. The current MX authortime approach is identical to shipping MFC (Microsoft Foundation Classes) or the Java Swing library with your application. This is not an ideal practice and makes your applications bloated. In an online environment, this is even more troublesome. One big plus here is that components can be used across applications and even within other components with even less bandwidth burden than a single app. This is essentially a reuse multiplier as the browser cache acts as a repository for components that have already been loaded. Loading a component again is nearly instantaneous as it is on the local machine and doesn't require network operations.
4. Versioning - Runtime components operate on a URL as such they can be easily versioned. This allows a legacy application to continue to use the components it was built to support although each component has been upgraded many times. Ideally an application author can select the specific version of the component needed allowing conflicts to be minimal.
Disadvantages:
1. Framework - There is little software to assist the developer in terms of implementing an effective runtime model in Flash. IOLib, Outlet (Bhall), PowerSDK have made progress in this regard but things could be better and much simpler for the end developer. Ideally it could be this easy:
//load allows passing a configuration data
MC.load( path, InstanceConfig )
//load a MM ComboBox version6 into this movieclip
myMC.load( 'com.macromedia.listbox.6', {data:[1,2,3], labels:['One','Two','Three'], editable:false, rowcount:2, enabled:true, visible:true, minHeight:100, minWidth:100})
Fun Eh....
To make that happen, you need to manage loading a swf, brokering the loading of classes in dependent order and handle instantiation. Not an easy feat at runtime, but it is possible!
2. Component Interface Standards - There is no standard way to import, configure, instantiate and destroy a component loaded externally. The events and base code needed to make this work has not been established so that many components can work together under a common model. The basics of the MovieClipDatatype provide a fantastic foundation.
3. No components - Currently there are no components that are configured to operate in a runtime fashion. Although it is easy to port FUI or FUI2 components to a runtime model, we still lack the public interface to support this effort.
In a perfect world, the flash community could come to open agreement for a runtime component interface standard. This standard would allow many component authors to build components to a runtime standard and essentially create a market for runtime swf components, including components that ship within Flash MX and MX2004. This standard would consist of a standard set of events and methods that could be fired to make a component work once imported. These components should also expose the public interface to the developer for development and documentation purposes.
It is worth noting that with runtime components it is useful to provide developers with design-time controls to assist during development only to implement the runtime component model at compile time. This covers the best of both worlds allowing flexible deployment with flexible authoring.
If anyone is interested in discussing this further please email me. I would be willing to assist with the establishment of standards for runtime components as it would be infinitely valuable to a project at hand. After all component systems are only as good as the quality and quantity of components they contain.
Cheers,
ted ;)
DIGG IT!
Published
Wednesday, September 10, 2003
at
6:43 AM
.
Macromedia,
The implementation of Cross Domain security is decidedly poor in Flash Player 7. Unlike prior incarnations of the player this feature is not backward compatible and represents a horrible break from the norm of supporting older SWF content. Although great in concept, this change requires developers edit and reconfigure old content to be supported in the Flash 7 Player. This is the first case where the Player breaks this all important rule.
In the next month, I will get 10-15 phone calls from customers complaining of broken applications and errors in applications PowerSDK provided. We typically separate data services into its own sub-domain for scalability purposes allowing database and application server to scale effectively and not conflict with serving binary http content. Under the security model changes sub-domain are no longer allowed to be accessed and require changes to servers and to SWF content. Worse still is when these failures occur, you consult the end user who typically knows nothing about what is occurring.
I reported these errors during the beta process. Obviously you didn't listen.
In an ideal world, legacy SWF content would operate on the old security model and new F7 SWF content would operate on the new security model. I understand your wanting stricter security in regard to Flash, but crippling legacy content made according to your guidelines is a poor decision any way you cut it.
If there was a primary selling point for using Flash from a consulting standpoint it was backward compatibility, but maybe that isn't important to Macromedia anymore.
Please address this issue.
Theodore E Patrick
CEO / Founder
PowerSDK Software Corporation
DIGG IT!
Published
Tuesday, September 09, 2003
at
9:31 AM
.
What is Momento? Momento is a design pattern that allows an object/component to externalize data providing persistence between instances. This is essential when you want to restore state to an object or component between sessions or sub-session. Ideally, a momento enabled component/object could be instantiated, modified, destroyed, and later restored to the identical state prior to destruction by passing an id.
First question you are asking is: why would you do this? I have been working with a small team of developers on a new product called PowerSDK FLOW. FLOW is runtime development framework for executing XML based applications in the Flash Player. It is based on the
PowerSDK Framework and extends our open source prior work. In designing FLOW, we needed to manage state within an application and its components. FLOW loads an XML application definition, loads required components, and then writes components to a movieclip. Using a recursive pattern, these movieclips or "Forms" are overwritten as needed by the application. Overwriting mc's mirrors the development paradigm of keyframes but in this case it is implemented at runtime not at authortime. In overwriting forms, state is lost unless we use momento enabled components.
Momento functionality is confusing, especially given that inheritance and other component features needed to be supported. We decided early on that the best way to get seamless functionality was to insert an momento object between a component/object and its prototype. At first this seems problematic but using the __proto__ property pattern and the super keyword it was relatively painless to transform existing components. Here is a diagram of what we did.
Essentially we create a repository and fill it with component instance data(Momento Objects). Momento objects are just plain old objects with the exception that the component constructor has been executed within their scope. We also decided that separating of a component class and the GUI would be good practice. This allows a developer to create an external component skin and reuse a common class. In this case, component architecture is closer to
Ghostwire Components (AKA Sunny Hong) rather than MM FUI although both are functional with momento. You can also use components outside of FLOW with just PowerSDK(18) as follows:
myComponent.load({_class:mTextfield, _url:})
Here is an early version of a FLOW application.
In a FLOW enabled Flash Player simply call:
_level0.myapp.render(flowXML)
//movieclip prototype method
In this application, the textfield in both dialogs shares an id value of "_global.momento.name". The first rendering of this component creates the momento instance and the second reuses the instance to render the textfield to screen.
FLOW is scheduled for release next year as a subscription service (no pricing as of yet). If you have any questions about FLOW or PowerSDK, please don't hesitate to ask me.
If your interested in FLOW, I will be speaking at
Macromedia MAX in November on
Component-Oriented Development w/MACR Flash (CS302W). Stop by the session to see more on FLOW and other component techniques. It should be allot of fun now that the demos are working with Momento.
Cheers,
ted ;)