Category Archives: Flash

Simple Java profiler

This is a small collection of Java classes to provide a simple profiling functionality: include it into your application to register the time consumption of your function calls. It may come in handy where a particularly slow module has been spotted and there is no need for a more complex profiling system

Besides of a time line of the application execution, it creates an histogram to present where your application spends more resources and what the most called functions are.

Continue reading Simple Java profiler

ActionScript 3 and cross-domain problem

One of the most typical problems when coding AS3 to, let’s say, read data from an external XML source, is the cross-domain problem. According to security policies, not an url outside the domain where the AS application is being executed can be read, and different subdomains (such as www.yourdomain.com and yourdomain.com) are considered as different ones.

If the external resources you are trying to use come from your own application in another domain / server that you manage, then it can be fixed by adding a cross-domain policy file. This file must be defined on the content source server, and your AS application has to explicitly declare this server as allowed.

?View Code ACTIONSCRIPT
1
2
Security.allowDomain("domainone.com");
Security.allowDomain("domaintwo.com");

 

But if this is not the case and the content source is on a different remote server like, for instance, when implementing an RSS news reader which grabs content from sources like online news sites, then this problem can be worked out with a PHP proxy file.

Continue reading ActionScript 3 and cross-domain problem

Loading data in Flash from an external XML

Notice: Article only available in Spanish!

Cuando trabajamos con aplicaciones en flash y queremos que conecten con bases de datos para mostrar catálogos de productos, noticias, etc., la mejor forma de hacerlo es mediante el paso de mensajes en formato XML. Leemos de servicios web correctamente formateados en XML, y después mostraremos los datos según nos convenga en la aplicación flash.

Partimos de un archivo XML correctamente formateado, bien estático y alojado en cualquier carpeta del servidor, bien una url a una pasarela php que previamente lea los datos de una base de datos y después los muestre en XML. Vamos a necesitar tres cosas: un objeto LoadVars, un objeto XML y conocer la estructura de los nodos XMLpara poderlos recorrer correctamente.

Continue reading Loading data in Flash from an external XML