Ramblings

January 19, 2010

Tracking Flash usage

Filed under: as3, dev, tool — michaelangela @ 7:47 pm

stats – mrdoob – FPS, MS and MEM. All in one. – Project Hosting on Google Code

This class provides a simple info box that will help you monitor your code performance.

* FPS Frames per second, how many frames were rendered in 1 second, the bigger the better.
* MS Milliseconds needed to render a frame, the lower the better.
* MEM Memory your code is using, if it increases per frame is VERY wrong.
* MAX Maximum memory the application reached.

Helpful AS3 libraries

Filed under: as3, flash — michaelangela @ 7:38 pm

Tools & Libraries at AlecMcE.com

AS3 Libraries

I use the following third-party AS3 libraries:

December 11, 2009

HP SWFScan Flash security tool

Filed under: as2, as3, flash, security — michaelangela @ 10:50 am

Too bad it’s windows only. I wonder if it would run under wine… at any rate the idea is pretty good. I’ll have to do some more reading to see if it lives up to its promise.

Register now to download FREE HP SWFScan and start securing your Flash applications

HP SWFScan, a free tool developed by HP Web Security Research Group, will automatically find security vulnerabilities in applications built on the Flash platform.

December 7, 2009

Flex… um… without Flex?

Filed under: as3, cool, flex, mxml — michaelangela @ 12:56 pm

I had just mentioned compiling MXML without using FlexBuilder and did a quick Google on it to see the current state of such integration. Wow this is pretty cool. 😛 Some neat info and projects in the comments as well including FLit.

Using MXML without Flex (Example and Source) | Ryan Campbell

I made a few minor changes to the MinimalComps project from Keith Peters and got it playing nicely with MXML. The below application compiles to a tiny 23KB yet makes use of MXML and even data binding.

Robotlegs framework and programming to an interface

Filed under: as3, cool, education, frameworks, puremvc, robotlegs — michaelangela @ 8:03 am

Actual code samples makes things make so much sense. And this is a great example of the (new to me) Robotlegs framework. I really like what I see. The following post has the same small app in several different frameworks.

Robotlegs example project with source

Any comparison of frameworks wouldn’t be complete without Robotlegs. I included Robotlegs in my session at LFPUG recently, but didn’t post the example project here because the framework was in a state of flux. Robotlegs is now settling down as it approaches its imminent 1.0 release, and the MVCS implementation in it is unlikely to change further, so here’s my example.

For this Robotlegs example I’ve used exactly the same project as in the previous examples for other frameworks. Robotlegs is not prescriptive about your application’s architecture, but it does include a default MVCS implementation for those that wish to use it. I’ve used that default implementation here.

Working with this kind of code outside of some sort of IDE or at least a well known convention could be a little baffling. For example, for this project, small though it is, sets the feeds with interfaces and not the actual feeds. This goes along with the principle of “Program to an interface, not an implementation” which is good and flexible. But to a newbie it might a bit confusing. (See here for a discussion about extending AS3 using interfaces, or rather the difficulties in doing so.)

FlexBuilder is a great IDE for AS3, granted there aren’t many. And for those with far more experience in more mature languages like Java with its plethora of incredible tools, it really pales in comparison. But it’s a far cry better than the Flash AS editors! I bring that up because I often learn code by the awesome Command+click (Ctrl+click on a PC?) to jump to the definition of a variable or a class. Opening up Flexcaster.mxml shows a context “FlexcasterContext” and a MainView. I was completely new to IoC programming with its dependency injection. So I didn’t know at that time that a context is a term commonly used in IoC. But I knew it’s an MVC framework so I figured the code I was looking for wasn’t in the view. 🙂

Clicking on the FlexcasterContext brought it up which showed where the magic happens: how everything is connected. Of note though are these two lines:

injector.mapClass( IFeedsService, OpmlFeedsService );
injector.mapClass( IFeedService, RssFeedService );

This lets me know that wherever I see IFeedsService it’s actually using OpmlFeedsService, and the same for RssFeedService and IFeedService. Through the rest of the code you won’t see any reference to OpmtFeedsService or RssFeedService. This context is the only place I would see where the connection is made. The author actually brings this issue up in a different version that also uses IoC but instead of events, it uses Signals.

All in all I think it worked out rather well. There may even be a potential future in an architecture like this. I do fear the explosion of interfaces and injection rules may make the approach unwieldy for a large project, but perhaps multiple DI configuration classes, a clear package structure and disciplined developers is all that’s required. I welcome your opinions on this.

There is more discussion there. Of course the immediate benefit of programming to an interface is that swapping out a class is a one line change instead of refactoring all affected code. Making mock data objects for the model while testing is a great example of that. It could instead be

injector.mapClass( IFeedsService, TestOpmlFeedsService );<br />

when doing tests which simply returns a preset array of data.

Overall I have to say I like the conciseness of the code. Even little things like having classes instantiated as a Singleton is cool.

injector.mapSingleton( FlexcasterModel );

The FlexcasterModel is just a class but the framework itself handles the instantiation via injection. Saying

mapSingleton

makes sure you only have one and when it is injected, only the one instance already created is passed in. As the robotlegs site says, this helps prevent the boilerplate code. I look forward to trying out the framework. I enjoyed using PureMVC once I wrapped my head around it but this, perhaps because of the conciseness, took far less time to grasp.

AS3 Iteration with valueobjects in collections

Filed under: as3, tip — michaelangela @ 7:28 am

Using valueobjects might be overkill for some really simple things that only require a couple of values where you can just throw an object together quickly. Unless speed is an issue where they strongly typed values have a lower overhead than plain objects (as I understand it). Unless you’re in a big app and you just made a change to some code and suddenly all your other uses of that object break and you’re not aware of it and null exceptions start flying and…. I digress. Having them in a set collection is great, too, for similar same reasons, plus the added ability to create convenience functions specific to that particular data set. But this post says it all very well with code to boot.

AS3: Collection, ValueObject, & Iterator

A while ago I blogged about converting Collection and Iterator classes to AS3 since storing data in ValueObjects has become a regular practice in my coding. I really like how VOs are strongly typed and how you use a Collection to hold all the data together nicely. I am working on a project right now that allowed me to see even better uses for these things so I added a couple of simple (but helpful) methods to my Collection class (most notably the ability to add an item at a specified index as well as output the data currently existing in the collection easily) and created a base ValueObject class that allows you to easily output the data in that VO.

Important to also note is the package move. I’ve moved everything into a com.reintroducing.data package as I believe this fits better with what these classes are actually doing. There is also interfaces for ValueObject and Collection as well.

Just so you don’t have to flip back and forth between posts, I’ll post the classes and data here with a little explanation of each.

December 2, 2009

DrupalService makes it easy to use Drupal as a data source for a Flash site

Filed under: as3, cool, drupal, flash — michaelangela @ 9:46 am

I had to do a quick project earlier in the year for a photo gallery tied into Drupal. I used Dash Media Player for it because of it’s built-in Drupal service integration. This looks like a great way to make an easily customizable backend for a Flash/Flex based site without having to code all the internals for the communication which of course makes a very powerful system. Looking forward to trying this out.

DrupalService as a bridge between flash and drupal at dpdk Open Source

Drupal is a multiple award winning opensource content management system. With the drupal services module, it’s possible to consume data from drupal in flash. Drupal is a very powerful tool to provide data to flash movies and with the community investing much time in drupal services, now is a great time to be using drupal to power your flash websites. Services will be part of the drupal 7 core release.

We decided to release our nl.dpdk.services.gephyr package, which is a drupal as3 service which acts as a bridge between drupal and flash and features all the power of our as3 flash remoting package. It has the core functionality of the drupal services built in and is very easy to extend and to adjust to your needs. Furthermore, it makes use of all drupals’ security mechanisms via key and session based authentication.
It has more features and packs more power than any other opensource actionscript 3 based drupal package out there at the moment, so be sure to check it out.

Flash equivalent of CSS Sprites complete with rather novel CSS control

Filed under: as3, cool, css, dev — michaelangela @ 9:33 am

This is pretty sweet. You know css “sprites”, where you load one image and restrain it with CSS constraints so that you use the one image in multiple places showing only one section at a time, etc., etc. Well this works in AS3 (i.e. not just in Flex) and it adds some pretty nifty control via CSS. It becomes a sort of way to inject stuff into visual items. Take a look at the (very complete) tutorials listed on the site for examples.

Flash Camouflage | Flash Camouflage is a framework for skinning AS 3 Applications.

Flash Camo (for short) is a graphics framework that allows AS 3 applications to be easily skinned from pngs, jpgs, or gifs. The framework is broken down into 3 core areas: Decals, the CSS Parser, and the CamoDisplay. When these systems are used together they form a powerful set of tools to help skin and style any Flash application. With Camo’s modular approach, you can use as little or as much of the framework as you want.

November 30, 2009

Dealing with floating point numbers in AS3

Filed under: as3, math, tip — michaelangela @ 8:08 am

I’ve only seen it happen occasionally but the utility functions here and also that posted by Troy further down look quite helpful.

Floating-point errors got you down? – Josh Talks Flash

Many developers will never encounter issues when floating-point math fails to return the correct result. Every once in a while, when you’re expecting to see a number like 10.1 in your trace panel, you might actually see 10.1000000001. This isn’t a specific issue with Flash either. By it’s very nature, any sort of calculation with floating-point numbers can result in tiny, nearly insignificant errors anywhere in modern computing.

September 2, 2009

Flex based regex tester

Filed under: as3, cool, regex, tool — michaelangela @ 5:10 am

I hadn’t seen this one before. There are other regex testers out there but this one is neat because it helps guide you. There are examples and tooltip help to let you know what you’re doing. Very neat. There is a downloadable version as well apparently. gskinner has been an indirect sort of long-distance teacher for some time now. He has a tremendous amount of resources available on his site.

Jason Sheedy’s blog: Handy regex tester for AS3

I found this tool really useful for testing regex in AS3. There’s a few of these around, but this one is very nicely done.. http://gskinner.com/RegExr/

Should I check it or not! Uncheck it, and leave a note

Filed under: as3, flash, flex, tip — michaelangela @ 12:12 am

Since this is being developed for others, the final concensus is to uncheck it and leave a README.txt that explicitly says so. 🙂

Accessing named MovieClips placed on the stage in Flash CS3 while staying true to OOP best-practices « dispatchEvent()™

I happen to agree with Sarah that the best way to work is to uncheck the checkbox and declare all of your variables yourself. This is the only way that really enforces good practices when you are using classes behind your MovieClips in the library.

September 1, 2009

More on strongly typed references to timeline instances

Filed under: as3, cool, flash, flex, tip — michaelangela @ 11:58 pm

And this states the issue well in a short sentence. Developing for Flash outside of the Flash IDE breaks into two camps if the “Automatically Declare Stage Instances” is checked or not. The solution mentioned below is another way (closer to the way I do) to get a reference not only as a movie clip but as a specific class object. That’s helpful when you’re adding linkages to your symbols with external classes.

Re: [Flashcoders] Automatically Declare Stage Instances andinheritance.

I think unchecking that box is the best way to handle this, but the other options presented are useful for working around these issues. My main worry seems to be incompatibilities with people who may write code using the box checked, which it is by default. It seems that this checkbox forks all AS3 code into two exclusive camps. I hope I make the right choice. 😦 C

On Mon, May 12, 2008 at 3:58 AM, Cor <[EMAIL PROTECTED]> wrote:
> This will do the trick:
>
> private var okButton:SimpleButton = getChildByName(‘okButton’) as SimpleButton;

Getting strongly typed objects from flash cs3

Filed under: as3, cool, flash, flex, tip — michaelangela @ 11:53 pm

I have done this for AS2 using Flash Develop, and something similar to it using PureMVC for a Flash CS3 project developed within FlexBuilder, but it’s nice to see it “approved” of sorts. The issue? How do you access objects on the timeline in a strongly-typed manner. The blog post itself describes the situation well and this solution handles it well enough for me. The good thing is with this solution is that the movie clip name can of course change in the FLA and you only have this to update to keep it in sync.

Flex and Flash Developer – Jesse Warden dot Kizz-ohm » Blog Archive » Designer vs. Developer: Declaring Stage Instances

I think I’ve seen this approach in the Essential ActionScript 3 book and I’ve used it.

1. Leave the option turned on, so the Flash IDE will generate all the properties.
2. For every thing I need to refer and use code hinting I would do the following:

private function get scroller { return this[“mcScroller”]; }

or something like this.

Debug Flash CS3 with Flex Builder

Filed under: as3, flash, flex, tip, tool — michaelangela @ 9:36 pm

Lots of info on using Flex Builder to edit, but not so much on debugging. Just taking some notes.

Using FlexBuilder 3 to debug & edit Flash CS3 projects « The Morphic Group

Recently I was working on a project that due to a requirement had to be compiled in Flash CS3. Having spent the last few years exclusively using FlexBuilder I was shocked at the HORRIBLE AS3 editor and debugger in Flash CS3. I quickly tried to figure out how to edit and debug from FlexBuilder 3. I got some help along the way, and wanted to share the process.

August 21, 2009

Flex setter not executing when using binding

Filed under: as3, debugging, flex, tip, workaround — michaelangela @ 5:30 am

Good to know. And it does make sense as described in the comments. This is for my future reference and for others who may experience it.

In a nutshell, if you have a getter/setter pair and make them [Bindable], the setter will not execute again if the new incoming value is the same as the current value. That speeds up performance but if you always need to check that value, it might be a bit confusing why it’s not executing.

nwebb » One Reason Why Your Flex Getter May Not Execute

Cause
As soon as you make the getter/setter bindable, Flex stops running the setter whenever the value you’re sending in already matches the value that the corresponding getter will return.

Solution
The solution (or at least one solution) is not to rely upon the default propertyChange event which is dispatched for bindable values, and instead create/dispatch a custom event

Generated getters and setters in Flex

Filed under: as3, automation, cool, eclipse, flex, tool — michaelangela @ 1:11 am

So for this particular Flash AS3 project I am doing that uses Flex as the code editor, I was just about to write a getter/setter pair and thought “perhaps someone has made a way to automate this…”

Quick Google later…

No More Writing Getters and Setters in Flex

eokyere blog has one of the best Flex productivity tips I have seen in quite a while. I build AS3 components all day, and spend way too much time manually typing getter and setter methods. Using the Dash plugin for Eclipse and eokyere’s productivity with with dash in eclipse, you’ll never write another getter and setter again!

Flex, SWFObject, history and deeplinking

Filed under: as3, deep-linking, flex, tip, tool — michaelangela @ 12:51 am

A nice template for Flex for incorporating SWFObject, history, and deep linking.

Just Flex: Swfobject 2.1 Flex template. HistoryManager and DeepLinking supported as well

I have been using Geoff Stearns’ SWFObject for a long time. I think it will be useful to share my index.template.html that tuned for using with SWFObject 2 2.1. I was inspired with Ted Patrick’s FXWidget project that uses SWFObject 1.5 for embedding flex content to html page. So now it supports HistoryManager and DeepLinking.

August 20, 2009

Simple AS3 tooltip

Filed under: as3, tip, tool — michaelangela @ 7:11 am

Just want to keep a reference to this one

Tyler Egeto

I’ll be releasing more tools and helpers in the near future as I formalize / clean-up my existing code libraries. In addition to the ActionScript pagination system released earlier this month, PaginatorAS3, today I’m release a small Tooltip system.

Using [Transient]

Filed under: as3, tip — michaelangela @ 7:04 am

I haven’t had to use this yet but it’s definitely a gotcha to keep in mind if doing deep copies and things aren’t working exactly right…

On [Transient], ObjectUtil.copy(), and Casting – darron schall

I ran into an interesting situation not too long ago where ObjectUtil.copy wasn’t working quite as I had expected. The solution that I came up with was to rely on [Transient] metadata. Confused? Let me explain…

Copying DisplayObjects in AS3

Filed under: as3 — michaelangela @ 7:02 am

Going to try to get back into blogging… again…! It’s just been super busy which is a good thing all things considered.
After learning a neat little shortcut on copying objects using a byte array, there was a link to this for duplicating DisplayObjects. Quite useful.
kirupaForum – View Single Post – ActionScript 3 Tip of the Day

ActionScript 3 no longer has a duplicateMovieClip method for MovieClip instances (or any DisplayObject instances). Instead, it’s suggested that you just create a new instance of the display object you wish to duplicate using its constructor. This, however, is not the same as duplicateMovieClip, and, really, is more like using AS1 and AS2’s attachMovieClip. For a more accurate representation of duplicateMovieClip in AS3, consider the following function…

July 14, 2008

Custom Flex Calendar controls

Filed under: as3, cool, dev, flex — michaelangela @ 3:17 am

I have worked with customizing the Flex calendar components and will probably need to do so again in the future, but this is pretty neat. I’ll have to look into this more soon.

Refreshingly new Flex Calendar controls « My journey in the world of RIA

Flex is a very flexible language and I’m here to prove it again.

Today, I’m posting these two new cute flex calendar controls which uses inbuilt “CalendarLayout” class for functionality and has a completely new layout and interface defined in MXML.

July 5, 2008

Loading assets in AS3 and Flash

Filed under: as3, dev, note, tip — michaelangela @ 8:39 pm

Loading up assets can be a pain to track so this set of code aims to simplify that. Need to check it out later though.

AYAN RAY | AS3 / Flash: Introducing the AssetLoader Class

In Actionscript 3, there are many different ways to load external assets from the Internet. Unfortunately, this can become tiresome to find different ways to load each one in it’s own individual way. With this problem in mind, I have created the AssetLoader class.

Animated Skins in Flex

Filed under: as3, flex, note — michaelangela @ 8:38 pm

Very neat. Very cool. You have to check it out if only to see dancing Gingerbread men in Flex… 😛

Tink » Blog Archive » Seamless Animated Skins in Flex

In Joey Lotts session on styling Flex at FOTB (where he did a great job), one of the attendees asked about animated skins.

There’s
obviously many ways to approach this but I thought I’d do an example of
how you can have seamless transitions between these states using frame
labels inside the symbol in Flash, and by adding code using
addFrameScript().

Flash CS3 Open Source “Liquid Components” by Byte Array

Filed under: as3, component, cool, flash, note — michaelangela @ 8:37 pm

I am just about to wrap up a project using Flash CS3 and… I wish I saw this earlier… 🙂

Liquid Components for Flash CS3 [ by Didier Brun ] < ByteArray.org

The “Liquid Components” have been created for the Flash people, freelance coders and designers who wish to integrate fully skinnable components in their website, games or little RIA applications.

AS3 URL class

Filed under: as3, note — michaelangela @ 8:35 pm

Not having access to the mx URL utils with Flash (though I haven’t looked at the possibility just yet) I found this. Could be quite helpful!

AS3 – URL Class | Manfred Weber`s Weblog

I could not find it in the net so I hacked something together quickly. A simple URL class that parses an url string.

Older Posts »

Create a free website or blog at WordPress.com.