Archive for the ‘ Tools ’ Category

Today I had to install the must-have flash switcher extension for firefox (by Alessandro Crugnola) and I found that it’s not compatible with firefox versions after 3.0 …

I trust in sephiroth’s extension going to work properly even in unsupported firefox versions, and however it’s worth the attempt, so, how to install it anyway?

First of all, download the flash switcher extension from the mozilla addons site ( https://addons.mozilla.org/en-US/firefox/addon/5044/ ) and save it on your hard drive.

Now that you have the .xpi file rename it to .zip and decompress it, you’re getting a plugin and content folders, chrome.manifest and install.rdf files.

Open install.rdf with a text editor and examine this tag


here min and max versions are defined for the extension, so just change em:maxVersion from 3.0pre to 3.8 (or whatever) and save the file.

Now select all files and folders (not the parent folder!!!) (plugin, content, chrome.manifest, install.rdf) and zip all together, then change the extension from .zip to .xpi.

Open firefox, File>Open, browse to the .xpi file, install… done and working!! w00t! :)

My unsupported (but properly working) version of firefox is 3.6.8, the flash switcher extension version is 2.0.2.

enjoy :)

Recently I faced this problem: how to get if a Class is extending another one or implementing an interface?

this is the specific case:

function checkType(toCheck:Class,typeClass:Class=null,typeInterface:Class=null):Boolean
{
// if an instance of toCheck is a typeClass or a typeInterface
// return true
// else
// return false
}

The task is quite simple, the first solution would be get an instance of toCheck and use the is operator to actually check the type…but this would mean both a waste of resources and an “unwanted behaviour generator” (just think about a parser class instantiated without a real need or something like that).

Nope, that solution sucks.

Let’s try something better, let’s make the player inform us which is the toCheck class structure, let’s use describeType.

describeType is a wonderful function you can find in flash.utils package, it examines an untyped object and returns an xml document containing the description of that type (more details at adobe livedocs)…something like this:

NOTE: click on “view code” to see the real xml document, my wp is escaping tags chars <> …:\

<type name="flash.events::EventDispatcher" base="Class" isDynamic="true" isFinal="true" isStatic="true">
  <extendsClass type="Class"/>
  <extendsClass type="Object"/>
  <accessor name="prototype" access="readonly" type="*" declaredBy="Class"/>
  <factory type="flash.events::EventDispatcher">
    <metadata name="Event">
      <arg key="name" value="deactivate"/>
      <arg key="type" value="flash.events.Event"/>
    </metadata>
    <metadata name="Event">
      <arg key="name" value="activate"/>
      <arg key="type" value="flash.events.Event"/>
    </metadata>
    <extendsClass type="Object"/>
    <implementsInterface type="flash.events::IEventDispatcher"/>
    <constructor>
      <parameter index="1" type="*" optional="true"/>
    </constructor>
    <method name="willTrigger" declaredBy="flash.events::EventDispatcher" returnType="Boolean">
      <parameter index="1" type="String" optional="false"/>
    </method>
    <method name="hasEventListener" declaredBy="flash.events::EventDispatcher" returnType="Boolean">
      <parameter index="1" type="String" optional="false"/>
    </method>
    <method name="removeEventListener" declaredBy="flash.events::EventDispatcher" returnType="void">
      <parameter index="1" type="String" optional="false"/>
      <parameter index="2" type="Function" optional="false"/>
      <parameter index="3" type="Boolean" optional="true"/>
    </method>
    <method name="dispatchEvent" declaredBy="flash.events::EventDispatcher" returnType="Boolean">
      <parameter index="1" type="flash.events::Event" optional="false"/>
    </method>
    <method name="addEventListener" declaredBy="flash.events::EventDispatcher" returnType="void">
      <parameter index="1" type="String" optional="false"/>
      <parameter index="2" type="Function" optional="false"/>
      <parameter index="3" type="Boolean" optional="true"/>
      <parameter index="4" type="int" optional="true"/>
      <parameter index="5" type="Boolean" optional="true"/>
    </method>
    <method name="toString" declaredBy="flash.events::EventDispatcher" returnType="String"/>
  </factory>
</type>

As you can see in this EventDispatcher type description there are two nodes witch are fitting the task’s purposes:

<extendsClass> and <implementsInterface>

Those nodes are repeated for each class or interface in the given class (toCheck) chain of inheritance and they contain the qualified class name string of the extended\implemented class\interface.

In this case EventDispatcher extendsClass type=’Object’ and implementsInterface type=’flash.events::IEventDispatcher’ …quite clear right?:) Now, back to the implementation:

function checkType(toCheck:Class,typeClass:Class=null,typeInterface:Class=null):Boolean
{
	//gets the toCheck class type xml description
	var _typeXML:XML=describeType(toCheck);
	//gets the typeClass and typeInterface qualified class names
	var _result:Boolean=false;
	if (typeClass) {
		// if toCheck is a typeClass
		for each (var _extClass:XML in _typeXML.factory.elements('extendsClass')) {
			if (_extClass.@type==getQualifiedClassName(typeClass)) {
				_result=true;
				break;
			}
		}
	}
	// do the same for typeInterface but checking 'implementsInterface' node
	if (typeInterface) {
		for each (var _impInterface:XML in _typeXML.factory.elements('extendsClass')) {
			if (_impInterface.@type==getQualifiedClassName(typeInterface)) {
				_result=true;
				break;
			}
		}
	}

	return _result;
}

…and the task got done :)

stay tuned :)

Recently I’ve been searching for a plugin for eclipse, a tool, *something*, able to generate code snippets on the fly. This lack of eclipse IDE is filled by a project called Eclipse Monkey, a dead (yes…dead..-.-’) component of  Project Dash which enables Eclipse to execute javascript functions on demand.

Eclipse Monkey will put a “scripts” menu on your Eclipse menu bar which is populated by the list of scripts (.js) inside the specified folder.

Here’s my Scripts>Actionscript dropdown menu

Installation:

1) Add project dash site ( http://download.eclipse.org/technology/dash/update )  to your eclipse’s update sites,
2) Restart eclipse,
3) Run create test project by selecting scripts menu,
4) Download actionscript snippets lib from here

…great deal :)

Here’s a video showing Eclipse Monkey at work

[flash http://www.youtube.com/v/z9aL_OZzRJk&hl=en&fs=1 w=400 h=310 mode=1]

UPDATE:

take a look to “Pimp my Eclipse” post from Lee Brimelow (part 1 and 2) for further customizing your eclipse installation :)

 
Saturday, August 30th, 2008

Since it has been created i’ve been a fan of flash tracer extension, i really fell in love with that tool, but i noticed it slow down the browser and can even make it crash.

So, let’s open a trace logger on our terminal…

To do that the right command is “tail” which actually “[...]Print  the  last 10 lines of each FILE to standard output[...]” and the file to open is located in /Users/[your username]/Library/Preferences/Macromedia/Flash\ Player/Logs/flashlog.txt

Then, let’s do something good and useful with that:

open your TextEdit, cmd+shift+T to switch to plain text, write down this one line command:

tail -f /Users/[your username]/Library/Preferences/Macromedia/Flash\ Player/Logs/flashlog.txt

save the file as “flashtracer.sh” and use sh as file extension instead of txt.

then right click on the file, reach the “open with” menu and choose “terminal” application located inside utility folder. Note: it would be great if you set terminal as default application to open that file :)

ok, now everything’s ready; double click on flashtracer.sh and start tracing :)

Note: remember you’re in a shell now, so you can clear up the lines with cmd+K…

I hope it can be useful,

byez :)

 
Tuesday, May 27th, 2008

UPDATE: http://www.flashfuck.it/fps-monitor/

Here’s some (usefull i hope :) ) source..

fpsmonitor.png

I’ve made a little fps monitor for my projects (for both as3 and flex)… so, here’s some souce and some howtos about…

There are 2 classes, FPSMonitor is made for as3 (or flash) projects, the other one, FlexFPSMonitor is made expecially for use in Flex.

Usage AS3:

import it.flashfuck.debugger.FPSMonitor;
//[...]
addChild(new FPSMonitor());

Usage Flex:

// new xmlns in application tag
xmlns:debugger="it.flashfuck.debugger.*"
//then add the tag, remember to add it at the end of your app so it's appearing in front of everything

quite simple hm? :D
The main difference between these classes’ results is dragging. Flex one is draggable over the application stage, the other one is not draggable (just edit the code if you want to bring it away among the screen :) )….

Features
FPSMonitor (as the flex one) is monitoring
- OS, Player type, version, and “is debugger”
- FPS
- Memory usage (note: this parameter tells you the memory usage by ALL flash player instances you’re running, so if you’re running more than 1 player at once this value is altered!…even in 2 firefox tabs or a standalone and a browser player)

Graph:
FPSMonitor is displaying in a graph 2 values: FPS (white) and memory usage (black) (same note for this value :) )
Everything is blended with BlendMode.INVERT so you can see the monitor in quite every condition.

I hope you enjoy.
Download here both classes FPSMonitor.as and FlexFPSMonitor.as

….just a note: feel free to use this code anywhere, if you’re improving functionalities, adding more features or anything else please just send me a smoke signal or a pidgeon with a message so i can update the source :)

 
Tuesday, December 11th, 2007

Flow” è un tool che permette di lanciare il compilatore flash (sia il test movie che il compile vero e proprio) direttamente da Eclipse.


Lavora in command line, ma viaggia in automatico, una volta configurato il path di compilazione nel file .config eclipse fa praticamente tutto da sola.

Esistono altri progetti simili a questo, lo stesso Jaco ne cita due : flashCommand e compileProject, ma a quanto pare non sono pi√π sviluppati.

Jaco ha pubblicato anche uno screencast dove viene mostrato Flow in azione (Venetian Spoken :D ).

Per ora Flow è disponibile in EXE…quindi niente trippa per gli unixbased come il sottoscritto…per ora (vero jaco?:D)

Un tool che non faciliterà la vita a tutti, ma a molti :D

Grande, respect.

Direttamente dal blog ufficiale di papervision apprendo con gran gaudio che Swift 3d, software 3d che per primo ha scommesso su flash, avrà una funzione “export for papervision”a partire dalla prossima versione (5, di cui abbiamo una diapositiva :D ).

Vista la grandissima facilità di utilizzo di swift (lo usavo anche io prima di passare a blender…che sarà anche pi√π difficile, ma è free ed è completo) e l’ottima integrazione con flash si preannunciano valanghe di siti 3D :D

A questo indirizzo c’è anche la rassegna stampa di Electric Rain, software house di swift, in cui vengono descritte le varie funzionalità del programma…tra le quali papervision non è l’unica sorpresa, infatti il 3d processor di erain esporterà anche in XAML per WPF e Silverlight.