Comunidad de diseño web y desarrollo en internet online

Problema con enlaces guardados en MySQL en Flash Buider 4

Citar            
MensajeEscrito el 22 Mar 2011 04:00 pm
Hola Tengo un problema con una datalist.
Quisiera que cada elemento del data list al pincharse me llevara a una url almacenada en mi base de datos.
Este es mi código:

Código XML :

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:d="http://ns.adobe.com/fxg/2008/dt" xmlns:fc="http://ns.adobe.com/flashcatalyst/2009" backgroundColor="#FFFFFF" height="600" preloaderChromeColor="#FFFFFF" width="800" xmlns:enlacesservice2="services.enlacesservice2.*">
   <fx:Style source="Main.css"/>
   <fx:Script><![CDATA[
      import mx.controls.Alert;
      import mx.events.FlexEvent;

      protected function list_changeHandler():void
      {
         var request:URLRequest =  new URLRequest(data.enlace);   
         navigateToURL( request, "_blank");
         }

      
      protected function list_creationCompleteHandler(event:FlexEvent):void
      {
         getAllEnlacesResult.token = enlacesService2.getAllEnlaces();
      }
      
   ]]></fx:Script>
   <fx:Declarations>
      <s:CallResponder id="getAllEnlacesResult"/>
      <enlacesservice2:EnlacesService2 id="enlacesService2" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
   </fx:Declarations>
   <fx:DesignLayer d:userLabel="Layer 1">
      <s:List skinClass="components.DataList1" x="92" y="63" change="list_changeHandler()" id="list" creationComplete="list_creationCompleteHandler(event)" labelField="enlace">
         <s:AsyncListView list="{getAllEnlacesResult.lastResult}"/>
      </s:List>
   </fx:DesignLayer>
</s:Application>


Mi problema es que cuando pongo en

Código XML :

var request:URLRequest =  new URLRequest(data.enlace);

una url cualquiera si funciona y me lleva a esa web pero si pongo

Código :

data.enlace

me da este error : "1120: Access of undefined property data."

Que conste que en mi repeated item si funciona lo de

Código :

data.enlace

y me lista la base de datos.
Este es código de mi repeated item:

Código XML :

<?xml version="1.0" encoding="utf-8"?>
<s:ItemRenderer xmlns:s="library://ns.adobe.com/flex/spark" xmlns:fx="http://ns.adobe.com/mxml/2009" autoDrawBackground="false" xmlns:d="http://ns.adobe.com/fxg/2008/dt">
   <s:states>
      <s:State name="normal"/>
      <s:State name="hovered"/>
      <s:State name="selected"/>
   </s:states>
   <s:RichText color="#2B4381" fontFamily="Square721 BT" fontSize="20" height="24" tabStops="S0 S50 S100 S150 S200 S250 S300" text="{data.enlace}" width="218" x="0" y="0"/>
   <s:Rect d:userLabel="Item Highlight Rectangle" width="218" height="24" alpha.normal="0" alpha.hovered="0.3" alpha.selected="0.5">
      <s:fill>
         <s:SolidColor color="0xCED7EE"/>
      </s:fill>
   </s:Rect>
</s:ItemRenderer>

Sería de gran ayuda que me hicierais ver donde está mi error.
Un saludo y gracias.

Por Narsyl

1 de clabLevel



 

firefox
Citar            
MensajeEscrito el 22 Mar 2011 04:54 pm
Dado que estás usando RichtText, el data enlace tiene que estar con todos los tags correctos, es decir

text="<a href=' http://{data.enlace}>ir a web</a>"

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 23 Mar 2011 02:40 am
Hola Jorge!
Gracias por tu respuesta pero no conseguí hacerlo funcionar con tu solución, así que buscando por ahí encontré otra solución:
Cambié el RichText por RichEditableText de mi repeated item tal que así:

Tenía esto:

Código XML :

<s:RichText color="#2B4381" fontFamily="Square721 BT" fontSize="20" height="24" tabStops="S0 S50 S100 S150 S200 S250 S300" text="{data.enlace}" width="218" x="0" y="0"/>

y lo cambié por esto:

Código XML :

<s:RichEditableText color="#2B4381" fontFamily="Square721 BT" fontSize="20" height="24" tabStops="S0 S50 S100 S150 S200 S250 S300" editable="false" width="218" x="0" y="0">
      <s:content><s:p>Aqui hay un <s:a href="{data.enlace}">enlace</s:a></s:p></s:content>
   </s:RichEditableText>

Pero que sepas que si no me hubieras dicho lo del RichText no lo hubiera conseguido.
Mil Gracias!

Por Narsyl

1 de clabLevel



 

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.