Conecta desde flex con mysql directamente con AS3
Aqui teneis una libreria interesante:
posted in Programacion | 0 Comments
Aqui teneis una libreria interesante:
posted in Programacion | 0 Comments
Codigo de ejemplo:
public boolean appConnect(IConnection conn, Object[] params){
//Se enviaran 2 parametros, el parametro 0 indica si es modelo o usuario, el parametro 1 el nombre del room, el parametro 2 el modo privado
if (params[2].toString()==”privado”){
if (!this.appScope.hasChildScope(params[1].toString()) && params[0].toString() ==”modelo”)
this.appScope.createChildScope(params[1].toString());
IScope room = this.appScope.getScope(params[1].toString());
if (this.appScope != room)//guard against re-entrancy
{
//appScope=room;
conn.connect(room);//this will reconnect to the room scope
return appConnect(conn, params);
}
}
return true;
}
posted in Programacion | 0 Comments
SCORE
Tras volverme loco buscando que narices era el score y el IScore.. Tras no saber como pasar ese tipo de valor desde Flex, encontre que las clases creadas para red5 con java tienen una propiedad que siempre se crea y que reciben como parametro el score o ambito en el que la aplicación trabajo.
IScore appScore;
public boolean appStart(IScope app) {
appScore=app;
}
Con eso ya lo tenemos resuelto y disponemos del Score para usarlo donde necesitemos
dentro de la clase java, supongo que los expertos dirán “vaya chorrada”, pero yo he perdido
una tarde entera con este tema. Espero a alguíen le sea util.
SERVICEUTILS
ServiceUtils.invokeOnAllConnections(this.appScope,”ListaUsuarios”,new Object[]{pila});
Esto nos va a permitir ejecutar desde Red5 (codigo java) una funcion de flex de modo que se ejecute para todos los usuarios conectados en ese momento.
VIDEODISPLAY
Aqui un ejemplo de como se usa este control para poder ver tu web cam con flash.
if (Camera.getCamera()){
Camara = Camera.getCamera();
this.ctrCamaraPrivada.attachCamera(Camara);
this.lblInfo.text+=”; Cámara conectada.”
}
else
{
this.lblInfo.text +=”; Cámara no disponible.”
}
posted in PHP, Programacion | 0 Comments
Podemos pasarle y recoger parámetros a nuestro SWF generado con Flex de la siguiente manera:
En la página html que genera Flex cuando compilamos nuestra Aplicación, nos encontramos con código en JavaScript y también con un objeto que embebe nuestro SWF. En nuestro ejemplo se llamarágraficas.swf
Supongamos que queremos abrir la página que contiene nuestra aplicación de gráficas creadas en Flex, y cuyos valores los recogerá de un HttpService, que envía y recoge el Usuario y la Contraseña a una página en ASP, y ésta nos devuelve el resultado en XML.
Sería algo así:
<object classid=”clsid:D27CDB6E-11cf”
id=”graficas”
width=”100%” height=”100%”
codebase=”macromedia.com/get/flashplayer/current/swfla…
param name=”movie”
value=”graficas.swf?usuario=Antonio&pass=12345” />
<param name=”quality” value=”high” />
<param name=”bgcolor” value=”#869ca7″ />
<param name=”allowScriptAccess” value=”sameDomain” />
<embed src=”graficas.swf?usuario=Antonio&pass=12345”
quality=”high” bgcolor=”#869ca7″ width=”100%” height=”100%”
name=”graficas” align=”middle” play=”true” loop=”false”
quality=”high” allowScriptAccess=”sameDomain”
type=”application/x-shockwave-flash”
pluginspage=”adobe.com/go/getflashplayer%22%3E…
</embed></object>
Para pasarlo mediante el código en JavaScript, haríamos lo siguiente:
AC_FL_RunContent( “src”, “graficas?usuario=Antonio&pass=12345“,
“width”, “100%”, “height”, “100%”, “align”,
“middle”, “id”, “graficas”, “quality”, “high”,
“bgcolor”, “#869ca7″, “name”, “graficas”,
“flashvars”,’historyUrl=history.htm%3F&lconid=’ + lc_id + ”,
“flashvars”,’usuario=Antonio&pass=12345′,
“allowScriptAccess”,”sameDomain”, “type”,
“application/x-shockwave-flash”, “pluginspage”,
);
En el código en JS podemos pasarle los parámetros concatenados al nombre del swf o bien ponerlos como un flashvars. De cualquiera de las dos maneras funciona.
y Podemos recuperarlos desde Flex de la siguiente manera:
private var Usuario:String=”";
private var Pass:String=”";
private function ini():void{
Usuario=Application.application.parameters.usuario;
Pass=Application.application.parameters.pass;
}
posted in JavaScript, PHP, Programacion | 0 Comments
En este primer post dedicado a la publicación o uso de bases de datos Mysqlcon nuestras aplicaciones Flex, vamos a abordar la conexión a través de una pasarela creada en PHP.
Esta primera solución es la más sencilla de todas y nos permite tener por ejemplo el frontend de nuestra aplicación en HTML y el backend en Flex.
Pongamos de ejemplo una tienda online que tiene un catálogo de productos y que queremos crear un administrador de éste mediante Flex.
El primer paso que vamos a hacer es la creación de un fichero PHP que haga las consultas pertinentes a la base de datos MySQL y nos devuelva el conjunto de resultados en XML. Este XML será procesado o consumido desde la aplicación Flex y será asociado mediante Data Binding (enlace entre controles y datos) a los controles de nuestro administrador.
Un ejemplo podría ser el siguiente:
Como resultado este fichero devolverá algo como lo siguiente:
Ahora pasamos a la parte Flex que se encargará de consumir este XML que nos devuelve PHP. Para ello crearemos un DataGrid que nos mostrará el resultado. Lo asociaremos mediante data binding al resultado de la llamada al php (mediante HTTPService). Usaremos el formato E4X para mayor comodidad.
El resultado sería el siguiente:

posted in PHP, Programacion | 0 Comments
Continuando con la serie de minitutoriales dedicados a la integración entre Adobe Flex y una base de datos Mysql, vamos a ilustrar un nuevo ejemplo de inserción de datos a través de nuestra pasarela PHP.
Para ello vamos a seguir trabajando sobre el primer ejemplo que teníamos y vamos a crear un nuevo estado con el nombre “insert”, donde pondremos el formulario de inserción de un nuevo producto.

El código fuente sería el siguiente:
Por otra parte deberemos crear una llamada HTTPService para llamar al fichero PHP que se encarga de la inserción. Destacar que debemos poner el mismo método de petición (GET o POST) en ambos sitios:
(Fichero PHP)
Por último nos queda definir la función que se desencadenará al pulsar el botón insertar del formulario:
posted in PHP, Programacion | 0 Comments
Tras una ardua busqueda… con lo fácil que sería que cada TabPage tuviese una propiedad “visible”. Pues no.
Para ocultar un TabPage:
TabPage.Parent = nothing
Para volverlo a mostrar:
TabPage.Parent = TabControl
Hale!
posted in Programacion | 0 Comments
Gestor de reportes gratuito y perfecto para vuestras aplicaciones (sean del tamaño que sean) .net (2.0). Podeis descargarlo aquí.
Special functions are special string that you can insert into some text properties such as Label text, OleDb DataSource connection string or Image ImageFile to get some dynamic values.
This is the list of supported functions.
Report related functions
{@ReportPath}
The report path.
This can be useful if used into a connection string or an image path to indicate a relative path to a .mdb or a picture file.
i.e.:
Image1.ImageFile = "{@ReportPath}imagesmypicture.jpg"
{@PageCount}
The total number of pages of the generated report.
This can be used with {@PageNumber} to write the current page info:
i.e.:
Label1.Text = "Page {@PageNumber} of {@PageCount}"
{@PageNumber}
The current page number.
This can be used with {@PageCount} to write the current page info:
i.e.:
Label1.Text = "Page {@PageNumber} of {@PageCount}"
{@RecordCount}
The total number of record in the generated report.
This can be used similarly to {@PageCount} and {@PageNumber} to write the current record info:
i.e.:
Label1.Text = "Article {@RecordNumber} of {@RecordCount}"
{@RecordNumber}
The current record number in the generated report.
This can be used similarly to {@PageCount} and {@PageNumber} to write the current record info:
i.e.:
Label1.Text = "Article {@RecordNumber} of {@RecordCount}"
Data related functions
These functions If used into a GroupSection them are executed ont the records included into the group by the property GroupFieldList.
If used into others sections it does the sum for all the records in the report.
These functions have the following syntax:
{@() }
where
is the function name, i.e. COUNT or SUM
is the field against which the function is executed.
is an optional list of options separated by spaces.
The option syntax is
()
where
can be
f
for the format
The format used to write the data. This can be i.e. 0.00 if you want a number formatted with 2 decimal digits.
n
for the null text
The null text is the text to be printed if the data into the field is Null.
Examples
{@SUM(UnitPrice)}
Prints the sum of the field UnitPrice using the current settings for numbers.
{@SUM(UnitPrice) f(0.00)}
Prints the sum of the field UnitPrice with 2 decimal digits.
{@SUM(UnitPrice) f(#,##0.00)}
Prints the sum of the field UnitPrice with thousand separator and 2 decimal digits.
{@FIELD(UnitPrice) f(0.00) n(*Price not available*)}
Prints the content of the field UnitPrice with 2 decimal digits and prints “*Price not available*” if the UnitPrice is Null .
{@FIELD(UnitPrice) n(*Price not available*)}
Prints the content of the field UnitPrice or “*Price not available*” if the UnitPrice is Null .
Supported functions
{@AVG()}
Compute the average of the field.
{@COUNT()}
Compute the count of the record in the group.
{@FIELD()}
Return the value of the field.
{@MAX()}
Return the max value for the field into the group.
{@MIN()}
Return the min value for the field into the group.
{@NR_FIELD()}
Return value of the field in the next record.
{@SUM()}
Return the sum of the value of the field into the group.
posted in Programacion | 0 Comments
Para poder usar eclipse para conectar a sql server y usarlo como editor tsql necesitamos:
Descargar e instalar eclipse (con instalar el sdk a pelo sobra).
Descargar el plugin http://sourceforge.net/projects/dbedit/
Para hacerlo funcionar:
I installed the Eclipse DBEdit Plug-in today in order to try to save some development time. The plug-in looks pretty cool, but took some time to install. I first tried to see if I could use the Macromedia JDBC drivers that were on my box, since I already have CFMX 7 installed. Turns out you get an “Restricted Access” message when trying to use the Macromedia drivers when you’re not using a Macromedia product. This lead me to installing the Microsoft SQL Server JDBC drivers.
Here’s what I had to do to get DBEdit installed. I think many good open source projects go unused because often there’s a complete lack of instructions for getting the project installed and getting it operational. So if you’re using SQL Server 2000 and Eclipse and want to get DBEdit running, you’ve come to the right place!
NOTE: If using WinRAR, you should be able to open up “mssqlserver.tar” and then open up the “msjdbc.tar” and browse to the “./lib” folder without extracting all the .tar files.
NOTE: If you want to specify database other than the default database for the user you’re logging into, you can specify the database to log into by default, by adding the databaseName argument to the URL string. (Where XXX is the name of the database.)jdbc:microsoft:sqlserver://127.0.0.1:1433;databaseName=XXXX
If all goes well, you should see your database info.
posted in Programacion | 0 Comments